NadekoBot.Extensions should now be fully annotated with nullable reference types as well as many classes from NadekoBot.Common

This commit is contained in:
Kwoth
2021-12-28 10:44:00 +01:00
parent 0634470a8a
commit 59f5056035
543 changed files with 1895 additions and 1448 deletions

View File

@@ -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)));
@@ -171,4 +174,4 @@ public class ReplacementBuilder
return this;
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Text.RegularExpressions;
#nullable disable
using System.Text.RegularExpressions;
namespace NadekoBot.Common;
@@ -89,4 +90,4 @@ public class Replacer
return newEmbedData;
}
}
}