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