mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 08:14:28 -05:00 
			
		
		
		
	NadekoBot.Extensions should now be fully annotated with nullable reference types as well as many classes from NadekoBot.Common
This commit is contained in:
		@@ -1,9 +1,13 @@
 | 
			
		||||
root = true
 | 
			
		||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
 | 
			
		||||
 | 
			
		||||
[obj/**]
 | 
			
		||||
generated_code = true
 | 
			
		||||
 | 
			
		||||
# C# files
 | 
			
		||||
[*.cs]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### Core EditorConfig Options ####
 | 
			
		||||
 | 
			
		||||
# Indentation and spacing
 | 
			
		||||
@@ -263,7 +267,7 @@ dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, int
 | 
			
		||||
dotnet_naming_symbols.non_field_members.required_modifiers = 
 | 
			
		||||
 | 
			
		||||
dotnet_naming_symbols.private_readonly_field.applicable_kinds = field
 | 
			
		||||
dotnet_naming_symbols.private_readonly_field.applicable_accessibilities = private
 | 
			
		||||
dotnet_naming_symbols.private_readonly_field.applicable_accessibilities = private, protected
 | 
			
		||||
dotnet_naming_symbols.private_readonly_field.required_modifiers = readonly
 | 
			
		||||
 | 
			
		||||
dotnet_naming_symbols.private_field.applicable_kinds = field
 | 
			
		||||
@@ -327,7 +331,7 @@ resharper_wrap_before_invocation_rpar = false
 | 
			
		||||
resharper_csharp_wrap_after_declaration_lpar = true
 | 
			
		||||
resharper_csharp_wrap_before_invocation_rpar = true
 | 
			
		||||
resharper_csharp_wrap_parameters_style = chop_if_long
 | 
			
		||||
resharper_force_chop_compound_if_expression = true
 | 
			
		||||
resharper_force_chop_compound_if_expression = false
 | 
			
		||||
resharper_keep_existing_linebreaks = false
 | 
			
		||||
resharper_max_formal_parameters_on_line = 3
 | 
			
		||||
resharper_wrap_chained_binary_expressions = chop_if_long
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using System.Collections.Immutable;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
@@ -54,6 +55,7 @@ public sealed class Bot
 | 
			
		||||
            AlwaysDownloadUsers = false,
 | 
			
		||||
            AlwaysResolveStickers = false,
 | 
			
		||||
            AlwaysDownloadDefaultStickers = false,
 | 
			
		||||
            GatewayIntents = GatewayIntents.All,
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        _commandService = new(new()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public enum AddRemove
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
 | 
			
		||||
public static class CommandNameLoadHelper
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
 | 
			
		||||
[AttributeUsage(AttributeTargets.Class)]
 | 
			
		||||
internal sealed class NadekoModuleAttribute : GroupAttribute
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
 | 
			
		||||
[AttributeUsage(AttributeTargets.Method)]
 | 
			
		||||
public sealed class NadekoOptionsAttribute : Attribute
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Attributes;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
 | 
			
		||||
namespace Discord;
 | 
			
		||||
 | 
			
		||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
 | 
			
		||||
[AttributeUsage(AttributeTargets.Method)]
 | 
			
		||||
public class UserPermAttribute : RequireUserPermissionAttribute
 | 
			
		||||
{
 | 
			
		||||
    public override Task<PreconditionResult> CheckPermissionsAsync(
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
// License MIT
 | 
			
		||||
#nullable disable
 | 
			
		||||
// License MIT
 | 
			
		||||
// Source: https://github.com/i3arnon/ConcurrentHashSet
 | 
			
		||||
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Collections;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public class CommandData
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using Cloneable;
 | 
			
		||||
using NadekoBot.Common.Yml;
 | 
			
		||||
using SixLabors.ImageSharp.PixelFormats;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.Configs;
 | 
			
		||||
namespace NadekoBot.Common.Configs;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Base interface for available config serializers
 | 
			
		||||
@@ -8,7 +8,8 @@ public interface IConfigSeria
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Serialize the object to string 
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public string Serialize<T>(T obj);
 | 
			
		||||
    public string Serialize<T>(T obj)
 | 
			
		||||
        where T: notnull;
 | 
			
		||||
        
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Deserialize string data into an object of the specified type
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Common.Yml;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Common.Yml;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public class DownloadTracker : INService
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public static class Helpers
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
public interface IBotCredentials
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public interface ICloneable<T>
 | 
			
		||||
    where T : new()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
public interface IEmbedBuilder
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public interface INadekoCommandOptions
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public interface IPlaceholderProvider
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Common.Yml;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Common.Yml;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using System.Text.Json;
 | 
			
		||||
using System.Text.Json.Serialization;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using SixLabors.ImageSharp.PixelFormats;
 | 
			
		||||
using SixLabors.ImageSharp.PixelFormats;
 | 
			
		||||
using System.Text.Json;
 | 
			
		||||
using System.Text.Json.Serialization;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using CommandLine;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using CommandLine;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Net;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Net;
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Implemented by modules which block execution before anything is executed
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
 | 
			
		||||
public interface IInputTransformer
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
 | 
			
		||||
public interface ILateBlocker
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Last thing to be executed, won't stop further executions
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
namespace NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// All services which need to execute something after
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
// ReSharper disable InconsistentNaming
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Security.Cryptography;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Security.Cryptography;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Diagnostics.CodeAnalysis;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Diagnostics.CodeAnalysis;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public class OldImageUrls
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using CommandLine;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using CommandLine;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public class OsuMapData
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public static class PlatformHelper
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.Pokemon;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.Pokemon;
 | 
			
		||||
 | 
			
		||||
public class PokemonNameId
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Pokemon;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.Pokemon;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.Pokemon;
 | 
			
		||||
 | 
			
		||||
public class SearchPokemonAbility
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,13 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public class EventPubSub : IPubSub
 | 
			
		||||
{
 | 
			
		||||
    private readonly Dictionary<string, Dictionary<Delegate, List<Func<object, ValueTask>>>> _actions = new();
 | 
			
		||||
    private readonly Dictionary<string, Dictionary<Delegate, List<Func<object?, ValueTask>>>> _actions = new();
 | 
			
		||||
    private readonly object _locker = new();
 | 
			
		||||
 | 
			
		||||
    public Task Sub<TData>(in TypedKey<TData> key, Func<TData, ValueTask> action)
 | 
			
		||||
    public Task Sub<TData>(in TypedKey<TData> key, Func<TData?, ValueTask> action)
 | 
			
		||||
    {
 | 
			
		||||
        Func<object, ValueTask> localAction = obj => action((TData)obj);
 | 
			
		||||
        Func<object?, ValueTask> localAction = obj => action((TData?)obj);
 | 
			
		||||
        lock (_locker)
 | 
			
		||||
        {
 | 
			
		||||
            if (!_actions.TryGetValue(key.Key, out var keyActions))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public interface IPubSub
 | 
			
		||||
{
 | 
			
		||||
    public Task Pub<TData>(in TypedKey<TData> key, TData data);
 | 
			
		||||
    public Task Sub<TData>(in TypedKey<TData> key, Func<TData, ValueTask> action);
 | 
			
		||||
    public Task Sub<TData>(in TypedKey<TData> key, Func<TData?, ValueTask> action);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public interface ISeria
 | 
			
		||||
{
 | 
			
		||||
    byte[] Serialize<T>(T data);
 | 
			
		||||
    T Deserialize<T>(byte[] data);
 | 
			
		||||
    T? Deserialize<T>(byte[]? data);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using System.Text.Json;
 | 
			
		||||
using System.Text.Json;
 | 
			
		||||
using NadekoBot.Common.JsonConverters;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
@@ -13,7 +13,7 @@ public class JsonSeria : ISeria
 | 
			
		||||
    public byte[] Serialize<T>(T data)
 | 
			
		||||
        => JsonSerializer.SerializeToUtf8Bytes(data, _serializerOptions);
 | 
			
		||||
 | 
			
		||||
    public T Deserialize<T>(byte[] data)
 | 
			
		||||
    public T? Deserialize<T>(byte[]? data)
 | 
			
		||||
    {
 | 
			
		||||
        if (data is null)
 | 
			
		||||
            return default;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
using StackExchange.Redis;
 | 
			
		||||
using StackExchange.Redis;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
@@ -22,7 +22,7 @@ public sealed class RedisPubSub : IPubSub
 | 
			
		||||
            .PublishAsync($"{_creds.RedisKey()}:{key.Key}", serialized, CommandFlags.FireAndForget);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Task Sub<TData>(in TypedKey<TData> key, Func<TData, ValueTask> action)
 | 
			
		||||
    public Task Sub<TData>(in TypedKey<TData> key, Func<TData?, ValueTask> action)
 | 
			
		||||
    {
 | 
			
		||||
        var eventName = key.Key;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public readonly struct TypedKey<TData>
 | 
			
		||||
{
 | 
			
		||||
@@ -19,7 +19,7 @@ public readonly struct TypedKey<TData>
 | 
			
		||||
    public static bool operator !=(in TypedKey<TData> left, in TypedKey<TData> right)
 | 
			
		||||
        => !(left == right);
 | 
			
		||||
 | 
			
		||||
    public override bool Equals(object obj)
 | 
			
		||||
    public override bool Equals(object? obj)
 | 
			
		||||
        => obj is TypedKey<TData> o && o == this;
 | 
			
		||||
 | 
			
		||||
    public override int GetHashCode()
 | 
			
		||||
 
 | 
			
		||||
@@ -22,6 +22,7 @@ public class YamlSeria : IConfigSeria
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string Serialize<T>(T obj)
 | 
			
		||||
        where T: notnull
 | 
			
		||||
    {
 | 
			
		||||
        var escapedOutput = _serializer.Serialize(obj);
 | 
			
		||||
        var output = _codePointRegex.Replace(escapedOutput,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
@@ -56,6 +57,7 @@ public class ReplacementBuilder
 | 
			
		||||
 | 
			
		||||
    public ReplacementBuilder WithServer(DiscordSocketClient client, SocketGuild g)
 | 
			
		||||
    {
 | 
			
		||||
        _reps.TryAdd("%server%", () => g is null ? "DM" : g.Name);
 | 
			
		||||
        _reps.TryAdd("%server.id%", () => g is null ? "DM" : g.Id.ToString());
 | 
			
		||||
        _reps.TryAdd("%server.name%", () => g is null ? "DM" : g.Name);
 | 
			
		||||
        _reps.TryAdd("%server.members%", () => g is { } sg ? sg.MemberCount.ToString() : "?");
 | 
			
		||||
@@ -97,6 +99,7 @@ public class ReplacementBuilder
 | 
			
		||||
 | 
			
		||||
    public ReplacementBuilder WithManyUsers(IEnumerable<IUser> users)
 | 
			
		||||
    {
 | 
			
		||||
        _reps.TryAdd("%user%", () => string.Join(" ", users.Select(user => user.Mention)));
 | 
			
		||||
        _reps.TryAdd("%user.mention%", () => string.Join(" ", users.Select(user => user.Mention)));
 | 
			
		||||
        _reps.TryAdd("%user.fullname%", () => string.Join(" ", users.Select(user => user.ToString())));
 | 
			
		||||
        _reps.TryAdd("%user.name%", () => string.Join(" ", users.Select(user => user.Username)));
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using Newtonsoft.Json.Serialization;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public struct ShmartNumber : IEquatable<ShmartNumber>
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
public sealed record SmartEmbedText : SmartText
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
public sealed record SmartPlainText : SmartText
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
public class SmartTextEmbedField
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common;
 | 
			
		||||
 | 
			
		||||
public sealed class ReactionEventWrapper : IDisposable
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Modules.CustomReactions.Services;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Modules.CustomReactions.Services;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
public sealed class EmoteTypeReader : NadekoTypeReader<Emote>
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
public sealed class GuildTypeReader : NadekoTypeReader<IGuild>
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
public sealed class KwumTypeReader : NadekoTypeReader<kwum>
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
 | 
			
		||||
public class PermissionAction
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
public sealed class ModuleTypeReader : NadekoTypeReader<ModuleInfo>
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
[MeansImplicitUse(ImplicitUseTargetFlags.Default | ImplicitUseTargetFlags.WithInheritors )]
 | 
			
		||||
public abstract class NadekoTypeReader<T> : TypeReader
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
using Color = SixLabors.ImageSharp.Color;
 | 
			
		||||
 | 
			
		||||
public sealed class Rgba32TypeReader : NadekoTypeReader<Color>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
using NadekoBot.Db;
 | 
			
		||||
using NadekoBot.Modules.Gambling.Services;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.Yml;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.Yml;
 | 
			
		||||
 | 
			
		||||
public class CommentAttribute : Attribute
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
using YamlDotNet.Serialization.TypeInspectors;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Yml;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
using YamlDotNet.Core.Events;
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
using YamlDotNet.Serialization.ObjectGraphVisitors;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
using YamlDotNet.Serialization.EventEmitters;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using SixLabors.ImageSharp.PixelFormats;
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
using YamlDotNet.Core.Events;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using YamlDotNet.Core;
 | 
			
		||||
using YamlDotNet.Core.Events;
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.Yml;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
namespace NadekoBot.Common.Yml;
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Common.Yml;
 | 
			
		||||
 | 
			
		||||
public class YamlHelper
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Db.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Db;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Db;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using LinqToDB;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Db;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Db.Models;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Db.Models;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using LinqToDB;
 | 
			
		||||
using LinqToDB.EntityFrameworkCore;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Services.Database;
 | 
			
		||||
using NadekoBot.Db.Models;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Db;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Db;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Services.Database;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Db;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Db;
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user