From 7f2b5b38f41da49fe279205e895bd1d7668c2f8b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:56:17 +0000 Subject: [PATCH 01/61] chore(deps): update dependency htmlsanitizer to v9 --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index a239da78..040172a4 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -44,7 +44,7 @@ - + From dac0a0a8b47b032bdd60d48f965fc524add725d1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 22:20:35 +0100 Subject: [PATCH 02/61] chore(deps): update dependencies/discatsharp digest to 79808aa (#522) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 5f4f5c46..79808aa3 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 5f4f5c46f808fd2199a6cc8b6b9dabaa646b5d86 +Subproject commit 79808aa32fb13843110c81b4f47e926e714e916b From 46dc0947c4e08eb26f6b077a89b5e8ea6955008c Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 29 Jan 2025 22:52:19 +0100 Subject: [PATCH 03/61] chore: Update breaking change --- ProjectMakoto/ProjectMakoto.sln | 36 +++++++------------ .../Util/Extensions/DiscordExtensions.cs | 3 ++ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/ProjectMakoto/ProjectMakoto.sln b/ProjectMakoto/ProjectMakoto.sln index 3adac39a..0f328f98 100644 --- a/ProjectMakoto/ProjectMakoto.sln +++ b/ProjectMakoto/ProjectMakoto.sln @@ -59,28 +59,28 @@ Global x64|x64 = x64|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Debug|Any CPU.ActiveCfg = Debug|x64 + {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Debug|Any CPU.Build.0 = Debug|x64 {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Debug|x64.ActiveCfg = Debug|x64 {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Debug|x64.Build.0 = Debug|x64 - {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Release|Any CPU.Build.0 = Release|Any CPU + {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Release|Any CPU.ActiveCfg = Release|x64 + {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Release|Any CPU.Build.0 = Release|x64 {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Release|x64.ActiveCfg = Release|x64 {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.Release|x64.Build.0 = Release|x64 - {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.x64|Any CPU.ActiveCfg = x64|Any CPU - {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.x64|Any CPU.Build.0 = x64|Any CPU + {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.x64|Any CPU.ActiveCfg = x64|x64 + {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.x64|Any CPU.Build.0 = x64|x64 {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.x64|x64.ActiveCfg = x64|x64 {A47FCB9F-FEA3-4810-9C77-4CC47DB5BD19}.x64|x64.Build.0 = x64|x64 - {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Debug|Any CPU.ActiveCfg = Debug|x64 + {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Debug|Any CPU.Build.0 = Debug|x64 {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Debug|x64.ActiveCfg = Debug|x64 {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Debug|x64.Build.0 = Debug|x64 - {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Release|Any CPU.Build.0 = Release|Any CPU + {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Release|Any CPU.ActiveCfg = Release|x64 + {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Release|Any CPU.Build.0 = Release|x64 {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Release|x64.ActiveCfg = Release|x64 {906F9C70-17B3-4B6D-AFFF-976338D641C4}.Release|x64.Build.0 = Release|x64 - {906F9C70-17B3-4B6D-AFFF-976338D641C4}.x64|Any CPU.ActiveCfg = x64|Any CPU - {906F9C70-17B3-4B6D-AFFF-976338D641C4}.x64|Any CPU.Build.0 = x64|Any CPU + {906F9C70-17B3-4B6D-AFFF-976338D641C4}.x64|Any CPU.ActiveCfg = x64|x64 + {906F9C70-17B3-4B6D-AFFF-976338D641C4}.x64|Any CPU.Build.0 = x64|x64 {906F9C70-17B3-4B6D-AFFF-976338D641C4}.x64|x64.ActiveCfg = x64|x64 {906F9C70-17B3-4B6D-AFFF-976338D641C4}.x64|x64.Build.0 = x64|x64 {8BD34631-4327-4533-8587-93E38D7A5DD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -215,18 +215,6 @@ Global {40158660-CD40-44A8-8834-077C132B7DDD}.x64|Any CPU.Build.0 = Debug|Any CPU {40158660-CD40-44A8-8834-077C132B7DDD}.x64|x64.ActiveCfg = Debug|Any CPU {40158660-CD40-44A8-8834-077C132B7DDD}.x64|x64.Build.0 = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Debug|x64.ActiveCfg = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Debug|x64.Build.0 = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Release|Any CPU.Build.0 = Release|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Release|x64.ActiveCfg = Release|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.Release|x64.Build.0 = Release|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.x64|Any CPU.ActiveCfg = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.x64|Any CPU.Build.0 = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.x64|x64.ActiveCfg = Debug|Any CPU - {7F04788A-8B14-4C62-A247-3B1F93C01B03}.x64|x64.Build.0 = Debug|Any CPU {0AB29534-3D3E-4482-A98A-8F1C01C4B476}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0AB29534-3D3E-4482-A98A-8F1C01C4B476}.Debug|Any CPU.Build.0 = Debug|Any CPU {0AB29534-3D3E-4482-A98A-8F1C01C4B476}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs index c48c6caf..64414102 100644 --- a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs +++ b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs @@ -15,6 +15,9 @@ public static class DiscordExtensions { private static string? LoadedHtml = null; + public static DiscordMessageBuilder WithEmbed(this DiscordMessageBuilder builder, DiscordEmbed embed) + => builder.AddEmbed(embed); + public static IReadOnlyDictionary GetGuilds(this DiscordShardedClient client) { var Guilds = new Dictionary(); From 055d098d209a0b05a90b0023a0147e716513ce0e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:47:27 +0000 Subject: [PATCH 04/61] chore(deps): update dependencies/discatsharp digest to 88f6d58 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 79808aa3..88f6d58f 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 79808aa32fb13843110c81b4f47e926e714e916b +Subproject commit 88f6d58f7edacd7618ab3420c2cc09e064bcbd82 From d3e8aa676e47476af428cd08adaee6c18bdda444 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:32:57 +0000 Subject: [PATCH 05/61] chore(deps): update dependency genhttp.core to 9.6.2 --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index 040172a4..af15b7ab 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -42,7 +42,7 @@ - + From 89463f8ed6cc1f24178a61beed73134189b9cf47 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 14:01:00 +0000 Subject: [PATCH 06/61] chore(deps): update dependencies/discatsharp digest to 52c69f9 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 88f6d58f..52c69f9e 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 88f6d58f7edacd7618ab3420c2cc09e064bcbd82 +Subproject commit 52c69f9ec836aca9fc4e9406ea9d455e4ac2998e From 5dfc15fa836e96e7af8b024595204a2b5e4762f6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 21:47:35 +0000 Subject: [PATCH 07/61] chore(deps): update dependencies/discatsharp digest to 8703ed1 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 52c69f9e..8703ed13 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 52c69f9ec836aca9fc4e9406ea9d455e4ac2998e +Subproject commit 8703ed13d11b7ce89c76c37178a6ab7e7c372369 From 8c0519048cdbc7a7cc93a69ce8077d29095592ce Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 09:44:40 +0000 Subject: [PATCH 08/61] chore(deps): update dependencies/discatsharp digest to 0178d4b --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 8703ed13..0178d4b0 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 8703ed13d11b7ce89c76c37178a6ab7e7c372369 +Subproject commit 0178d4b003b29f339f189c5e3f50beaf18a989f7 From e9d438a86055e5ee390825675bc47c8c2861e34f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 00:56:03 +0000 Subject: [PATCH 09/61] chore(deps): update dependencies/discatsharp digest to ded64f1 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 0178d4b0..ded64f1a 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 0178d4b003b29f339f189c5e3f50beaf18a989f7 +Subproject commit ded64f1a0993166476ba47476d4175025cb2358e From b9207c02713acf7ae8837fb0aeebb88b51aa30e5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:00:48 +0000 Subject: [PATCH 10/61] chore(deps): update dependencies/discatsharp digest to dd5b346 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index ded64f1a..dd5b346e 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit ded64f1a0993166476ba47476d4175025cb2358e +Subproject commit dd5b346eb28a8362bb1cacace13a2b24ff859594 From 7a9b9fc8e327a0b649f7c8ec7701716e967daf83 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Mon, 10 Feb 2025 19:11:33 +0100 Subject: [PATCH 11/61] Update dev.yml Signed-off-by: Lala Sabathil --- .github/workflows/dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 68beb209..e0fb4d40 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -18,7 +18,7 @@ jobs: with: exclude_path: 'SecretsIgnore.txt' spellcheck: - name: Clone Repository + name: Spell Check runs-on: self-hosted steps: - name: Checkout Actions Repository @@ -68,4 +68,4 @@ jobs: - name: Test Build Makoto Plugins run: sh build_all.sh 1 - working-directory: ProjectMakotoTest/OfficialPlugins/ \ No newline at end of file + working-directory: ProjectMakotoTest/OfficialPlugins/ From a601dd13efaac237fceff9ddf14d0c395b10e69f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:12:25 +0000 Subject: [PATCH 12/61] chore(deps): update dependency genhttp.modules.staticwebsites to 9.6.2 --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index af15b7ab..e5c5e306 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -43,7 +43,7 @@ - + From 5181b4aaa3c3b5f6c875fca1d2eebaa065c2389c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 21:41:23 +0000 Subject: [PATCH 13/61] chore(deps): update dependencies/discatsharp digest to 0b85fab --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index dd5b346e..0b85fabd 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit dd5b346eb28a8362bb1cacace13a2b24ff859594 +Subproject commit 0b85fabdeb37b4e3dc79c3df6ebd3b4a21590697 From 906c539ccab0a4142b59c6ad52daab6969f0ccee Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 04:38:23 +0000 Subject: [PATCH 14/61] chore(deps): update dependencies/discatsharp digest to 7848dd1 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 0b85fabd..7848dd1d 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 0b85fabdeb37b4e3dc79c3df6ebd3b4a21590697 +Subproject commit 7848dd1d8e9b32d1e48ce1d3b0f712e2964f3186 From 1b2fc0f3b94ffa8b98e348cac56725f491ce0798 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Tue, 11 Feb 2025 10:24:29 +0100 Subject: [PATCH 15/61] fix: fix dcs changes --- ProjectMakoto/Commands/DebugCommands.cs | 4 +-- .../Commands/Moderation/CustomEmbedCommand.cs | 10 +++---- ProjectMakoto/Events/EmbedMessagesEvents.cs | 4 +-- .../Util/Extensions/DiscordExtensions.cs | 30 +++++++++---------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ProjectMakoto/Commands/DebugCommands.cs b/ProjectMakoto/Commands/DebugCommands.cs index 8cfe7b2b..9fc56a02 100644 --- a/ProjectMakoto/Commands/DebugCommands.cs +++ b/ProjectMakoto/Commands/DebugCommands.cs @@ -1,4 +1,4 @@ -// Project Makoto +// Project Makoto // Copyright (C) 2024 Fortunevale // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -180,7 +180,7 @@ public sealed partial class DebugCommands : ApplicationCommandsModule } } - [SlashCommand("developertools", "Developer Tools used to manage Makoto.", dmPermission: false, defaultMemberPermissions: (long)Permissions.None)] + [SlashCommand("developertools", "Developer Tools used to manage Makoto.", defaultMemberPermissions: (long)Permissions.None, allowedContexts: [InteractionContextType.Guild])] [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0075:Simplify conditional expression", Justification = "")] public async Task DevTools(InteractionContext ctx, [Autocomplete(typeof(MaintainerAutoComplete))][Option("command", "The command to run.", true)] string command, diff --git a/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs b/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs index 8f9eb92f..213e7b24 100644 --- a/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs +++ b/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs @@ -1,4 +1,4 @@ -// Project Makoto +// Project Makoto // Copyright (C) 2024 Fortunevale // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -225,7 +225,7 @@ internal sealed class CustomEmbedCommand : BaseCommand var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); - GeneratedEmbed.Author.IconUrl = asset.Attachments[0].Url; + GeneratedEmbed.Author.IconUrl = asset.Attachments[0].Url.ToString(); continue; } else if (Menu2.GetCustomId() == SetByUser.CustomId) @@ -320,7 +320,7 @@ internal sealed class CustomEmbedCommand : BaseCommand var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); - GeneratedEmbed.Thumbnail.Url = asset.Attachments[0].Url; + GeneratedEmbed.Thumbnail.Url = asset.Attachments[0].Url.ToString(); continue; } else if (Menu1.GetCustomId() == SetDescription.CustomId) @@ -384,7 +384,7 @@ internal sealed class CustomEmbedCommand : BaseCommand var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); - GeneratedEmbed.ImageUrl = asset.Attachments[0].Url; + GeneratedEmbed.ImageUrl = asset.Attachments[0].Url.ToString(); continue; } else if (Menu1.GetCustomId() == SetColor.CustomId) @@ -499,7 +499,7 @@ internal sealed class CustomEmbedCommand : BaseCommand var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); - GeneratedEmbed.Footer.IconUrl = asset.Attachments[0].Url; + GeneratedEmbed.Footer.IconUrl = asset.Attachments[0].Url.ToString(); continue; } else if (Menu2.GetCustomId() == SetByUser.CustomId) diff --git a/ProjectMakoto/Events/EmbedMessagesEvents.cs b/ProjectMakoto/Events/EmbedMessagesEvents.cs index a273941d..fc8aadc2 100644 --- a/ProjectMakoto/Events/EmbedMessagesEvents.cs +++ b/ProjectMakoto/Events/EmbedMessagesEvents.cs @@ -1,4 +1,4 @@ -// Project Makoto +// Project Makoto // Copyright (C) 2024 Fortunevale // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ internal sealed class EmbedMessagesEvents(Bot bot) : RequiresTranslation(bot) ImageUrl = (message.Attachments?.Count > 0 && (message.Attachments[0].Filename.EndsWith(".png") || message.Attachments[0].Filename.EndsWith(".jpeg") || message.Attachments[0].Filename.EndsWith(".jpg") - || message.Attachments[0].Filename.EndsWith(".gif")) ? message.Attachments[0].Url : ""), + || message.Attachments[0].Filename.EndsWith(".gif")) ? message.Attachments[0].Url.ToString() : ""), Timestamp = message.Timestamp, }).AddComponents(JumpToMessage, Delete)); } diff --git a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs index 64414102..ebf4887e 100644 --- a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs +++ b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs @@ -1,4 +1,4 @@ -// Project Makoto +// Project Makoto // Copyright (C) 2024 Fortunevale // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -159,23 +159,23 @@ public static class DiscordExtensions }))}" + $"{string.Join("", msg.Attachments?.Select(x => { - var tempUrl = x.Url.TruncateAt(true, '?'); + var tempUrl = x.Url.ToString().TruncateAt(true, '?'); var type = string.Empty; var alt = x.Description; - if (x.Url.EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".jpeg", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".webp", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".gifv", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".gif", StringComparison.InvariantCultureIgnoreCase)) + if (x.Url.ToString().EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".jpeg", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".png", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".webp", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".gifv", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".gif", StringComparison.InvariantCultureIgnoreCase)) type = "image"; - else if (x.Url.EndsWith(".webm", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".mp4", StringComparison.InvariantCultureIgnoreCase)) + else if (x.Url.ToString().EndsWith(".webm", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".mp4", StringComparison.InvariantCultureIgnoreCase)) type = "video"; - else if (x.Url.EndsWith(".wav", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".ogg", StringComparison.InvariantCultureIgnoreCase) || - x.Url.EndsWith(".mp3", StringComparison.InvariantCultureIgnoreCase)) + else if (x.Url.ToString().EndsWith(".wav", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".ogg", StringComparison.InvariantCultureIgnoreCase) || + x.Url.ToString().EndsWith(".mp3", StringComparison.InvariantCultureIgnoreCase)) type = "audio"; else { @@ -551,10 +551,10 @@ public static class DiscordExtensions => DigitsToEmotes(i.ToString()); public static string ToTimestamp(this DateTime dateTime, TimestampFormat format = TimestampFormat.RelativeTime) - => Formatter.Timestamp(dateTime, format); + => dateTime.Timestamp(format); public static string ToTimestamp(this DateTimeOffset dateTime, TimestampFormat format = TimestampFormat.RelativeTime) - => Formatter.Timestamp(dateTime, format); + => dateTime.Timestamp(format); public static string GetCommandMention(this DiscordClient client, Bot bot, string command) => (bot.status.LoadedConfig.IsDev ? From 293ccd8c52b497262046864c3ece3e590c4f739c Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Tue, 11 Feb 2025 10:28:19 +0100 Subject: [PATCH 16/61] Update DiscordExtensions.cs --- ProjectMakoto/Util/Extensions/DiscordExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs index ebf4887e..62d7ad01 100644 --- a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs +++ b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs @@ -185,7 +185,7 @@ public static class DiscordExtensions return $""; From 11dd71537df39c8b1f98393c388465b766e57104 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Tue, 11 Feb 2025 10:39:42 +0100 Subject: [PATCH 17/61] fix issues --- OfficialPlugins/Music | 2 +- OfficialPlugins/ScoreSaber | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OfficialPlugins/Music b/OfficialPlugins/Music index 79e7cffb..5ca2978d 160000 --- a/OfficialPlugins/Music +++ b/OfficialPlugins/Music @@ -1 +1 @@ -Subproject commit 79e7cffb4e38d68d2af71d321d8698fd799b3e59 +Subproject commit 5ca2978d0b99f5f52eaa41b9822b908bf35e268f diff --git a/OfficialPlugins/ScoreSaber b/OfficialPlugins/ScoreSaber index b0318f56..26d7d34d 160000 --- a/OfficialPlugins/ScoreSaber +++ b/OfficialPlugins/ScoreSaber @@ -1 +1 @@ -Subproject commit b0318f5602b29482638a71dae7184b075bc58b5a +Subproject commit 26d7d34d752cbfdd618fff9311e636bb6e2a4931 From cc22de02c9d8523c4629b65c28d72c6cc90508cd Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Tue, 11 Feb 2025 10:47:38 +0100 Subject: [PATCH 18/61] fix compiler --- ProjectMakoto/Util/Initializers/CommandCompiler.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ProjectMakoto/Util/Initializers/CommandCompiler.cs b/ProjectMakoto/Util/Initializers/CommandCompiler.cs index aef1de19..0ed1f279 100644 --- a/ProjectMakoto/Util/Initializers/CommandCompiler.cs +++ b/ProjectMakoto/Util/Initializers/CommandCompiler.cs @@ -137,11 +137,11 @@ internal static class CommandCompiler case MakotoCommandType.SlashCommand: if (command.IsGroup) return $$""" - [{{typeof(SlashCommandGroupAttribute).FullName}}("{{command.Name}}", "{{command.Description}}"{{(command.RequiredPermissions is null ? "" : $", {(long)command.RequiredPermissions}")}}, dmPermission: {{command.AllowPrivateUsage.ToString().ToLower()}}, isNsfw: {{command.IsNsfw.ToString().ToLower()}})] + [{{typeof(SlashCommandGroupAttribute).FullName}}("{{command.Name}}", "{{command.Description}}"{{(command.RequiredPermissions is null ? "" : $", {(long)command.RequiredPermissions}")}}, {{(command.AllowPrivateUsage ? string.Empty : "allowedContexts: [InteractionContextType.Guild]")}}, isNsfw: {{command.IsNsfw.ToString().ToLower()}})] """; else return $$""" - [{{typeof(SlashCommandAttribute).FullName}}("{{command.Name}}", "{{command.Description}}"{{(command.RequiredPermissions is null ? "" : $", {(long)command.RequiredPermissions}")}}, dmPermission: {{command.AllowPrivateUsage.ToString().ToLower()}}, isNsfw: {{command.IsNsfw.ToString().ToLower()}})] + [{{typeof(SlashCommandAttribute).FullName}}("{{command.Name}}", "{{command.Description}}"{{(command.RequiredPermissions is null ? "" : $", {(long)command.RequiredPermissions}")}}, {{(command.AllowPrivateUsage ? string.Empty : "allowedContexts: [InteractionContextType.Guild]")}}, isNsfw: {{command.IsNsfw.ToString().ToLower()}})] """; case MakotoCommandType.PrefixCommand: if (command.IsGroup) @@ -156,7 +156,7 @@ internal static class CommandCompiler """; case MakotoCommandType.ContextMenu: return $$""" - [{{typeof(ContextMenuAttribute).FullName}}({{typeof(ApplicationCommandType).FullName}}.{{Enum.GetName(typeof(ApplicationCommandType), command.ContextMenuType)}}, "{{command.Name}}", dmPermission: {{command.AllowPrivateUsage.ToString().ToLower()}}, isNsfw: {{command.IsNsfw.ToString().ToLower()}})] + [{{typeof(ContextMenuAttribute).FullName}}({{typeof(ApplicationCommandType).FullName}}.{{Enum.GetName(typeof(ApplicationCommandType), command.ContextMenuType)}}, "{{command.Name}}", {{(command.AllowPrivateUsage ? string.Empty : "allowedContexts: [InteractionContextType.Guild]")}}, isNsfw: {{command.IsNsfw.ToString().ToLower()}})] """; default: From 6da3e2055b3517df21a1fc1cb177718dacdf34db Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:04:15 +0000 Subject: [PATCH 19/61] chore(deps): update dependencies/discatsharp digest to bfd01f5 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 7848dd1d..bfd01f51 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 7848dd1d8e9b32d1e48ce1d3b0f712e2964f3186 +Subproject commit bfd01f511dc5670c400bafc32b7e4b8067dfd02a From a9f7244b177fd5c8dedffedddb81264a3c76b1ae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:37:13 +0000 Subject: [PATCH 20/61] chore(deps): update dependencies/discatsharp digest to 57a7820 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index bfd01f51..57a7820d 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit bfd01f511dc5670c400bafc32b7e4b8067dfd02a +Subproject commit 57a7820d0d6cdbf85f94000419b03d8d87ca4ef9 From 1035eeb1cf1a37ff332e117f587825cb24a0016e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 23:31:56 +0100 Subject: [PATCH 21/61] chore(deps): update dependency system.drawing.common to 9.0.2 (#536) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index e5c5e306..6ae7ba2a 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -59,7 +59,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 805bba780e2bba1945915f2b38206d2f547a9cb2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 23:33:15 +0100 Subject: [PATCH 22/61] chore(deps): update dependency system.text.json to 9.0.2 (#537) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index 6ae7ba2a..a493a46d 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -60,7 +60,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + From b440e3fa6091b809c9db6eeda844d9d2b31797b6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 23:33:58 +0100 Subject: [PATCH 23/61] chore(deps): update dependencies/discatsharp digest to 613b8ab (#535) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 57a7820d..613b8ab8 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 57a7820d0d6cdbf85f94000419b03d8d87ca4ef9 +Subproject commit 613b8ab8e18353918dcb9dfebcf9c0d6874812fb From 21d4be42390aef9b4a89cf83e52effd7726ecf10 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2025 10:30:25 +0000 Subject: [PATCH 24/61] chore(deps): update dependencies/discatsharp digest to 9ae63bd --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 613b8ab8..9ae63bd7 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 613b8ab8e18353918dcb9dfebcf9c0d6874812fb +Subproject commit 9ae63bd70aed1ac618e695fbc76c32296b6e53ce From 078d7984b826cea699dfc94a4f554f20dc4d2e54 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:23:59 +0000 Subject: [PATCH 25/61] chore(deps): update dependencies/discatsharp digest to 5ace61e --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 9ae63bd7..5ace61e6 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 9ae63bd70aed1ac618e695fbc76c32296b6e53ce +Subproject commit 5ace61e68d2c61346d1f2cee9e50104a4b0ad09a From b44a6dbacce65fbbbab1b1be49b0f2a7e2395639 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 18:11:22 +0000 Subject: [PATCH 26/61] chore(deps): update ncipollo/release-action action to v1.16.0 --- .github/workflows/main.yml | 2 +- .github/workflows/preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99f8f981..425e9d53 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: - name: Create Release if: ${{ !github.event.act }} # skip during local actions testing - uses: ncipollo/release-action@v1.14.0 + uses: ncipollo/release-action@v1.16.0 with: artifacts: "ProjectMakoto/ProjectMakoto/Release.zip" generateReleaseNotes: true diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 175be6a7..e25c942b 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -135,7 +135,7 @@ jobs: - name: Create Release if: ${{ !github.event.act }} # skip during local actions testing - uses: ncipollo/release-action@v1.14.0 + uses: ncipollo/release-action@v1.16.0 with: artifacts: "ProjectMakotoPreview/ProjectMakoto/Release.zip" generateReleaseNotes: true From 77bcd25224f96558c00a29891ae0296dada64e62 Mon Sep 17 00:00:00 2001 From: Mira Date: Sun, 23 Feb 2025 04:23:37 +0100 Subject: [PATCH 27/61] Revert "chore(deps): update ncipollo/release-action action to v1.16.0" (#542) --- .github/workflows/main.yml | 2 +- .github/workflows/preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 425e9d53..99f8f981 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: - name: Create Release if: ${{ !github.event.act }} # skip during local actions testing - uses: ncipollo/release-action@v1.16.0 + uses: ncipollo/release-action@v1.14.0 with: artifacts: "ProjectMakoto/ProjectMakoto/Release.zip" generateReleaseNotes: true diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index e25c942b..175be6a7 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -135,7 +135,7 @@ jobs: - name: Create Release if: ${{ !github.event.act }} # skip during local actions testing - uses: ncipollo/release-action@v1.16.0 + uses: ncipollo/release-action@v1.14.0 with: artifacts: "ProjectMakotoPreview/ProjectMakoto/Release.zip" generateReleaseNotes: true From 772d8715a56dc39158e86037039d53d647b1588c Mon Sep 17 00:00:00 2001 From: Mira Date: Sun, 23 Feb 2025 04:25:53 +0100 Subject: [PATCH 28/61] Update renovate.json Signed-off-by: Mira --- renovate.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/renovate.json b/renovate.json index 6c349b29..58258968 100644 --- a/renovate.json +++ b/renovate.json @@ -12,6 +12,10 @@ "matchPackagePrefixes": [ "DisCatSharp" ], "groupName": "discatsharp", "automerge": true + }, + { + "managers": ["github-actions"], + "enabled": false } ], "git-submodules": { From 025bea99657757179b6988233a847d203eae0147 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 23 Feb 2025 04:28:42 +0100 Subject: [PATCH 29/61] chore(config): migrate renovate config (#543) chore(config): migrate config renovate.json Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- renovate.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/renovate.json b/renovate.json index 6c349b29..f3eb8e63 100644 --- a/renovate.json +++ b/renovate.json @@ -1,17 +1,21 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "config:base" + "config:recommended" + ], + "baseBranches": [ + "dev" ], - "baseBranches": ["dev"], "prHourlyLimit": 9, "bumpVersion": "prerelease", "packageRules": [ { - "excludePackagePatterns": [ "Extensions" ], - "matchPackagePrefixes": [ "DisCatSharp" ], "groupName": "discatsharp", - "automerge": true + "automerge": true, + "matchPackageNames": [ + "!/Extensions/", + "DisCatSharp{/,}**" + ] } ], "git-submodules": { From 6768421feece6f8a47c41bfc5e358477dd647130 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 23 Feb 2025 22:57:06 +0000 Subject: [PATCH 30/61] chore(deps): update dependencies/discatsharp digest to 584452e --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 5ace61e6..584452e8 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 5ace61e68d2c61346d1f2cee9e50104a4b0ad09a +Subproject commit 584452e88d14f5f4264a318fdd7ddcc90e5aeae6 From e04ecc09ebfd0f8af3b2734ba28050f43f7b866b Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Mon, 24 Feb 2025 01:10:05 +0100 Subject: [PATCH 31/61] fix: use role.type --- ProjectMakoto/Events/ActionlogEvents.cs | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ProjectMakoto/Events/ActionlogEvents.cs b/ProjectMakoto/Events/ActionlogEvents.cs index 62f7c087..28f42e67 100644 --- a/ProjectMakoto/Events/ActionlogEvents.cs +++ b/ProjectMakoto/Events/ActionlogEvents.cs @@ -1,4 +1,4 @@ -// Project Makoto +// Project Makoto // Copyright (C) 2024 Fortunevale // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -513,12 +513,12 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (e.Role.IsManaged) { - if (e.Role.Tags?.PremiumSubscriber ?? false) + if (e.Role.Type is RoleType.Booster) Integration = $"**{this.tKey.Integration.Get(this.Bot.Guilds[e.Guild.Id])}**: `{this.tKey.ServerBooster.Get(this.Bot.Guilds[e.Guild.Id])}`\n\n"; - - if (e.Role.Tags?.BotId is not null and not 0) - { - var bot = await sender.GetUserAsync((ulong)e.Role.Tags.BotId); + + if (e.Role.Type is RoleType.Bot) + { + var bot = await sender.GetUserAsync(e.Role.Tags!.BotId.Value); Integration = $"**{this.tKey.Integration.Get(this.Bot.Guilds[e.Guild.Id])}**: {bot.Mention} `{bot.GetUsernameWithIdentifier()}`\n\n"; } @@ -573,12 +573,12 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (e.Role.IsManaged) { - if (e.Role.Tags?.PremiumSubscriber ?? false) + if (e.Role.Type is RoleType.Booster) Integration = $"**{this.tKey.Integration.Get(this.Bot.Guilds[e.Guild.Id])}**: `{this.tKey.ServerBooster.Get(this.Bot.Guilds[e.Guild.Id])}`\n\n"; - if (e.Role.Tags.BotId is not null and not 0) + if (e.Role.Type is RoleType.Bot) { - var bot = await sender.GetUserAsync((ulong)e.Role.Tags.BotId); + var bot = await sender.GetUserAsync(e.Role.Tags!.BotId.Value); Integration = $"**{this.tKey.Integration.Get(this.Bot.Guilds[e.Guild.Id])}**: {bot.Mention} `{bot.GetUsernameWithIdentifier()}`\n\n"; } @@ -671,12 +671,12 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (e.RoleAfter.IsManaged) { - if (e.RoleAfter.Tags?.PremiumSubscriber ?? false) + if (e.RoleAfter.Type is RoleType.Booster) Integration = $"**{this.tKey.Integration.Get(this.Bot.Guilds[e.Guild.Id])}**: `{this.tKey.ServerBooster.Get(this.Bot.Guilds[e.Guild.Id])}`\n\n"; - - if (e.RoleAfter.Tags?.BotId is not null and not 0) - { - var bot = await sender.GetUserAsync((ulong)e.RoleAfter.Tags.BotId); + + if (e.RoleAfter.Type is RoleType.Bot) + { + var bot = await sender.GetUserAsync(e.RoleAfter.Tags!.BotId.Value); Integration = $"**{this.tKey.Integration.Get(this.Bot.Guilds[e.Guild.Id])}**: {bot.Mention} `{bot.GetUsernameWithIdentifier()}`\n\n"; } From 92cd485f9c6a5c2a5dc3fc6c91e9e263a051c76e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 22:10:24 +0000 Subject: [PATCH 32/61] chore(deps): update dependencies/discatsharp digest to e95f028 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 584452e8..e95f028b 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 584452e88d14f5f4264a318fdd7ddcc90e5aeae6 +Subproject commit e95f028bb403c0c6864c2c7080f99120682ff4c1 From 8b03d88106c603ba599f1fc804658579da784206 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 22:10:28 +0000 Subject: [PATCH 33/61] chore(deps): update dotnet monorepo to 4.13.0 --- ProjectMakoto/ProjectMakoto.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index a493a46d..f1ddb4f0 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -45,8 +45,8 @@ - - + + From ca9b970829c8db6043ef5bdaeaff5abbb044031b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 07:00:30 +0000 Subject: [PATCH 34/61] chore(deps): update dependencies/discatsharp digest to eb409de --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index e95f028b..eb409de7 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit e95f028bb403c0c6864c2c7080f99120682ff4c1 +Subproject commit eb409de7c3f639c4e765687a04051a0eb61442d5 From c9c220a8ea1dac7f79c57013b194aef601578d7a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 18:20:02 +0000 Subject: [PATCH 35/61] chore(deps): update dependency genhttp.core to 9.7.0 --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index f1ddb4f0..1fe47567 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -42,7 +42,7 @@ - + From c800526ca8a5c00382476451a5b52ec95b05f707 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 21:51:23 +0000 Subject: [PATCH 36/61] chore(deps): update dependencies/discatsharp digest to 883ab23 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index eb409de7..883ab232 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit eb409de7c3f639c4e765687a04051a0eb61442d5 +Subproject commit 883ab23230a0cea50b39afadae10450f28f1a5b0 From 9857a77dd46fbeb065c11ea68ad4f7333d898484 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 2 Mar 2025 14:15:13 +0000 Subject: [PATCH 37/61] chore(deps): update dependencies/discatsharp digest to 25608db --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 883ab232..25608db8 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 883ab23230a0cea50b39afadae10450f28f1a5b0 +Subproject commit 25608db87532e975f246c64aa7e39c1bf85b699b From c393de1082fd0ba461dbb0df29271df57101f868 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 16:37:37 +0000 Subject: [PATCH 38/61] chore(deps): update dependencies/discatsharp digest to f8ac274 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 25608db8..f8ac274b 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 25608db87532e975f246c64aa7e39c1bf85b699b +Subproject commit f8ac274bd53d01480ce5f48d08f2f6226bb2130b From ae09d35b0e0143d5784fcf63fa99b702d68f8c09 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 23:32:08 +0000 Subject: [PATCH 39/61] chore(deps): update dependencies/discatsharp digest to 9729aca --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index f8ac274b..9729aca2 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit f8ac274bd53d01480ce5f48d08f2f6226bb2130b +Subproject commit 9729aca250ceb1c20353af1156de3f8477a54bdc From c8a21b0b70baa7c933af6dd5134aadc041601bb3 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Tue, 4 Mar 2025 00:51:38 +0100 Subject: [PATCH 40/61] Update dev.yml Signed-off-by: Lala Sabathil --- .github/workflows/dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index e0fb4d40..11c72113 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -39,6 +39,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | + 10.0.100-preview.1.25120.13 9.x - name: "Clone Repository" From 389c32a238746406bab8230719982fbad285a180 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 23:56:23 +0000 Subject: [PATCH 41/61] chore(deps): update dependency genhttp.modules.staticwebsites to 9.7.0 --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index 1fe47567..e349a570 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -43,7 +43,7 @@ - + From 3093c2ae296f71bb99a92016b3ff7cce5994a477 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 03:17:10 +0000 Subject: [PATCH 42/61] chore(deps): update dependencies/discatsharp digest to 2a0fcc4 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 9729aca2..2a0fcc46 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 9729aca250ceb1c20353af1156de3f8477a54bdc +Subproject commit 2a0fcc46184add6bb1a6a7bbe9368141e49fab19 From 6766a6b51e69e16c126f7c69ac07ea15d8e742c6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:44:55 +0000 Subject: [PATCH 43/61] chore(deps): update dependency ffmpegcore to 5.2.0 --- ProjectMakoto/ProjectMakoto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index e349a570..3db69b20 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -41,7 +41,7 @@ - + From 768c11b42494eea6c1602c7dfac34dcab5f8e352 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 22:18:13 +0000 Subject: [PATCH 44/61] chore(deps): update dependencies/discatsharp digest to 20adeb0 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 2a0fcc46..20adeb0f 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 2a0fcc46184add6bb1a6a7bbe9368141e49fab19 +Subproject commit 20adeb0f0e33347ec15b4d2b8b869e2b3d1e73f9 From eadcd7ee8578fb95064d38048036428cf32af541 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 17:33:22 +0000 Subject: [PATCH 45/61] chore(deps): update dotnet monorepo to 9.0.3 --- ProjectMakoto/ProjectMakoto.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index 3db69b20..2abc5844 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -59,8 +59,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + From d22aecdf79f3e436ccdb884bfa300ba6c9c32d38 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 02:44:39 +0000 Subject: [PATCH 46/61] chore(deps): update dependencies/discatsharp digest to ab69b24 --- Dependencies/DisCatSharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index 20adeb0f..ab69b24d 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit 20adeb0f0e33347ec15b4d2b8b869e2b3d1e73f9 +Subproject commit ab69b24d1a29ea5c9c1243b243281fb7365e19e9 From e58aca5af7cbd08e35b2f9dcc544e6e72a524b12 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Tue, 1 Apr 2025 17:37:56 +0200 Subject: [PATCH 47/61] fix: fix missing CompiledCommands check --- ProjectMakoto/Util/Initializers/DisCatSharpExtensionsLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/Util/Initializers/DisCatSharpExtensionsLoader.cs b/ProjectMakoto/Util/Initializers/DisCatSharpExtensionsLoader.cs index 9b65b1cf..304e71c3 100644 --- a/ProjectMakoto/Util/Initializers/DisCatSharpExtensionsLoader.cs +++ b/ProjectMakoto/Util/Initializers/DisCatSharpExtensionsLoader.cs @@ -260,7 +260,7 @@ internal static class DisCatSharpExtensionsLoader DebugStartup = true }); - if (bot.status.CurrentAppHash != bot.status.LoadedConfig.DontModify.LastKnownHash) + if (bot.status.CurrentAppHash != bot.status.LoadedConfig.DontModify.LastKnownHash && Directory.Exists("CompiledCommands")) { Log.Debug("Clearing cached Commands.."); await FileExtensions.CleanupFilesAndDirectories(new(), Directory.GetFiles("CompiledCommands").ToList()); From 4705cb5f26fac4a607ca90546525b321f52a293d Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Tue, 1 Apr 2025 17:39:14 +0200 Subject: [PATCH 48/61] chore: Update deps --- Dependencies/DisCatSharp | 2 +- Dependencies/quickchart-csharp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index ab69b24d..ff567821 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit ab69b24d1a29ea5c9c1243b243281fb7365e19e9 +Subproject commit ff567821ed3e10c6918bf8a65bf8372af7e677dc diff --git a/Dependencies/quickchart-csharp b/Dependencies/quickchart-csharp index 0b60f2e3..92a231e7 160000 --- a/Dependencies/quickchart-csharp +++ b/Dependencies/quickchart-csharp @@ -1 +1 @@ -Subproject commit 0b60f2e32db9d79dcc45311ee77b38b7a32ef776 +Subproject commit 92a231e7c7a0baa38b09d56bcc4c66c8b2d50cf6 From 2e73d66dc2e5d1e70540bd54999ef4631e996628 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Mon, 7 Apr 2025 21:36:42 +0200 Subject: [PATCH 49/61] refactor: Downgrade to stable & use AddEmbed over WithEmbed --- Dependencies/DisCatSharp | 2 +- OfficialPlugins/Music | 2 +- OfficialPlugins/ScoreSaber | 2 +- OfficialPlugins/Social | 2 +- OfficialPlugins/Translations | 2 +- OfficialPlugins/update_deps.cmd | 2 +- ProjectMakoto/Commands/BaseCommand.cs | 50 ++++++------ .../Configuration/ActionLogCommand.cs | 4 +- .../Configuration/AutoCrosspostCommand.cs | 8 +- .../Configuration/AutoUnarchiveCommand.cs | 2 +- .../Configuration/BumpReminderCommand.cs | 2 +- .../Configuration/EmbedMessageCommand.cs | 2 +- .../Configuration/ExperienceCommand.cs | 2 +- .../Configuration/InVoicePrivacyCommand.cs | 2 +- .../Configuration/InviteNotesCommand.cs | 6 +- .../Configuration/InviteTrackerCommand.cs | 2 +- .../Commands/Configuration/JoinCommand.cs | 2 +- .../Configuration/LevelRewardsCommand.cs | 10 +-- .../Configuration/NameNormalizerCommand.cs | 8 +- .../Commands/Configuration/PhishingCommand.cs | 6 +- .../Commands/Configuration/PrefixCommand.cs | 2 +- .../ReactionRolesCommand/AddCommand.cs | 16 ++-- .../ReactionRolesCommand/ConfigCommand.cs | 34 ++++----- .../ReactionRolesCommand/RemoveAllCommand.cs | 4 +- .../ReactionRolesCommand/RemoveCommand.cs | 6 +- .../Configuration/TokenDetectionCommand.cs | 2 +- .../Configuration/VcCreatorCommand.cs | 2 +- .../Maintainers/DevTools/EvaluationCommand.cs | 2 +- .../DevTools/GlobalNotesCommand.cs | 2 +- .../Commands/Moderation/CustomEmbedCommand.cs | 6 +- .../Commands/Moderation/GuildPurgeCommand.cs | 10 +-- .../Commands/Moderation/ManualBumpCommand.cs | 2 +- .../Commands/Utility/AvatarCommand.cs | 6 +- .../Commands/Utility/BannerCommand.cs | 2 +- .../Commands/Utility/Data/DeleteCommand.cs | 8 +- .../Commands/Utility/Data/RequestCommand.cs | 4 +- .../Commands/Utility/EmojiStealerCommand.cs | 12 +-- .../Commands/Utility/GuildInfoCommand.cs | 10 +-- ProjectMakoto/Commands/Utility/HelpCommand.cs | 2 +- .../Commands/Utility/RemindersCommand.cs | 4 +- .../Commands/Utility/ReportHostCommand.cs | 6 +- .../Utility/ReportTranslationCommand.cs | 2 +- .../Utility/UrbanDictionaryCommand.cs | 2 +- .../Commands/Utility/UserInfoCommand.cs | 2 +- ProjectMakoto/Entities/Status.cs | 8 ++ .../Users/Reminders/ReminderSettings.cs | 2 +- ProjectMakoto/Events/ActionlogEvents.cs | 76 +++++++++---------- ProjectMakoto/Events/EmbedMessagesEvents.cs | 2 +- .../Events/PhishingProtectionEvents.cs | 2 +- ProjectMakoto/Events/TokenLeakEvents.cs | 2 +- ProjectMakoto/Events/VcCreatorEvents.cs | 2 +- ProjectMakoto/Util/ExperienceHandler.cs | 6 +- .../Util/Extensions/DiscordExtensions.cs | 3 - 53 files changed, 190 insertions(+), 179 deletions(-) diff --git a/Dependencies/DisCatSharp b/Dependencies/DisCatSharp index ff567821..5f4f5c46 160000 --- a/Dependencies/DisCatSharp +++ b/Dependencies/DisCatSharp @@ -1 +1 @@ -Subproject commit ff567821ed3e10c6918bf8a65bf8372af7e677dc +Subproject commit 5f4f5c46f808fd2199a6cc8b6b9dabaa646b5d86 diff --git a/OfficialPlugins/Music b/OfficialPlugins/Music index 5ca2978d..2ca985d2 160000 --- a/OfficialPlugins/Music +++ b/OfficialPlugins/Music @@ -1 +1 @@ -Subproject commit 5ca2978d0b99f5f52eaa41b9822b908bf35e268f +Subproject commit 2ca985d24861f56feccc901357283dacc72182bf diff --git a/OfficialPlugins/ScoreSaber b/OfficialPlugins/ScoreSaber index 26d7d34d..f2b6f1aa 160000 --- a/OfficialPlugins/ScoreSaber +++ b/OfficialPlugins/ScoreSaber @@ -1 +1 @@ -Subproject commit 26d7d34d752cbfdd618fff9311e636bb6e2a4931 +Subproject commit f2b6f1aaa49060e0592986d93ef45694dc157f4f diff --git a/OfficialPlugins/Social b/OfficialPlugins/Social index 4e795fdd..3bb0c0e1 160000 --- a/OfficialPlugins/Social +++ b/OfficialPlugins/Social @@ -1 +1 @@ -Subproject commit 4e795fddc75a59f2512243f59c02de3d0823cdd2 +Subproject commit 3bb0c0e17764905e8931346e7a5a3526a0441b7c diff --git a/OfficialPlugins/Translations b/OfficialPlugins/Translations index ea04fd27..0e28d28f 160000 --- a/OfficialPlugins/Translations +++ b/OfficialPlugins/Translations @@ -1 +1 @@ -Subproject commit ea04fd278535c33a3b78d056adf6c25a5cb687bc +Subproject commit 0e28d28f051edb2e7cfb9699d2d12f3dd49fac78 diff --git a/OfficialPlugins/update_deps.cmd b/OfficialPlugins/update_deps.cmd index 515bfcdb..adcf39ed 100644 --- a/OfficialPlugins/update_deps.cmd +++ b/OfficialPlugins/update_deps.cmd @@ -13,7 +13,7 @@ for /d /r %%i in (*deps*) do ( cd /d "%original_dir%" -git submodule update --init --depth 0 +REM git submodule update --init --depth 0 for /D %%i in (*) do ( if /I "%%i" neq "deps" ( diff --git a/ProjectMakoto/Commands/BaseCommand.cs b/ProjectMakoto/Commands/BaseCommand.cs index 285ad09b..12be9145 100644 --- a/ProjectMakoto/Commands/BaseCommand.cs +++ b/ProjectMakoto/Commands/BaseCommand.cs @@ -253,10 +253,10 @@ public abstract class BaseCommand #region RespondOrEdit public Task RespondOrEdit(DiscordEmbed embed) - => this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + => this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); public Task RespondOrEdit(DiscordEmbedBuilder embed) - => this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.Build())); + => this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.Build())); public Task RespondOrEdit(string content) => this.RespondOrEdit(new DiscordMessageBuilder().WithContent(content)); @@ -274,7 +274,9 @@ public abstract class BaseCommand foreach (var b in discordMessageBuilder.Files) files.Add(b.Filename, b.Stream); - _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); + if (discordMessageBuilder.Components.IsNotNullAndNotEmpty()) + _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); + _ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds); _ = discordWebhookBuilder.AddFiles(files); discordWebhookBuilder.Content = discordMessageBuilder.Content; @@ -293,7 +295,9 @@ public abstract class BaseCommand foreach (var b in discordMessageBuilder.Files) files.Add(b.Filename, b.Stream); - _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); + if (discordMessageBuilder.Components.IsNotNullAndNotEmpty()) + _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); + _ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds); _ = discordWebhookBuilder.AddFiles(files); discordWebhookBuilder.Content = discordMessageBuilder.Content; @@ -312,7 +316,9 @@ public abstract class BaseCommand foreach (var b in discordMessageBuilder.Files) files.Add(b.Filename, b.Stream); - _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); + if (discordMessageBuilder.Components.IsNotNullAndNotEmpty()) + _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); + _ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds); _ = discordWebhookBuilder.AddFiles(files); discordWebhookBuilder.Content = discordMessageBuilder.Content; @@ -437,7 +443,7 @@ public abstract class BaseCommand async Task RefreshMessage() { var dropdown = new DiscordRoleSelectComponent(this.GetString(this.t.Commands.Common.Prompts.SelectARole), SelectionInteractionId, 1, 1, false); - var builder = new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).AsAwaitingInput(this.ctx)).AddComponents(dropdown).WithContent(this.ctx.ResponseMessage.Content); + var builder = new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).AsAwaitingInput(this.ctx)).AddComponents(dropdown).WithContent(this.ctx.ResponseMessage.Content); if (Selected.IsNullOrWhiteSpace()) _ = ConfirmSelectionButton.Disable(); @@ -541,7 +547,7 @@ public abstract class BaseCommand this.ctx.Client.ComponentInteractionCreated -= RunInteraction; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(this.ctx.ResponseMessage.Embeds[0]).WithContent(this.ctx.ResponseMessage.Content)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(this.ctx.ResponseMessage.Embeds[0]).WithContent(this.ctx.ResponseMessage.Content)); if (ExceptionOccurred) return new InteractionResult(ThrownException); @@ -578,7 +584,7 @@ public abstract class BaseCommand async Task RefreshMessage() { var dropdown = new DiscordChannelSelectComponent(this.GetString(this.t.Commands.Common.Prompts.SelectAChannel), channelTypes, SelectionInteractionId); - var builder = new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).AsAwaitingInput(this.ctx)).AddComponents(dropdown).WithContent(this.ctx.ResponseMessage.Content); + var builder = new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).AsAwaitingInput(this.ctx)).AddComponents(dropdown).WithContent(this.ctx.ResponseMessage.Content); if (Selected.IsNullOrWhiteSpace()) _ = ConfirmSelectionButton.Disable(); @@ -662,7 +668,7 @@ public abstract class BaseCommand } this.ctx.Client.ComponentInteractionCreated -= RunInteraction; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(this.ctx.ResponseMessage.Embeds[0]).WithContent(this.ctx.ResponseMessage.Content)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(this.ctx.ResponseMessage.Embeds[0]).WithContent(this.ctx.ResponseMessage.Content)); if (ExceptionOccurred) return new InteractionResult(ThrownException); @@ -707,7 +713,7 @@ public abstract class BaseCommand async Task RefreshMessage() { var dropdown = new DiscordStringSelectComponent(CustomPlaceHolder, options.Skip(CurrentPage * 25).Take(25).Select(x => new DiscordStringSelectComponentOption(x.Label, x.Value, x.Description, (x.Value == Selected), x.Emoji)), SelectionInteractionId); - var builder = new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).AsAwaitingInput(this.ctx)).AddComponents(dropdown).WithContent(this.ctx.ResponseMessage.Content); + var builder = new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).AsAwaitingInput(this.ctx)).AddComponents(dropdown).WithContent(this.ctx.ResponseMessage.Content); _ = NextPageButton.SetState(options.Skip(CurrentPage * 25).Count() <= 25); _ = PrevPageButton.SetState(CurrentPage == 0); @@ -784,7 +790,7 @@ public abstract class BaseCommand this.ctx.Client.ComponentInteractionCreated -= RunInteraction; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(this.ctx.ResponseMessage.Embeds[0]).WithContent(this.ctx.ResponseMessage.Content)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(this.ctx.ResponseMessage.Embeds[0]).WithContent(this.ctx.ResponseMessage.Content)); if (ExceptionOccurred) return new InteractionResult(ThrownException); @@ -807,7 +813,7 @@ public abstract class BaseCommand var ReOpen = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(this.t.Commands.Common.Prompts.ReOpenModal), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔄"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(customEmbed ?? new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(customEmbed ?? new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Common.Prompts.WaitingForModalResponse, true) }.AsAwaitingInput(this.ctx)).AddComponents(new List { ReOpen, MessageComponents.GetCancelButton(this.ctx.DbUser, this.ctx.Bot) })); @@ -872,7 +878,7 @@ public abstract class BaseCommand this.ctx.Client.ComponentInteractionCreated -= RunInteraction; if (ResetToOriginalEmbed) - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(oriEmbed)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(oriEmbed)); if (ExceptionOccurred) return new InteractionResult(ThrownException); @@ -1445,7 +1451,7 @@ public abstract class BaseCommand { if (this.ctx.DbUser.PendingUserUpload.TimeOut.GetTotalSecondsUntil() > 0 && !this.ctx.DbUser.PendingUserUpload.InteractionHandled) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = $"`An upload interaction is already taking place. Please finish it beforehand.`", }.AsError(this.ctx))); @@ -1479,7 +1485,7 @@ public abstract class BaseCommand #region FinishInteraction public void ModifyToTimedOut(bool Delete = false) { - _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).WithFooter(this.ctx.ResponseMessage.Embeds[0]?.Footer?.Text + $" • {this.GetString(this.t.Commands.Common.InteractionTimeout)}").WithColor(DiscordColor.Gray))); + _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder(this.ctx.ResponseMessage.Embeds[0]).WithFooter(this.ctx.ResponseMessage.Embeds[0]?.Footer?.Text + $" • {this.GetString(this.t.Commands.Common.InteractionTimeout)}").WithColor(DiscordColor.Gray))); if (Delete) _ = Task.Delay(5000).ContinueWith(_ => @@ -1635,19 +1641,19 @@ public abstract class BaseCommand }.AsError(this.ctx)); public void SendVoiceStateError() - => _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + => _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Common.Errors.VoiceChannel).Build(true), }.AsError(this.ctx))); public void SendUserBanError(BanDetails entry) - => _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + => _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.t.Commands.Common.Errors.UserBan.t["en"].Build(true, new TVar("Reason", entry.Reason)), }.AsError(this.ctx))); public void SendGuildBanError(BanDetails entry) - => _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + => _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Common.Errors.GuildBan, true, new TVar("Reason", entry.Reason)), }.AsError(this.ctx))); @@ -1667,20 +1673,20 @@ public abstract class BaseCommand }; public void SendDataError() - => _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + => _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Common.Errors.Data, true, new TVar("Command", $"{this.ctx.Prefix}data delete")), }.AsError(this.ctx))); public void SendDmError() - => _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + => _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = $"📩 {this.GetString(this.t.Commands.Common.Errors.DirectMessage, true)}", ImageUrl = (this.ctx.User.Presence.ClientStatus.Mobile.HasValue ? "https://cdn.discordapp.com/attachments/1005430437952356423/1144961395515998238/34rhz83ghtzu3ght.gif" : "https://cdn.discordapp.com/attachments/1005430437952356423/1144964670197862400/et2grtzu2ghrzi52.gif") }.AsError(this.ctx))); public void SendDmRedirect() - => _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + => _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = $"📩 {this.GetString(this.t.Commands.Common.DirectMessageRedirect, true)}", }.AsSuccess(this.ctx))); @@ -1708,7 +1714,7 @@ public abstract class BaseCommand Description = $"**`{ctx.Prefix}{ctx.Command.Name}{(ctx.RawArgumentString != "" ? $" {ctx.RawArgumentString.SanitizeForCode().Replace("\\", "")}" : "")}` is not a valid way of using this command.**\nUse it like this instead: `{ctx.Prefix}{ctx.Command.GenerateUsage()}`\n\nArguments wrapped in `[]` are optional while arguments wrapped in `<>` are required.\n**Do not include the brackets when using commands, they're merely an indicator for requirement.**", }.AsError(this.ctx); - _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).WithContent(this.ctx.User.Mention)); + _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).WithContent(this.ctx.User.Mention)); } #endregion } diff --git a/ProjectMakoto/Commands/Configuration/ActionLogCommand.cs b/ProjectMakoto/Commands/Configuration/ActionLogCommand.cs index addcd05d..a221f9fc 100644 --- a/ProjectMakoto/Commands/Configuration/ActionLogCommand.cs +++ b/ProjectMakoto/Commands/Configuration/ActionLogCommand.cs @@ -60,7 +60,7 @@ internal sealed class ActionLogCommand : BaseCommand var ChangeChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), $"{(ctx.DbGuild.ActionLog.Channel == 0 ? this.GetString(CommandKey.SetChannelButton) : this.GetString(CommandKey.ChangeChannelButton))}", false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); var ChangeFilter = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeFilterButton), (ctx.DbGuild.ActionLog.Channel == 0), new DiscordComponentEmoji(DiscordEmoji.FromUnicode("📣"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { { Disable } @@ -153,7 +153,7 @@ internal sealed class ActionLogCommand : BaseCommand new(this.GetString(CommandKey.InviteModifications), "log_invites_modified", null, ctx.DbGuild.ActionLog.InvitesModified, new DiscordComponentEmoji(EmojiTemplates.GetInvite(ctx.Bot))), }; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(new DiscordStringSelectComponent(this.GetString(CommandKey.NoOptions), Selections, Guid.NewGuid().ToString(), 0, Selections.Count, false))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(new DiscordStringSelectComponent(this.GetString(CommandKey.NoOptions), Selections, Guid.NewGuid().ToString(), 0, Selections.Count, false))); var e = await ctx.Client.GetInteractivity().WaitForSelectAsync(ctx.ResponseMessage, x => x.User.Id == ctx.User.Id, ComponentType.StringSelect, TimeSpan.FromMinutes(2)); diff --git a/ProjectMakoto/Commands/Configuration/AutoCrosspostCommand.cs b/ProjectMakoto/Commands/Configuration/AutoCrosspostCommand.cs index 0bd21aa6..11794f0d 100644 --- a/ProjectMakoto/Commands/Configuration/AutoCrosspostCommand.cs +++ b/ProjectMakoto/Commands/Configuration/AutoCrosspostCommand.cs @@ -47,7 +47,7 @@ internal sealed class AutoCrosspostCommand : BaseCommand var AddButton = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.AddChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("➕"))); var RemoveButton = new DiscordButtonComponent(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetString(CommandKey.RemoveChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("✖"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { ExcludeBots, @@ -96,7 +96,7 @@ internal sealed class AutoCrosspostCommand : BaseCommand { if (ModalResult.Exception.GetType() == typeof(InvalidOperationException)) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.WithDescription(this.GetString(CommandKey.DurationLimit, true)).AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.WithDescription(this.GetString(CommandKey.DurationLimit, true)).AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -123,7 +123,7 @@ internal sealed class AutoCrosspostCommand : BaseCommand { embed.Description = this.GetString(CommandKey.ChannelLimit, true, new TVar("Invite", ctx.Bot.status.DevelopmentServerInvite)); embed = embed.AsError(ctx, this.GetString(CommandKey.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -156,7 +156,7 @@ internal sealed class AutoCrosspostCommand : BaseCommand if (ChannelResult.Result.Type != ChannelType.News) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.WithDescription(this.GetString(this.t.Commands.Common.Errors.NoChannels, true)).AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.WithDescription(this.GetString(this.t.Commands.Common.Errors.NoChannels, true)).AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; diff --git a/ProjectMakoto/Commands/Configuration/AutoUnarchiveCommand.cs b/ProjectMakoto/Commands/Configuration/AutoUnarchiveCommand.cs index 31e8b076..cbc8c97e 100644 --- a/ProjectMakoto/Commands/Configuration/AutoUnarchiveCommand.cs +++ b/ProjectMakoto/Commands/Configuration/AutoUnarchiveCommand.cs @@ -41,7 +41,7 @@ internal sealed class AutoUnarchiveCommand : BaseCommand var Add = new DiscordButtonComponent(ButtonStyle.Success, Guid.NewGuid().ToString(), this.GetString(CommandKey.AddChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("➕"))); var Remove = new DiscordButtonComponent(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetString(CommandKey.RemoveChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("✖"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { Add, diff --git a/ProjectMakoto/Commands/Configuration/BumpReminderCommand.cs b/ProjectMakoto/Commands/Configuration/BumpReminderCommand.cs index 7fcc6b21..9c63e8ed 100644 --- a/ProjectMakoto/Commands/Configuration/BumpReminderCommand.cs +++ b/ProjectMakoto/Commands/Configuration/BumpReminderCommand.cs @@ -42,7 +42,7 @@ internal sealed class BumpReminderCommand : BaseCommand var ChangeChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeChannelButton), ctx.DbGuild.BumpReminder.ChannelId == 0, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); var ChangeRole = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeRoleButton), ctx.DbGuild.BumpReminder.ChannelId == 0, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👤"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithDescription(GetCurrentConfiguration(ctx)).AsAwaitingInput(ctx, this.GetString(CommandKey.Title))) .AddComponents(new List { diff --git a/ProjectMakoto/Commands/Configuration/EmbedMessageCommand.cs b/ProjectMakoto/Commands/Configuration/EmbedMessageCommand.cs index 9db9f3d5..cbb51df2 100644 --- a/ProjectMakoto/Commands/Configuration/EmbedMessageCommand.cs +++ b/ProjectMakoto/Commands/Configuration/EmbedMessageCommand.cs @@ -40,7 +40,7 @@ internal sealed class EmbedMessageCommand : BaseCommand var ToggleMsg = new DiscordButtonComponent((ctx.DbGuild.EmbedMessage.UseEmbedding ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleMessageLinkButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); var ToggleGithub = new DiscordButtonComponent((ctx.DbGuild.EmbedMessage.UseGithubEmbedding ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleGithubCodeButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🤖"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { ToggleMsg, diff --git a/ProjectMakoto/Commands/Configuration/ExperienceCommand.cs b/ProjectMakoto/Commands/Configuration/ExperienceCommand.cs index 733ff290..b4b61595 100644 --- a/ProjectMakoto/Commands/Configuration/ExperienceCommand.cs +++ b/ProjectMakoto/Commands/Configuration/ExperienceCommand.cs @@ -37,7 +37,7 @@ internal sealed class ExperienceCommand : BaseCommand Description = GetCurrentConfiguration(ctx) }.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); var ToggleExperienceSystem = new DiscordButtonComponent((ctx.DbGuild.Experience.UseExperience ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleExperienceButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("✨"))); var ToggleBumperBoost = new DiscordButtonComponent((ctx.DbGuild.Experience.BoostXpForBumpReminder ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleExperienceBoostButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⏫"))); diff --git a/ProjectMakoto/Commands/Configuration/InVoicePrivacyCommand.cs b/ProjectMakoto/Commands/Configuration/InVoicePrivacyCommand.cs index e872534c..4612f9c6 100644 --- a/ProjectMakoto/Commands/Configuration/InVoicePrivacyCommand.cs +++ b/ProjectMakoto/Commands/Configuration/InVoicePrivacyCommand.cs @@ -40,7 +40,7 @@ internal sealed class InVoicePrivacyCommand : BaseCommand var ToggleDeletion = new DiscordButtonComponent((ctx.DbGuild.InVoiceTextPrivacy.ClearTextEnabled ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleMessageDeletionButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🗑"))); var TogglePermission = new DiscordButtonComponent((ctx.DbGuild.InVoiceTextPrivacy.SetPermissionsEnabled ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.TogglePermissionProtectionButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("📋"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { ToggleDeletion, diff --git a/ProjectMakoto/Commands/Configuration/InviteNotesCommand.cs b/ProjectMakoto/Commands/Configuration/InviteNotesCommand.cs index 6806e2d2..25b5f734 100644 --- a/ProjectMakoto/Commands/Configuration/InviteNotesCommand.cs +++ b/ProjectMakoto/Commands/Configuration/InviteNotesCommand.cs @@ -39,7 +39,7 @@ internal sealed class InviteNotesCommand : BaseCommand if (!(ctx.DbGuild.InviteNotes.Notes.Length > 19)) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { AddButton, @@ -48,7 +48,7 @@ internal sealed class InviteNotesCommand : BaseCommand } else { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { RemoveButton }).AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); } @@ -81,7 +81,7 @@ internal sealed class InviteNotesCommand : BaseCommand $"`{this.GetString(CommandKey.Invite).PadRight(pad)}`: `{(SelectedInvite is null ? this.GetString(this.t.Common.NotSelected) : $"{SelectedInvite.Code}")}`" }.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { SelectTextButton, SelectInviteButton, Finish }) .AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); diff --git a/ProjectMakoto/Commands/Configuration/InviteTrackerCommand.cs b/ProjectMakoto/Commands/Configuration/InviteTrackerCommand.cs index acd4b117..04116a32 100644 --- a/ProjectMakoto/Commands/Configuration/InviteTrackerCommand.cs +++ b/ProjectMakoto/Commands/Configuration/InviteTrackerCommand.cs @@ -34,7 +34,7 @@ internal sealed class InviteTrackerCommand : BaseCommand var Toggle = new DiscordButtonComponent((ctx.DbGuild.InviteTracker.Enabled ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleInviteTrackerButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("📲"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { Toggle diff --git a/ProjectMakoto/Commands/Configuration/JoinCommand.cs b/ProjectMakoto/Commands/Configuration/JoinCommand.cs index dfebaa34..24606e26 100644 --- a/ProjectMakoto/Commands/Configuration/JoinCommand.cs +++ b/ProjectMakoto/Commands/Configuration/JoinCommand.cs @@ -53,7 +53,7 @@ internal sealed class JoinCommand : BaseCommand Description = GetCurrentConfiguration(ctx) }.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); var ToggleGlobalban = new DiscordButtonComponent((ctx.DbGuild.Join.AutoBanGlobalBans ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleGlobalBansButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🌐"))); var ChangeJoinlogChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeJoinlogChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👋"))); diff --git a/ProjectMakoto/Commands/Configuration/LevelRewardsCommand.cs b/ProjectMakoto/Commands/Configuration/LevelRewardsCommand.cs index c7604f2c..ab9f9ee3 100644 --- a/ProjectMakoto/Commands/Configuration/LevelRewardsCommand.cs +++ b/ProjectMakoto/Commands/Configuration/LevelRewardsCommand.cs @@ -112,7 +112,7 @@ internal sealed class LevelRewardsCommand : BaseCommand var Dropdown = new DiscordStringSelectComponent(this.GetString(CommandKey.SelectDropdown), DefinedRewards.Skip(CurrentPage * 20).Take(20).ToList(), "RewardSelection"); embed = embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); if (DefinedRewards.Count > 0) _ = builder.AddComponents(Dropdown); @@ -196,7 +196,7 @@ internal sealed class LevelRewardsCommand : BaseCommand $"`{this.GetString(CommandKey.Message).PadRight(pad)}`: `{selectedCustomText}`" }.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed) .AddComponents(new List { SelectRole, SelectLevel, SelectCustomText, Finish }) .AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); @@ -316,7 +316,7 @@ internal sealed class LevelRewardsCommand : BaseCommand if (newMessage.Length > 256) { action_embed.Description = this.GetString(CommandKey.MessageTooLong, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -342,7 +342,7 @@ internal sealed class LevelRewardsCommand : BaseCommand }); action_embed.Description = this.GetString(CommandKey.AddedNewReward, true, new TVar("Role", $"<@&{selectedRole.Id}>"), new TVar("Level", selectedLevel)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await RefreshMessage(); @@ -391,7 +391,7 @@ internal sealed class LevelRewardsCommand : BaseCommand if (result.Length > 256) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.WithDescription(this.GetString(CommandKey.MessageTooLong, true)).AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.WithDescription(this.GetString(CommandKey.MessageTooLong, true)).AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; diff --git a/ProjectMakoto/Commands/Configuration/NameNormalizerCommand.cs b/ProjectMakoto/Commands/Configuration/NameNormalizerCommand.cs index 65c20670..2f4cab04 100644 --- a/ProjectMakoto/Commands/Configuration/NameNormalizerCommand.cs +++ b/ProjectMakoto/Commands/Configuration/NameNormalizerCommand.cs @@ -35,7 +35,7 @@ internal sealed class NameNormalizerCommand : BaseCommand var Toggle = new DiscordButtonComponent((ctx.DbGuild.NameNormalizer.NameNormalizerEnabled ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleNameNormalizer), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); var SearchAllNames = new DiscordButtonComponent(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetString(CommandKey.NormalizeNow), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔨"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { Toggle, @@ -64,7 +64,7 @@ internal sealed class NameNormalizerCommand : BaseCommand { if (ctx.DbGuild.NameNormalizer.NameNormalizerRunning) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)) .WithDescription(this.GetString(CommandKey.NormalizerRunning, true)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); @@ -78,7 +78,7 @@ internal sealed class NameNormalizerCommand : BaseCommand try { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsLoading(ctx, this.GetString(CommandKey.Title)) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsLoading(ctx, this.GetString(CommandKey.Title)) .WithDescription(this.GetString(CommandKey.RenamingAllMembers, true)))); var members = await ctx.Guild.GetAllMembersAsync(); @@ -101,7 +101,7 @@ internal sealed class NameNormalizerCommand : BaseCommand } } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)) .WithDescription(this.GetString(CommandKey.RenamedMembers, true, new TVar("Count", Renamed))))); await Task.Delay(5000); ctx.DbGuild.NameNormalizer.NameNormalizerRunning = false; diff --git a/ProjectMakoto/Commands/Configuration/PhishingCommand.cs b/ProjectMakoto/Commands/Configuration/PhishingCommand.cs index a18ef2de..0db6891c 100644 --- a/ProjectMakoto/Commands/Configuration/PhishingCommand.cs +++ b/ProjectMakoto/Commands/Configuration/PhishingCommand.cs @@ -73,7 +73,7 @@ internal sealed class PhishingCommand : BaseCommand var ChangeReasonButton = new DiscordButtonComponent(ButtonStyle.Secondary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangePunishmentReason), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); var ChangeTimeoutLengthButton = new DiscordButtonComponent(ButtonStyle.Secondary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeTimeoutLength), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🕒"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { { ToggleDetectionButton }, @@ -188,7 +188,7 @@ internal sealed class PhishingCommand : BaseCommand { if (ctx.DbGuild.PhishingDetection.PunishmentType != PhishingPunishmentType.Timeout) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.WithDescription(this.GetString(CommandKey.NotUsingType, true, new TVar("Type", this.GetString(CommandKey.PunishmentTypeTimeout)))))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.WithDescription(this.GetString(CommandKey.NotUsingType, true, new TVar("Type", this.GetString(CommandKey.PunishmentTypeTimeout)))))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -211,7 +211,7 @@ internal sealed class PhishingCommand : BaseCommand { if (ModalResult.Exception.GetType() == typeof(InvalidOperationException)) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.WithDescription(this.GetString(CommandKey.InvalidDuration, true)).AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.WithDescription(this.GetString(CommandKey.InvalidDuration, true)).AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; diff --git a/ProjectMakoto/Commands/Configuration/PrefixCommand.cs b/ProjectMakoto/Commands/Configuration/PrefixCommand.cs index d41c17f8..c32a2b74 100644 --- a/ProjectMakoto/Commands/Configuration/PrefixCommand.cs +++ b/ProjectMakoto/Commands/Configuration/PrefixCommand.cs @@ -36,7 +36,7 @@ internal sealed class PrefixCommand : BaseCommand var TogglePrefixCommands = new DiscordButtonComponent((ctx.DbGuild.PrefixSettings.PrefixDisabled ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(this.t.Commands.Config.PrefixConfigCommand.TogglePrefixCommands), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⌨"))); var ChangePrefix = new DiscordButtonComponent(ButtonStyle.Secondary, Guid.NewGuid().ToString(), this.GetString(this.t.Commands.Config.PrefixConfigCommand.ChangePrefix), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🗝"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { { TogglePrefixCommands }, diff --git a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/AddCommand.cs b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/AddCommand.cs index 6703cebe..8d16155d 100644 --- a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/AddCommand.cs +++ b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/AddCommand.cs @@ -78,7 +78,7 @@ internal sealed class AddCommand : BaseCommand case Enums.CommandType.ContextMenu: { embed.Description = this.GetString(CommandKey.SelectRolePrompt, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); var RoleResult = await this.PromptRoleSelection(); if (RoleResult.TimedOut) @@ -122,7 +122,7 @@ internal sealed class AddCommand : BaseCommand case Enums.CommandType.ContextMenu: { embed.Description = this.GetString(CommandKey.ReactWithEmoji, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); var emoji_wait = await ctx.Client.GetInteractivity().WaitForReactionAsync(x => x.Channel.Id == ctx.Channel.Id && x.User.Id == ctx.User.Id && x.Message.Id == message.Id, TimeSpan.FromMinutes(2)); @@ -141,7 +141,7 @@ internal sealed class AddCommand : BaseCommand if (emoji_parameter.Id != 0 && !ctx.Guild.Emojis.ContainsKey(emoji_parameter.Id)) { embed.Description = this.GetString(CommandKey.NoAccessToEmoji); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); return; } @@ -157,28 +157,28 @@ internal sealed class AddCommand : BaseCommand if (ctx.DbGuild.ReactionRoles.Length > 100) { embed.Description = this.GetString(CommandKey.ReactionRoleLimitReached, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); return; } if (emoji_parameter.Id != 0 && !ctx.Guild.Emojis.ContainsKey(emoji_parameter.Id)) { embed.Description = this.GetString(CommandKey.NoAccessToEmoji, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); return; } if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == message.Id && x.EmojiName == emoji_parameter.GetUniqueDiscordName()))) { embed.Description = this.GetString(CommandKey.EmojiAlreadyUsed, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); return; } if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == role_parameter.Id)) { embed.Description = this.GetString(CommandKey.RoleAlreadyUsed, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); return; } @@ -198,7 +198,7 @@ internal sealed class AddCommand : BaseCommand new TVar("User", message.Author.Mention), new TVar("Channel", message.Channel.Mention), new TVar("Emoji", emoji_parameter)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); }); } } \ No newline at end of file diff --git a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/ConfigCommand.cs b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/ConfigCommand.cs index 96feb20f..502a521c 100644 --- a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/ConfigCommand.cs +++ b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/ConfigCommand.cs @@ -37,7 +37,7 @@ internal sealed class ConfigCommand : BaseCommand Description = this.GetString(CommandKey.ReactionRoleCount, true, new TVar("Count", ctx.DbGuild.ReactionRoles.Length)) }.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { AddButton, RemoveButton @@ -80,13 +80,13 @@ internal sealed class ConfigCommand : BaseCommand if (ctx.DbGuild.ReactionRoles.Length > 100) { action_embed.Description = this.GetString(CommandKey.ReactionRoleLimitReached, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed) .AddComponents(new List { SelectMessage, SelectEmoji, SelectRole, Finish }) .AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); @@ -132,7 +132,7 @@ internal sealed class ConfigCommand : BaseCommand $"`https://ptb.discord.com/channels/012345678901234567/012345678901234567/012345678912345678`\n" + $"`https://canary.discord.com/channels/012345678901234567/012345678901234567/012345678912345678`"; action_embed.ImageUrl = ""; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -141,7 +141,7 @@ internal sealed class ConfigCommand : BaseCommand { action_embed.Description = this.GetString(CommandKey.MessageUrlWrongGuild, true); action_embed.ImageUrl = ""; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -150,7 +150,7 @@ internal sealed class ConfigCommand : BaseCommand { action_embed.Description = this.GetString(CommandKey.MessageUrlNoChannel, true); action_embed.ImageUrl = ""; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -161,7 +161,7 @@ internal sealed class ConfigCommand : BaseCommand { action_embed.Description = this.GetString(CommandKey.MessageUrlNoMessage, true); action_embed.ImageUrl = ""; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -175,7 +175,7 @@ internal sealed class ConfigCommand : BaseCommand action_embed.Description = this.GetString(CommandKey.ReactWithEmoji, true); action_embed.ImageUrl = ""; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); var emoji_wait = await ctx.Client.GetInteractivity().WaitForReactionAsync(x => x.Channel.Id == ctx.Channel.Id && x.User.Id == ctx.User.Id && x.Message.Id == selectedMessage.Id, TimeSpan.FromMinutes(2)); @@ -194,7 +194,7 @@ internal sealed class ConfigCommand : BaseCommand if (emoji.Id != 0 && !ctx.Guild.Emojis.ContainsKey(emoji.Id)) { action_embed.Description = this.GetString(CommandKey.NoAccessToEmoji, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -202,7 +202,7 @@ internal sealed class ConfigCommand : BaseCommand if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == selectedMessage.Id && x.EmojiName == emoji.GetUniqueDiscordName()))) { action_embed.Description = this.GetString(CommandKey.EmojiAlreadyUsed, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -242,7 +242,7 @@ internal sealed class ConfigCommand : BaseCommand if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == RoleResult.Result.Id)) { action_embed.Description = this.GetString(CommandKey.RoleAlreadyUsed, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(3000); continue; } @@ -257,7 +257,7 @@ internal sealed class ConfigCommand : BaseCommand if (ctx.DbGuild.ReactionRoles.Length > 100) { action_embed.Description = this.GetString(CommandKey.ReactionRoleLimitReached, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -266,7 +266,7 @@ internal sealed class ConfigCommand : BaseCommand if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == selectedRole.Id)) { action_embed.Description = this.GetString(CommandKey.RoleAlreadyUsed, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -275,7 +275,7 @@ internal sealed class ConfigCommand : BaseCommand if (selectedEmoji.Id != 0 && !ctx.Guild.Emojis.ContainsKey(selectedEmoji.Id)) { action_embed.Description = this.GetString(CommandKey.NoAccessToEmoji, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -284,7 +284,7 @@ internal sealed class ConfigCommand : BaseCommand if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == selectedMessage.Id && x.EmojiName == selectedEmoji.GetUniqueDiscordName()))) { action_embed.Description = this.GetString(CommandKey.EmojiAlreadyUsed, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsError(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -306,7 +306,7 @@ internal sealed class ConfigCommand : BaseCommand new TVar("User", selectedMessage.Author.Mention), new TVar("Channel", selectedMessage.Channel.Mention), new TVar("Emoji", selectedEmoji)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; @@ -357,7 +357,7 @@ internal sealed class ConfigCommand : BaseCommand new TVar("User", reactionMessage?.Author.Mention ?? "`/`"), new TVar("Channel", reactionMessage?.Channel.Mention ?? "`/`"), new TVar("Emoji", obj.GetEmoji(ctx.Client))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); await Task.Delay(5000); await this.ExecuteCommand(ctx, arguments); return; diff --git a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveAllCommand.cs b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveAllCommand.cs index ef09781a..92dcc390 100644 --- a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveAllCommand.cs +++ b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveAllCommand.cs @@ -68,7 +68,7 @@ internal sealed class RemoveAllCommand : BaseCommand if (!ctx.DbGuild.ReactionRoles.Any(x => x.MessageId == message.Id)) { embed.Description = this.GetString(CommandKey.NoReactionRoles, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); return; } @@ -80,7 +80,7 @@ internal sealed class RemoveAllCommand : BaseCommand embed.Description = this.GetString(CommandKey.RemovedAllReactionRoles, true, new TVar("User", message?.Author.Mention ?? "`/`"), new TVar("Channel", message?.Channel.Mention ?? "`/`")); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); }); } } \ No newline at end of file diff --git a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveCommand.cs b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveCommand.cs index 5a2fa9a6..39579585 100644 --- a/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveCommand.cs +++ b/ProjectMakoto/Commands/Configuration/ReactionRolesCommand/RemoveCommand.cs @@ -77,7 +77,7 @@ internal sealed class RemoveCommand : BaseCommand case Enums.CommandType.ContextMenu: { embed.Description = this.GetString(CommandKey.ReactWithEmojiToRemove, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))); var emoji_wait = await ctx.Client.GetInteractivity().WaitForReactionAsync(x => x.Channel.Id == ctx.Channel.Id && x.User.Id == ctx.User.Id && x.Message.Id == message.Id, TimeSpan.FromMinutes(2)); @@ -98,7 +98,7 @@ internal sealed class RemoveCommand : BaseCommand if (!ctx.DbGuild.ReactionRoles.Any(x => x.MessageId == message.Id && x.EmojiName == emoji_parameter.GetUniqueDiscordName())) { embed.Description = this.GetString(CommandKey.NoReactionRoleFound); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, this.GetString(CommandKey.Title)))); return; } @@ -116,7 +116,7 @@ internal sealed class RemoveCommand : BaseCommand new TVar("User", reactionMessage?.Author.Mention ?? "`/`"), new TVar("Channel", reactionMessage?.Channel.Mention ?? "`/`"), new TVar("Emoji", obj.GetEmoji(ctx.Client))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsSuccess(ctx, this.GetString(CommandKey.Title)))); }); } } \ No newline at end of file diff --git a/ProjectMakoto/Commands/Configuration/TokenDetectionCommand.cs b/ProjectMakoto/Commands/Configuration/TokenDetectionCommand.cs index 5ac6f0af..fa2872fb 100644 --- a/ProjectMakoto/Commands/Configuration/TokenDetectionCommand.cs +++ b/ProjectMakoto/Commands/Configuration/TokenDetectionCommand.cs @@ -34,7 +34,7 @@ internal sealed class TokenDetectionCommand : BaseCommand var Toggle = new DiscordButtonComponent((ctx.DbGuild.TokenLeakDetection.DetectTokens ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleTokenDetection), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⚠"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { Toggle diff --git a/ProjectMakoto/Commands/Configuration/VcCreatorCommand.cs b/ProjectMakoto/Commands/Configuration/VcCreatorCommand.cs index 638e3790..70e6b847 100644 --- a/ProjectMakoto/Commands/Configuration/VcCreatorCommand.cs +++ b/ProjectMakoto/Commands/Configuration/VcCreatorCommand.cs @@ -34,7 +34,7 @@ internal sealed class VcCreatorCommand : BaseCommand var SetChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.SetVcCreator), false, EmojiTemplates.GetChannel(ctx.Bot).ToComponent()); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { SetChannel diff --git a/ProjectMakoto/Commands/Maintainers/DevTools/EvaluationCommand.cs b/ProjectMakoto/Commands/Maintainers/DevTools/EvaluationCommand.cs index c35d0d27..25564326 100644 --- a/ProjectMakoto/Commands/Maintainers/DevTools/EvaluationCommand.cs +++ b/ProjectMakoto/Commands/Maintainers/DevTools/EvaluationCommand.cs @@ -23,7 +23,7 @@ internal sealed class EvaluationCommand : BaseCommand { if (ctx.CommandType is not Enums.CommandType.ApplicationCommand and not Enums.CommandType.ContextMenu) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder().WithDescription("Evaluating CScript has the potential of leaking confidential information. Are you sure you want to run this command as Prefix Command?").AsWarning(ctx)) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder().WithDescription("Evaluating CScript has the potential of leaking confidential information. Are you sure you want to run this command as Prefix Command?").AsWarning(ctx)) .AddComponents(new List { new DiscordButtonComponent(ButtonStyle.Success, "yes", "Yes"), new DiscordButtonComponent(ButtonStyle.Danger, "no", "No")})); diff --git a/ProjectMakoto/Commands/Maintainers/DevTools/GlobalNotesCommand.cs b/ProjectMakoto/Commands/Maintainers/DevTools/GlobalNotesCommand.cs index 912b94cb..84893997 100644 --- a/ProjectMakoto/Commands/Maintainers/DevTools/GlobalNotesCommand.cs +++ b/ProjectMakoto/Commands/Maintainers/DevTools/GlobalNotesCommand.cs @@ -44,7 +44,7 @@ internal sealed class GlobalNotesCommand : BaseCommand var RemoveButton = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), "Remove Notes", (!ctx.Bot.globalNotes.ContainsKey(victim.Id)), DiscordEmoji.FromUnicode("➖").ToComponent()); _ = await this.RespondOrEdit(new DiscordMessageBuilder() - .WithEmbed(new DiscordEmbedBuilder() + .AddEmbed(new DiscordEmbedBuilder() .WithDescription($"{victim.Mention} `has {(ctx.Bot.globalNotes.TryGetValue(victim.Id, out var noteObj) ? noteObj.Notes.Length : 0)} global notes.`") .AddFields((noteObj is not null ? noteObj.Notes.Take(20).Select(x => new DiscordEmbedField("󠂪 󠂪", $"{x.Reason.FullSanitize()} - `{(ModeratorCache[x.Moderator] is null ? "Unknown#0000" : ModeratorCache[x.Moderator].GetUsernameWithIdentifier())}` {x.Timestamp.ToTimestamp()}")) : new List()))) .AddComponents(new List { AddButton, RemoveButton }) diff --git a/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs b/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs index 213e7b24..a4777f55 100644 --- a/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs +++ b/ProjectMakoto/Commands/Moderation/CustomEmbedCommand.cs @@ -44,7 +44,7 @@ internal sealed class CustomEmbedCommand : BaseCommand try { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(GeneratedEmbed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(GeneratedEmbed) .AddComponents(new List { SetTitle, SetAuthor, SetThumbnail }) .AddComponents(new List { SetDescription, SetImage, SetColor }) .AddComponents(new List { SetFooter, SetTimestamp }) @@ -119,7 +119,7 @@ internal sealed class CustomEmbedCommand : BaseCommand var SetByUser = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.SetAsUserButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👤"))); var SetByGuild = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.SetAsServer), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🖥"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(GeneratedEmbed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(GeneratedEmbed) .AddComponents(new List { SetName, SetUrl, SetIcon }) .AddComponents(new List { SetByUser, SetByGuild }) .AddComponents(new List { MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot) })); @@ -425,7 +425,7 @@ internal sealed class CustomEmbedCommand : BaseCommand var SetByUser = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.SetAsUserButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👤"))); var SetByGuild = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.SetAsServer), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🖥"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(GeneratedEmbed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(GeneratedEmbed) .AddComponents(new List { SetText, SetIcon }) .AddComponents(new List { SetByUser, SetByGuild }) .AddComponents(new List { MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot) })); diff --git a/ProjectMakoto/Commands/Moderation/GuildPurgeCommand.cs b/ProjectMakoto/Commands/Moderation/GuildPurgeCommand.cs index 4492c934..ba306b7a 100644 --- a/ProjectMakoto/Commands/Moderation/GuildPurgeCommand.cs +++ b/ProjectMakoto/Commands/Moderation/GuildPurgeCommand.cs @@ -31,7 +31,7 @@ internal sealed class GuildPurgeCommand : BaseCommand return; } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder(). + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder(). WithDescription(this.GetString(CommandKey.Scanning, true, new TVar("Victim", victim.Mention))) .AsLoading(ctx))); @@ -49,7 +49,7 @@ internal sealed class GuildPurgeCommand : BaseCommand currentProg++; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder(). + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder(). WithDescription($"{this.GetString(CommandKey.Scanning, true, new TVar("Victim", victim.Mention))}\n" + $"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg),3}%`") .AsLoading(ctx))); @@ -118,7 +118,7 @@ internal sealed class GuildPurgeCommand : BaseCommand if (message.CreationTimestamp.GetTimespanSince() > TimeSpan.FromDays(14)) _ = channel.Value.Remove(message); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithDescription($"{this.GetString(CommandKey.Deleting, true, new TVar("Victim", victim.Mention), new TVar("Count", allMsg))}\n" + $"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg)}%`") .AsLoading(ctx))); @@ -133,7 +133,7 @@ internal sealed class GuildPurgeCommand : BaseCommand { try { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithDescription($"{this.GetString(CommandKey.Deleting, true, new TVar("Victim", victim.Mention), new TVar("Count", allMsg))}\n" + $"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg)}%`") .AsLoading(ctx))); @@ -149,7 +149,7 @@ internal sealed class GuildPurgeCommand : BaseCommand catch { } } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithDescription(this.GetString(CommandKey.Ended, true, new TVar("Victim", victim.Mention), new TVar("Min", currentProg), new TVar("Max", maxProg), new TVar("ChannelCount", channelList.Count))) .AsSuccess(ctx))); }); diff --git a/ProjectMakoto/Commands/Moderation/ManualBumpCommand.cs b/ProjectMakoto/Commands/Moderation/ManualBumpCommand.cs index afbf2c52..0be46249 100644 --- a/ProjectMakoto/Commands/Moderation/ManualBumpCommand.cs +++ b/ProjectMakoto/Commands/Moderation/ManualBumpCommand.cs @@ -28,7 +28,7 @@ internal sealed class ManualBumpCommand : BaseCommand DiscordButtonComponent YesButton = new(ButtonStyle.Success, Guid.NewGuid().ToString(), this.GetString(this.t.Common.Yes), false, DiscordEmoji.FromUnicode("✅").ToComponent()); _ = await this.RespondOrEdit(new DiscordMessageBuilder() - .WithEmbed(new DiscordEmbedBuilder().WithDescription(this.GetString(CommandKey.Warning, true)).AsWarning(ctx)) + .AddEmbed(new DiscordEmbedBuilder().WithDescription(this.GetString(CommandKey.Warning, true)).AsWarning(ctx)) .AddComponents(new DiscordButtonComponent(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetString(this.t.Common.No), false, DiscordEmoji.FromUnicode("❌").ToComponent()), YesButton)); var e = await ctx.ResponseMessage.WaitForButtonAsync(ctx.User); diff --git a/ProjectMakoto/Commands/Utility/AvatarCommand.cs b/ProjectMakoto/Commands/Utility/AvatarCommand.cs index 84d78a28..5f5bc097 100644 --- a/ProjectMakoto/Commands/Utility/AvatarCommand.cs +++ b/ProjectMakoto/Commands/Utility/AvatarCommand.cs @@ -37,7 +37,7 @@ internal sealed class AvatarCommand : BaseCommand var ServerProfilePictureButton = new DiscordButtonComponent(ButtonStyle.Secondary, "ShowServer", this.GetString(this.t.Commands.Utility.Avatar.ShowServerProfile), (string.IsNullOrWhiteSpace(member?.GuildAvatarHash)), new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🖥"))); var ProfilePictureButton = new DiscordButtonComponent(ButtonStyle.Secondary, "ShowProfile", this.GetString(this.t.Commands.Utility.Avatar.ShowUserProfile), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👤"))); - var builder = new DiscordMessageBuilder().WithEmbed(embed).AddComponents(ServerProfilePictureButton); + var builder = new DiscordMessageBuilder().AddEmbed(embed).AddComponents(ServerProfilePictureButton); var msg = await this.RespondOrEdit(builder); @@ -77,12 +77,12 @@ internal sealed class AvatarCommand : BaseCommand if (e.GetCustomId() == ServerProfilePictureButton.CustomId) { embed.ImageUrl = member.GuildAvatarUrl; - _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(ProfilePictureButton)); + _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(ProfilePictureButton)); } else if (e.GetCustomId() == ProfilePictureButton.CustomId) { embed.ImageUrl = member.AvatarUrl; - _ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(ServerProfilePictureButton)); + _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(ServerProfilePictureButton)); } } }).Add(ctx.Bot, ctx); diff --git a/ProjectMakoto/Commands/Utility/BannerCommand.cs b/ProjectMakoto/Commands/Utility/BannerCommand.cs index 3d0609a0..a023a409 100644 --- a/ProjectMakoto/Commands/Utility/BannerCommand.cs +++ b/ProjectMakoto/Commands/Utility/BannerCommand.cs @@ -29,7 +29,7 @@ internal sealed class BannerCommand : BaseCommand Description = victim.BannerUrl.IsNullOrWhiteSpace() ? this.GetString(this.t.Commands.Utility.Banner.NoBanner, true) : "" }.AsInfo(ctx, this.GetString(this.t.Commands.Utility.Banner.Banner, false, new TVar("User", victim.GetUsernameWithIdentifier()))); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); _ = await this.RespondOrEdit(builder); }); diff --git a/ProjectMakoto/Commands/Utility/Data/DeleteCommand.cs b/ProjectMakoto/Commands/Utility/Data/DeleteCommand.cs index b06b9b94..553c04c7 100644 --- a/ProjectMakoto/Commands/Utility/Data/DeleteCommand.cs +++ b/ProjectMakoto/Commands/Utility/Data/DeleteCommand.cs @@ -23,7 +23,7 @@ internal sealed class DeleteCommand : BaseCommand if (ctx.Bot.objectedUsers.Contains(ctx.User.Id)) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Utility.Data.Object.ProfileAlreadyDeleted, true) }.AsAwaitingInput(ctx)).AddComponents(new List { Yes, No })); @@ -75,7 +75,7 @@ internal sealed class DeleteCommand : BaseCommand if (ctx.DbUser.Data.DeletionRequested) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Utility.Data.Object.DeletionAlreadyScheduled, true, new TVar("RequestTimestamp", ctx.DbUser.Data.DeletionRequestDate.AddDays(-14).ToTimestamp()), @@ -110,7 +110,7 @@ internal sealed class DeleteCommand : BaseCommand return; } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Utility.Data.Object.ObjectionDisclaimer, true, true) }.AsAwaitingInput(ctx)).AddComponents(new List { Yes, No })); @@ -127,7 +127,7 @@ internal sealed class DeleteCommand : BaseCommand if (Menu.GetCustomId() == Yes.CustomId) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = $"**{this.GetString(this.t.Commands.Utility.Data.Object.SecondaryConfirm, true)}**" }.AsAwaitingInput(ctx)).AddComponents(new List { No, Yes })); diff --git a/ProjectMakoto/Commands/Utility/Data/RequestCommand.cs b/ProjectMakoto/Commands/Utility/Data/RequestCommand.cs index ffe38945..ee155055 100644 --- a/ProjectMakoto/Commands/Utility/Data/RequestCommand.cs +++ b/ProjectMakoto/Commands/Utility/Data/RequestCommand.cs @@ -55,7 +55,7 @@ internal sealed class RequestCommand : BaseCommand { case Enums.CommandType.ApplicationCommand: { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Utility.Data.Request.Confirm, true) }.AsSuccess(ctx)).WithFile("userdata.json", stream)); @@ -66,7 +66,7 @@ internal sealed class RequestCommand : BaseCommand { try { - _ = await ctx.User.SendMessageAsync(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await ctx.User.SendMessageAsync(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Utility.Data.Request.Confirm, true) }.AsSuccess(ctx)).WithFile("userdata.json", stream)); diff --git a/ProjectMakoto/Commands/Utility/EmojiStealerCommand.cs b/ProjectMakoto/Commands/Utility/EmojiStealerCommand.cs index f349f12e..628f24d5 100644 --- a/ProjectMakoto/Commands/Utility/EmojiStealerCommand.cs +++ b/ProjectMakoto/Commands/Utility/EmojiStealerCommand.cs @@ -198,7 +198,7 @@ internal sealed class EmojiStealerCommand : BaseCommand var SendHereButton = new DiscordButtonComponent(ButtonStyle.Secondary, "SendHere", this.GetString(this.t.Commands.Utility.EmojiStealer.CurrentChatZip), !(ctx.Member.Permissions.HasPermission(Permissions.AttachFiles)), new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); if (SanitizedEmoteList.Any(x => x.Value.EntryType == EmojiType.STICKER)) _ = builder.AddComponents(IncludeStickersButton); @@ -268,7 +268,7 @@ internal sealed class EmojiStealerCommand : BaseCommand new TVar("Min", 0), new TVar("Max", (IncludeStickers ? SanitizedEmoteList.Count : SanitizedEmoteList.Where(x => x.Value.EntryType == EmojiType.EMOJI).Count()))); _ = embed.AsLoading(ctx); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); for (var i = 0; i < SanitizedEmoteList.Count; i++) { @@ -369,7 +369,7 @@ internal sealed class EmojiStealerCommand : BaseCommand embed.Description = this.GetString(this.t.Commands.Utility.EmojiStealer.SendingDm, true, new TVar("Type", emojiText)); _ = embed.AsLoading(ctx); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); try { @@ -416,7 +416,7 @@ internal sealed class EmojiStealerCommand : BaseCommand cancellationTokenSource.Cancel(); embed.Description = this.GetString(this.t.Commands.Utility.EmojiStealer.PreparingZip, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsLoading(ctx))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsLoading(ctx))); using (var archive = new ZipArchive(zipFileStream, ZipArchiveMode.Create, true)) { @@ -476,7 +476,7 @@ internal sealed class EmojiStealerCommand : BaseCommand new TVar("Type", emojiText)); _ = zipFileStream.Seek(0, SeekOrigin.Begin); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithFile($"Emotes.zip", zipFileStream).WithEmbed(embed.AsSuccess(ctx))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithFile($"Emotes.zip", zipFileStream).AddEmbed(embed.AsSuccess(ctx))); } return; } @@ -493,7 +493,7 @@ internal sealed class EmojiStealerCommand : BaseCommand IncludeStickersButton = new DiscordButtonComponent((IncludeStickers ? ButtonStyle.Success : ButtonStyle.Danger), "ToggleStickers", this.GetString(this.t.Commands.Utility.EmojiStealer.ToggleStickers), !SanitizedEmoteList.Any(x => x.Value.EntryType == EmojiType.EMOJI), new DiscordComponentEmoji(DiscordEmoji.FromGuildEmote(ctx.Client, (ulong)(IncludeStickers ? 970278964755038248 : 970278964079767574)))); AddToServerButton = new DiscordButtonComponent(ButtonStyle.Success, "AddToServer", (IncludeStickers ? this.GetString(this.t.Commands.Utility.EmojiStealer.AddEmojisAndStickerToServer) : this.GetString(this.t.Commands.Utility.EmojiStealer.AddEmojisToServer)), !ctx.Member.Permissions.HasPermission(Permissions.ManageGuildExpressions), new DiscordComponentEmoji(DiscordEmoji.FromUnicode("➕"))); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); if (SanitizedEmoteList.Any(x => x.Value.EntryType == EmojiType.STICKER)) _ = builder.AddComponents(IncludeStickersButton); diff --git a/ProjectMakoto/Commands/Utility/GuildInfoCommand.cs b/ProjectMakoto/Commands/Utility/GuildInfoCommand.cs index 3cf655e4..b078b418 100644 --- a/ProjectMakoto/Commands/Utility/GuildInfoCommand.cs +++ b/ProjectMakoto/Commands/Utility/GuildInfoCommand.cs @@ -108,13 +108,13 @@ internal sealed class GuildInfoCommand : BaseCommand if (guild.RawFeatures.Count > 0) _ = embed.AddField(new DiscordEmbedField(this.GetString(CommandKey.GuildFeatures), $"{string.Join(", ", guild.RawFeatures.Select(x => $"`{string.Join(" ", x.Replace("_", " ").ToLower().Split(" ").Select(x => x.FirstLetterToUpper()))}`"))}")); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); if (!guild.VanityUrlCode.IsNullOrWhiteSpace()) _ = builder.AddComponents(new DiscordLinkButtonComponent($"https://discord.gg/{guild.VanityUrlCode}", this.GetString(CommandKey.JoinServer), false, DiscordEmoji.FromUnicode("🔗").ToComponent())); _ = await this.RespondOrEdit(new DiscordMessageBuilder() - .WithEmbed(embed) + .AddEmbed(embed) .AddComponents(new DiscordLinkButtonComponent(guild.BannerUrl ?? "https://discord.gg", this.GetString(CommandKey.Banner), guild.BannerUrl is null), new DiscordLinkButtonComponent(guild.SplashUrl ?? "https://discord.gg", this.GetString(CommandKey.Splash), guild.BannerUrl is null), new DiscordLinkButtonComponent(guild.DiscoverySplashUrl ?? "https://discord.gg", this.GetString(CommandKey.DiscoverySplash), guild.BannerUrl is null), @@ -127,7 +127,7 @@ internal sealed class GuildInfoCommand : BaseCommand // using (var file = new FileStream($"cache/{imageHash}", FileMode.Open, FileAccess.Read)) // { // _ = await this.RespondOrEdit(new DiscordMessageBuilder() - // .WithEmbed(embed) + // .AddEmbed(embed) // .WithFile("banner.png", file)); // } //} @@ -162,7 +162,7 @@ internal sealed class GuildInfoCommand : BaseCommand _ = embed.AddField(new DiscordEmbedField(this.GetString(CommandKey.GuildFeatures), $"{string.Join(", ", preview.Features.Select(x => $"`{string.Join(" ", x.Replace("_", " ").ToLower().Split(" ").Select(x => x.FirstLetterToUpper()))}`"))}")); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); var invite = ""; @@ -187,7 +187,7 @@ internal sealed class GuildInfoCommand : BaseCommand _ = embed.AddField(new DiscordEmbedField(this.GetString(CommandKey.MemberTitle), $"🟢 `{widget.PresenceCount}` **{this.GetString(CommandKey.OnlineMembers)}**\n")); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); if (!widget.InstantInviteUrl.IsNullOrWhiteSpace()) _ = builder.AddComponents(new DiscordLinkButtonComponent(widget.InstantInviteUrl, this.GetString(CommandKey.JoinServer), false, DiscordEmoji.FromUnicode("🔗").ToComponent())); diff --git a/ProjectMakoto/Commands/Utility/HelpCommand.cs b/ProjectMakoto/Commands/Utility/HelpCommand.cs index 1bc1745d..61308021 100644 --- a/ProjectMakoto/Commands/Utility/HelpCommand.cs +++ b/ProjectMakoto/Commands/Utility/HelpCommand.cs @@ -177,7 +177,7 @@ internal sealed class HelpCommand : BaseCommand var PreviousButton = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(this.t.Common.PreviousPage), (Page <= 0), DiscordEmoji.FromUnicode("◀").ToComponent()); var NextButton = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(this.t.Common.NextPage), (Page >= discordEmbeds.Count - 1), DiscordEmoji.FromUnicode("▶").ToComponent()); - var builder = new DiscordMessageBuilder().WithEmbed(discordEmbeds.ElementAt(Page)); + var builder = new DiscordMessageBuilder().AddEmbed(discordEmbeds.ElementAt(Page)); if (!PreviousButton.Disabled || !NextButton.Disabled) _ = builder.AddComponents(PreviousButton, NextButton); diff --git a/ProjectMakoto/Commands/Utility/RemindersCommand.cs b/ProjectMakoto/Commands/Utility/RemindersCommand.cs index 02274ba9..ff9aa308 100644 --- a/ProjectMakoto/Commands/Utility/RemindersCommand.cs +++ b/ProjectMakoto/Commands/Utility/RemindersCommand.cs @@ -34,7 +34,7 @@ internal sealed class RemindersCommand : BaseCommand if (snoozeDescription is null) { _ = await this.RespondOrEdit(new DiscordMessageBuilder() - .WithEmbed(new DiscordEmbedBuilder() + .AddEmbed(new DiscordEmbedBuilder() .WithDescription($"{this.GetString(this.t.Commands.Utility.Reminders.Count, true, new TVar("Count", rem.ScheduledReminders.Length))}\n\n" + $"{string.Join("\n\n", rem.ScheduledReminders.Select(x => $"> {x.Description.FullSanitize()}\n{this.GetString(this.t.Commands.Utility.Reminders.CreatedOn, new TVar("Guild", $"**{x.CreationPlace}**"))}\n{this.GetString(this.t.Commands.Utility.Reminders.DueTime, new TVar("Relative", x.DueTime.ToTimestamp()), new TVar("DateTime", x.DueTime.ToTimestamp(TimestampFormat.LongDateTime)))}").ToList())}\n\n" + $"**⚠ {this.GetString(this.t.Commands.Utility.Reminders.Notice)}**") @@ -80,7 +80,7 @@ internal sealed class RemindersCommand : BaseCommand $"`{this.GetString(this.t.Commands.Utility.Reminders.DateTime).PadRight(padding)}`: {(selectedDueDate is null ? $"`{this.GetString(this.t.Common.NotSelected)}`" : $"{selectedDueDate.Value.ToTimestamp(TimestampFormat.LongDateTime)} ({selectedDueDate.Value.ToTimestamp()})")}" }.AsAwaitingInput(ctx, this.GetString(this.t.Commands.Utility.Reminders.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed) .AddComponents(new List { SelectDescriptionButton, SelectDueDateButton, Finish }) .AddComponents(MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot))); diff --git a/ProjectMakoto/Commands/Utility/ReportHostCommand.cs b/ProjectMakoto/Commands/Utility/ReportHostCommand.cs index b1be2d76..001f67fd 100644 --- a/ProjectMakoto/Commands/Utility/ReportHostCommand.cs +++ b/ProjectMakoto/Commands/Utility/ReportHostCommand.cs @@ -40,7 +40,7 @@ internal sealed class ReportHostCommand : BaseCommand tos_embed.Description = tos_embed.Description.Insert(0, $"**{this.GetString(this.t.Commands.Utility.ReportHost.TosChangedNotice)}**\n\n"); } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(tos_embed).AddComponents(button)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(tos_embed).AddComponents(button)); var TosAccept = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(2)); @@ -100,7 +100,7 @@ internal sealed class ReportHostCommand : BaseCommand var ContinueButton = new DiscordButtonComponent(ButtonStyle.Success, Guid.NewGuid().ToString(), this.GetString(this.t.Common.Confirm), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("✅"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(new List + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(new List { { ContinueButton }, { MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot) } @@ -158,7 +158,7 @@ internal sealed class ReportHostCommand : BaseCommand var BanUserButton = new DiscordButtonComponent(ButtonStyle.Danger, "ban_user", "Deny submission & ban submitter", false, new DiscordComponentEmoji(DiscordEmoji.FromGuildEmote(ctx.Client, 1005430134070841395))); var BanGuildButton = new DiscordButtonComponent(ButtonStyle.Danger, "ban_guild", "Deny submission & ban guild", false, new DiscordComponentEmoji(DiscordEmoji.FromGuildEmote(ctx.Client, 1005430134070841395))); - var submittedMsg = await channel.SendMessageAsync(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + var submittedMsg = await channel.SendMessageAsync(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Author = new DiscordEmbedBuilder.EmbedAuthor { IconUrl = StatusIndicatorIcons.Success, Name = this.GetString(this.t.Commands.Utility.ReportHost.Title) }, Color = EmbedColors.Success, diff --git a/ProjectMakoto/Commands/Utility/ReportTranslationCommand.cs b/ProjectMakoto/Commands/Utility/ReportTranslationCommand.cs index eb169b65..737355db 100644 --- a/ProjectMakoto/Commands/Utility/ReportTranslationCommand.cs +++ b/ProjectMakoto/Commands/Utility/ReportTranslationCommand.cs @@ -49,7 +49,7 @@ internal sealed class ReportTranslationCommand : BaseCommand tos_embed.Description = tos_embed.Description.Insert(0, $"**{this.GetString(CommandKey.TosChangedNotice)}**\n\n"); } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(tos_embed).AddComponents(button)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(tos_embed).AddComponents(button)); var TosAccept = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(2)); diff --git a/ProjectMakoto/Commands/Utility/UrbanDictionaryCommand.cs b/ProjectMakoto/Commands/Utility/UrbanDictionaryCommand.cs index 2d81ab58..23a68e17 100644 --- a/ProjectMakoto/Commands/Utility/UrbanDictionaryCommand.cs +++ b/ProjectMakoto/Commands/Utility/UrbanDictionaryCommand.cs @@ -32,7 +32,7 @@ internal sealed class UrbanDictionaryCommand : BaseCommand var Yes = new DiscordButtonComponent(ButtonStyle.Success, Guid.NewGuid().ToString(), this.GetString(this.t.Common.Yes), false, new DiscordComponentEmoji(true.ToEmote(ctx.Bot))); var No = new DiscordButtonComponent(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetString(this.t.Common.No), false, new DiscordComponentEmoji(false.ToEmote(ctx.Bot))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(this.t.Commands.Utility.UrbanDictionary.AdultContentWarning, true) }.AsAwaitingInput(ctx)).AddComponents(new List { Yes, No })); diff --git a/ProjectMakoto/Commands/Utility/UserInfoCommand.cs b/ProjectMakoto/Commands/Utility/UserInfoCommand.cs index 487a574d..b0c47128 100644 --- a/ProjectMakoto/Commands/Utility/UserInfoCommand.cs +++ b/ProjectMakoto/Commands/Utility/UserInfoCommand.cs @@ -189,7 +189,7 @@ internal sealed class UserInfoCommand : BaseCommand if (bMember is not null && bMember.CommunicationDisabledUntil.HasValue && bMember.CommunicationDisabledUntil.Value.GetTotalSecondsUntil() > 0) _ = embed.AddField(new DiscordEmbedField(this.GetString(this.t.Commands.Utility.UserInfo.TimedOutUntil), $"{Formatter.Timestamp(bMember.CommunicationDisabledUntil.Value, TimestampFormat.LongDateTime)}", true)); - _ = await this.RespondOrEdit(builder.WithEmbed(embed)); + _ = await this.RespondOrEdit(builder.AddEmbed(embed)); if (InviterButtonAdded) { diff --git a/ProjectMakoto/Entities/Status.cs b/ProjectMakoto/Entities/Status.cs index 54331ae0..af6d3e76 100644 --- a/ProjectMakoto/Entities/Status.cs +++ b/ProjectMakoto/Entities/Status.cs @@ -52,6 +52,7 @@ public sealed class Status public EmojiConfig Emojis = new(config); public DiscordConfig Discord = new(config); public ChannelsConfig Channels = new(config); + public QuickChartConfig QuickChart = new(config); public sealed class DiscordConfig(Config config) { @@ -113,6 +114,13 @@ public sealed class Status public ulong AbuseIPDB => config.Emojis.AbuseIPDB; public ulong Spotify => config.Emojis.Spotify; } + + public sealed class QuickChartConfig(Config config) + { + public string? Scheme => config.Secrets.QuickChart.Scheme; + public string? Host = config.Secrets.QuickChart.Host; + public int? Port = config.Secrets.QuickChart.Port; + } } #region Legacy diff --git a/ProjectMakoto/Entities/Users/Reminders/ReminderSettings.cs b/ProjectMakoto/Entities/Users/Reminders/ReminderSettings.cs index 54a1f8a3..6505b0b1 100644 --- a/ProjectMakoto/Entities/Users/Reminders/ReminderSettings.cs +++ b/ProjectMakoto/Entities/Users/Reminders/ReminderSettings.cs @@ -48,7 +48,7 @@ public sealed class ReminderSettings : RequiresParent var user = await this.Bot.DiscordClient.GetFirstShard().GetUserAsync(this.Parent.Id); - var builder = new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + var builder = new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithDescription($"> {b.Description.FullSanitize()}\n" + $"{CommandKey.CreatedOn.Get(this.Bot.Users[user.Id]).Build(new TVar("Guild", b.CreationPlace))}\n" + $"{CommandKey.CreatedAt.Get(this.Bot.Users[user.Id]).Build(new TVar("Timestamp", $"{b.CreationTime.ToTimestamp()} ({b.CreationTime.ToTimestamp(TimestampFormat.LongDateTime)})"))}\n" + diff --git a/ProjectMakoto/Events/ActionlogEvents.cs b/ProjectMakoto/Events/ActionlogEvents.cs index 28f42e67..c197a037 100644 --- a/ProjectMakoto/Events/ActionlogEvents.cs +++ b/ProjectMakoto/Events/ActionlogEvents.cs @@ -42,7 +42,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) $"{string.Join("\n\n", globalNote.Notes.Select(x => $"{x.Reason.FullSanitize()} - <@{x.Moderator}> {x.Timestamp.ToTimestamp()}"))}".TruncateWithIndication(512))); } - var message = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var message = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); await Task.Delay(5000); @@ -63,7 +63,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (this.Bot.Guilds[e.Guild.Id].InviteNotes.Notes.Any(x => x.Invite == this.Bot.Guilds[e.Guild.Id].Members[e.Member.Id].InviteTracker.Code)) embed.Description += $"**{this.tKey.InviteNote.Get(this.Bot.Guilds[e.Guild.Id])}**: `{this.Bot.Guilds[e.Guild.Id].InviteNotes.Notes.First(x => x.Invite == this.Bot.Guilds[e.Guild.Id].Members[e.Member.Id].InviteTracker.Code).Note.SanitizeForCode()}`"; - _ = message.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = message.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); } internal async Task UserLeft(DiscordClient sender, GuildMemberRemoveEventArgs e) @@ -83,7 +83,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (e.Member.Roles.Any()) _ = embed.AddField(new DiscordEmbedField(this.tKey.Roles.Get(this.Bot.Guilds[e.Guild.Id]).Build(), $"{string.Join(", ", e.Member.Roles.Select(x => x.Mention))}".TruncateWithIndication(1000))); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); for (var i = 0; i < 3; i++) { @@ -106,7 +106,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer = new(); embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.KickedBy.Get(this.Bot.Guilds[e.Guild.Id])}' & '{this.tKey.Reason.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -160,7 +160,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (embed.Fields.Count == 0) return; - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); } internal async Task VoiceStateUpdated(DiscordClient sender, VoiceStateUpdateEventArgs e) @@ -174,7 +174,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (PreviousChannel != NewChannel) if (PreviousChannel is null && NewChannel is not null) { - _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.UserJoinedVoiceChannel.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.VoiceStateUserJoined) .WithThumbnail(e.User.AvatarUrl) .WithColor(EmbedColors.Success) @@ -185,7 +185,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) } else if (PreviousChannel is not null && NewChannel is null) { - _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.UserLeftVoiceChannel.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.VoiceStateUserLeft) .WithThumbnail(e.User.AvatarUrl) .WithColor(EmbedColors.Error) @@ -196,7 +196,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) } else if (PreviousChannel is not null && NewChannel is not null) { - _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.UserSwitchedVoiceChannel.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.VoiceStateUserUpdated) .WithThumbnail(e.User.AvatarUrl) .WithColor(EmbedColors.Warning) @@ -264,7 +264,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) using (var fileStream = new MemoryStream(Encoding.UTF8.GetBytes(Messages))) { - _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed).WithFile(FileName, fileStream) + _ = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed).WithFile(FileName, fileStream) .AddComponents(new DiscordLinkButtonComponent($"{this.Bot.status.LoadedConfig.WebServer.UrlPrefix}/{e.Guild.Id}/DeletedMessages/{FileName}", "Open in Browser", this.Bot.status.LoadedConfig.WebServer.UrlPrefix.IsNullOrWhiteSpace()))); } @@ -311,7 +311,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) return; } - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); } internal async Task MemberUpdated(DiscordClient sender, GuildMemberUpdateEventArgs e) @@ -339,7 +339,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) else _ = embed.AddField(new DiscordEmbedField(this.tKey.NewNickname.Get(this.Bot.Guilds[e.Guild.Id]), $"`{e.NicknameAfter}`")); - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); } var RolesUpdated = false; @@ -427,7 +427,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Description += $"\n\n{Roles}"; - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); } if (e.TimeoutBefore != e.TimeoutAfter) @@ -436,7 +436,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) var timeBefore = (e.TimeoutBefore ?? DateTime.Today.AddDays(-300)).ToUniversalTime(); if (timeAfter > timeBefore) - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.TimedOut.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserBanned) .WithColor(EmbedColors.Error) .WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") @@ -446,7 +446,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) $"**{this.tKey.TimedOutUntil.Get(this.Bot.Guilds[e.Guild.Id])}**: {timeAfter.Timestamp(TimestampFormat.LongDateTime)} ({timeAfter.Timestamp()})"))); if (timeAfter < timeBefore) - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.TimeoutRemoved.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserBanRemoved) .WithColor(EmbedColors.Success) .WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") @@ -460,7 +460,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) try { if ((e.PendingBefore is null && e.PendingAfter is true) || (e.PendingAfter is true && e.PendingBefore is false)) - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.MembershipApproved.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserAdded) .WithColor(EmbedColors.Success) .WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") @@ -478,7 +478,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) //{ // // Normal avatar updates don't seem to fire the member updated event, will keep this code for potential future updates. - // _ = SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + // _ = SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() // { // Author = new DiscordEmbedBuilder.EmbedAuthor { IconUrl = AuditLogIcons.UserUpdated, Name = $"Member Profile Picture updated" }, // Color = EmbedColors.Warning, @@ -492,7 +492,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (e.GuildAvatarHashBefore != e.GuildAvatarHashAfter) { - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.GuildProfilePictureUpdated.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserUpdated) .WithColor(EmbedColors.Warning) .WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") @@ -536,7 +536,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) $"{Integration}" + $"\n**{this.tKey.Permissions.Get(this.Bot.Guilds[e.Guild.Id])}**: {GeneratePermissions}"); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -555,7 +555,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.CreatedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -597,7 +597,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) $"{Integration}\n" + $"\n**{this.tKey.Permissions.Get(this.Bot.Guilds[e.Guild.Id])}**: {GeneratePermissions}"); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -616,7 +616,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.DeletedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -702,7 +702,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) $"{Integration}" + $"{PermissionDifference}"); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -721,7 +721,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.ModifiedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -751,7 +751,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) .TruncateWithIndication(1000))); } - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -772,7 +772,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.BannedBy.Get(this.Bot.Guilds[e.Guild.Id])}' & '{this.tKey.Reason.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -793,7 +793,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) .WithThumbnail(e.Member.AvatarUrl) .WithDescription($"**{this.tKey.User.Get(this.Bot.Guilds[e.Guild.Id])}**: {e.Member.Mention} `{e.Member.GetUsernameWithIdentifier()}`"); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -811,7 +811,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.UnbannedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -927,7 +927,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (e.GuildBefore.IconHash != e.GuildAfter.IconHash) embed.ImageUrl = e.GuildAfter.IconUrl; - var msg = await this.SendActionlog(e.GuildAfter, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.GuildAfter, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.GuildAfter.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -946,7 +946,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer = new(); embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.GuildAfter.Id]).Build(new TVar("Fields", $"'{this.tKey.ModifiedBy.Get(this.Bot.Guilds[e.GuildAfter.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -966,7 +966,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) .WithTimestamp(DateTime.UtcNow) .WithDescription($"**{this.tKey.Name.Get(this.Bot.Guilds[e.Guild.Id])}**: {e.Channel.Mention} `[{e.Channel.GetIcon()}{e.Channel.Name}]`"); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -985,7 +985,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.CreatedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -1005,7 +1005,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) .WithTimestamp(DateTime.UtcNow) .WithDescription($"**{this.tKey.Name.Get(this.Bot.Guilds[e.Guild.Id])}**: `[{e.Channel.GetIcon()}{e.Channel.Name}]`"); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -1024,7 +1024,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.DeletedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -1055,7 +1055,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) .WithTimestamp(DateTime.UtcNow) .WithDescription(Description); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) return; @@ -1074,7 +1074,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.ModifiedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } @@ -1087,7 +1087,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) if (!await this.ValidateServer(e.Guild) || !this.Bot.Guilds[e.Guild.Id].ActionLog.InvitesModified) return; - _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() .WithAuthor(this.tKey.InviteCreated.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.InviteAdded) .WithColor(EmbedColors.Success) .WithTimestamp(DateTime.UtcNow) @@ -1109,7 +1109,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) $"**{this.tKey.CreatedBy.Get(this.Bot.Guilds[e.Guild.Id])}**: {e.Invite.Inviter?.Mention ?? this.tKey.NoInviter.Get(this.Bot.Guilds[e.Guild.Id]).Build(true)} `{e.Invite.Inviter?.GetUsernameWithIdentifier() ?? "-"}`\n" + $"**{this.tKey.Channel.Get(this.Bot.Guilds[e.Guild.Id])}**: {e.Channel.Mention} `[{e.Channel.GetIcon()}{e.Channel.Name}]`"); - var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().WithEmbed(embed)); + var msg = await this.SendActionlog(e.Guild, new DiscordMessageBuilder().AddEmbed(embed)); if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails) @@ -1130,7 +1130,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot) embed.Footer = new(); embed.Footer.Text += $"\n({this.tKey.FooterAuditLogDisclaimer.Get(this.Bot.Guilds[e.Guild.Id]).Build(new TVar("Fields", $"'{this.tKey.DeletedBy.Get(this.Bot.Guilds[e.Guild.Id])}'"))})"; - _ = msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); break; } diff --git a/ProjectMakoto/Events/EmbedMessagesEvents.cs b/ProjectMakoto/Events/EmbedMessagesEvents.cs index fc8aadc2..01bad446 100644 --- a/ProjectMakoto/Events/EmbedMessagesEvents.cs +++ b/ProjectMakoto/Events/EmbedMessagesEvents.cs @@ -55,7 +55,7 @@ internal sealed class EmbedMessagesEvents(Bot bot) : RequiresTranslation(bot) var JumpToMessage = new DiscordLinkButtonComponent(message.JumpLink.ToString(), this.t.Common.JumpToMessage.Get(this.Bot.Guilds[e.Guild.Id]), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); - var msg = await e.Message.RespondAsync(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + var msg = await e.Message.RespondAsync(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Author = new DiscordEmbedBuilder.EmbedAuthor { IconUrl = message.Author.AvatarUrl, Name = $"{message.Author.GetUsernameWithIdentifier()}" }, Color = message.Author.BannerColor ?? EmbedColors.Info, diff --git a/ProjectMakoto/Events/PhishingProtectionEvents.cs b/ProjectMakoto/Events/PhishingProtectionEvents.cs index aa80f9ee..cb78e1b3 100644 --- a/ProjectMakoto/Events/PhishingProtectionEvents.cs +++ b/ProjectMakoto/Events/PhishingProtectionEvents.cs @@ -81,7 +81,7 @@ internal sealed class PhishingProtectionEvents(Bot bot) : RequiresTranslation(bo _ = embed.AddFields(report_fields.Take(2)); - _ = e.RespondAsync(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(new DiscordLinkButtonComponent($"https://www.abuseipdb.com/check/{parsedIp[0]}", this.tKey.OpenInBrowser.Get(this.Bot.Guilds[guild.Id])))); + _ = e.RespondAsync(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(new DiscordLinkButtonComponent($"https://www.abuseipdb.com/check/{parsedIp[0]}", this.tKey.OpenInBrowser.Get(this.Bot.Guilds[guild.Id])))); } } diff --git a/ProjectMakoto/Events/TokenLeakEvents.cs b/ProjectMakoto/Events/TokenLeakEvents.cs index 609634ad..561555ed 100644 --- a/ProjectMakoto/Events/TokenLeakEvents.cs +++ b/ProjectMakoto/Events/TokenLeakEvents.cs @@ -87,7 +87,7 @@ internal sealed class TokenLeakEvents(Bot bot) : RequiresTranslation(bot) var s = (InvalidateCount > 1 ? "s" : ""); - _ = e.Channel.SendMessageAsync(new DiscordMessageBuilder().WithEmbed( + _ = e.Channel.SendMessageAsync(new DiscordMessageBuilder().AddEmbed( new DiscordEmbedBuilder() .WithColor(EmbedColors.Error) .WithAuthor(sender.CurrentUser.GetUsername(), null, sender.CurrentUser.AvatarUrl) diff --git a/ProjectMakoto/Events/VcCreatorEvents.cs b/ProjectMakoto/Events/VcCreatorEvents.cs index a2bd5d76..4242ebdf 100644 --- a/ProjectMakoto/Events/VcCreatorEvents.cs +++ b/ProjectMakoto/Events/VcCreatorEvents.cs @@ -49,7 +49,7 @@ internal sealed class VcCreatorEvents(Bot bot) : RequiresTranslation(bot) _ = await newChannel.SendMessageAsync(new DiscordMessageBuilder() .WithContent(e.User.Mention) - .WithEmbed(new DiscordEmbedBuilder() + .AddEmbed(new DiscordEmbedBuilder() .WithAuthor(e.Guild.Name, "", e.Guild.IconUrl) .WithColor(EmbedColors.Info) .WithTimestamp(DateTime.UtcNow) diff --git a/ProjectMakoto/Util/ExperienceHandler.cs b/ProjectMakoto/Util/ExperienceHandler.cs index 5e6a5426..7f96c9da 100644 --- a/ProjectMakoto/Util/ExperienceHandler.cs +++ b/ProjectMakoto/Util/ExperienceHandler.cs @@ -173,7 +173,7 @@ internal sealed class ExperienceHandler : RequiresTranslation this.Bot.Users[user.Id].ExperienceUser.DirectMessageOptOut = true; - _ = await msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); _ = await (await user.CreateDmChannelAsync()).SendMessageAsync(this.tKey.AutomaticDeletion.Get(this.Bot.Users[user.Id]).Build( new TVar("Command", "`/levelrewards-optin`"), @@ -187,7 +187,7 @@ internal sealed class ExperienceHandler : RequiresTranslation { new DiscordButtonComponent(ButtonStyle.Secondary, "opt-out-experience-dm", this.tKey.DisableDirectMessages.Get(this.Bot.Users[user.Id]), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⛔"))) }, }; - msg = await (await user.CreateDmChannelAsync()).SendMessageAsync(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(discordComponents)); + msg = await (await user.CreateDmChannelAsync()).SendMessageAsync(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(discordComponents)); this.Bot.DiscordClient.ComponentInteractionCreated += RunInteraction; @@ -195,7 +195,7 @@ internal sealed class ExperienceHandler : RequiresTranslation { await Task.Delay(3600000); embed.Footer.Text += $" • {this.t.Commands.Common.InteractionTimeout.Get(this.Bot.Users[user.Id])}"; - _ = await msg.ModifyAsync(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await msg.ModifyAsync(new DiscordMessageBuilder().AddEmbed(embed)); this.Bot.DiscordClient.ComponentInteractionCreated -= RunInteraction; } diff --git a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs index 62d7ad01..8679a28a 100644 --- a/ProjectMakoto/Util/Extensions/DiscordExtensions.cs +++ b/ProjectMakoto/Util/Extensions/DiscordExtensions.cs @@ -15,9 +15,6 @@ public static class DiscordExtensions { private static string? LoadedHtml = null; - public static DiscordMessageBuilder WithEmbed(this DiscordMessageBuilder builder, DiscordEmbed embed) - => builder.AddEmbed(embed); - public static IReadOnlyDictionary GetGuilds(this DiscordShardedClient client) { var Guilds = new Dictionary(); From 6f1155c8c44970786b290fb40b0fea144808ea00 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Mon, 7 Apr 2025 21:38:46 +0200 Subject: [PATCH 50/61] chore: Disable dcs updates --- renovate.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index 58258968..441aa147 100644 --- a/renovate.json +++ b/renovate.json @@ -11,7 +11,8 @@ "excludePackagePatterns": [ "Extensions" ], "matchPackagePrefixes": [ "DisCatSharp" ], "groupName": "discatsharp", - "automerge": true + "automerge": false, + "enabled": false }, { "managers": ["github-actions"], From bbb9935205085186b2e893c27d37e63015bdbb1c Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 00:14:50 +0200 Subject: [PATCH 51/61] fix: Fix duplicate sync task calls on startup --- Dependencies/Xorog.UniversalExtensions | 2 +- ProjectMakoto/Util/Initializers/SyncTasks.cs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dependencies/Xorog.UniversalExtensions b/Dependencies/Xorog.UniversalExtensions index dadeb77e..8504368d 160000 --- a/Dependencies/Xorog.UniversalExtensions +++ b/Dependencies/Xorog.UniversalExtensions @@ -1 +1 @@ -Subproject commit dadeb77e1667b6785ee8368eb92b2bbe1efba06e +Subproject commit 8504368d352bd76e4486f6f3291936c0ae61ad0b diff --git a/ProjectMakoto/Util/Initializers/SyncTasks.cs b/ProjectMakoto/Util/Initializers/SyncTasks.cs index fa19c480..46419ba7 100644 --- a/ProjectMakoto/Util/Initializers/SyncTasks.cs +++ b/ProjectMakoto/Util/Initializers/SyncTasks.cs @@ -14,10 +14,13 @@ internal static class SyncTasks { internal static async Task GuildDownloadCompleted(Bot bot, DiscordClient sender, GuildDownloadCompletedEventArgs e) { + if (bot.status.DiscordGuildDownloadCompleted) + return; + + bot.status.DiscordGuildDownloadCompleted = true; + _ = Task.Run(async () => { - bot.status.DiscordGuildDownloadCompleted = true; - Log.Information("I'm on {GuildsCount} guilds.", e.Guilds.Count); _ = Task.Run(async () => @@ -121,8 +124,14 @@ internal static class SyncTasks }).Add(bot); } + internal static DateTime lastSyncTaskTime = DateTime.MinValue; internal static async Task ExecuteSyncTasks(Bot bot, DiscordShardedClient shardedClient) { + if (lastSyncTaskTime.GetTimespanSince() < TimeSpan.FromSeconds(30)) + return; + + lastSyncTaskTime = DateTime.UtcNow; + var Guilds = shardedClient.GetGuilds(); ObservableList runningTasks = new(); From 833b1c79f9709436d50b95521e7bec9594c1d7b2 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 00:16:37 +0200 Subject: [PATCH 52/61] chore: Update deps --- ProjectMakoto/ProjectMakoto.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ProjectMakoto/ProjectMakoto.csproj b/ProjectMakoto/ProjectMakoto.csproj index 2abc5844..c0695446 100644 --- a/ProjectMakoto/ProjectMakoto.csproj +++ b/ProjectMakoto/ProjectMakoto.csproj @@ -44,23 +44,23 @@ - + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + From 254375e71dc0a07b3bd9701734bfe5f44c16d66b Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 00:36:00 +0200 Subject: [PATCH 53/61] fix: Update quickchart-csharp --- Dependencies/quickchart-csharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/quickchart-csharp b/Dependencies/quickchart-csharp index 92a231e7..0b60f2e3 160000 --- a/Dependencies/quickchart-csharp +++ b/Dependencies/quickchart-csharp @@ -1 +1 @@ -Subproject commit 92a231e7c7a0baa38b09d56bcc4c66c8b2d50cf6 +Subproject commit 0b60f2e32db9d79dcc45311ee77b38b7a32ef776 From 7698e14c3ef32513ea9e0e534954baf6255edf8b Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 00:45:28 +0200 Subject: [PATCH 54/61] fix: build now? --- Dependencies/Xorog.UniversalExtensions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/Xorog.UniversalExtensions b/Dependencies/Xorog.UniversalExtensions index 8504368d..cc41bea5 160000 --- a/Dependencies/Xorog.UniversalExtensions +++ b/Dependencies/Xorog.UniversalExtensions @@ -1 +1 @@ -Subproject commit 8504368d352bd76e4486f6f3291936c0ae61ad0b +Subproject commit cc41bea57617e81f116fbbae6e7de2f8d9ca3991 From 1c3aa23a76e174947a83162d72eade1e35d85ae4 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 18:48:06 +0200 Subject: [PATCH 55/61] fix: Delete old deleted message logs (they stay uploaded to discord) --- ProjectMakoto/Bot.cs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/ProjectMakoto/Bot.cs b/ProjectMakoto/Bot.cs index 9dcf4ae0..2883d695 100644 --- a/ProjectMakoto/Bot.cs +++ b/ProjectMakoto/Bot.cs @@ -334,6 +334,7 @@ public sealed class Bot } }); + _ = this.CleanupOldPrunedMessages().Add(this); _ = this.ProcessDeletionRequests().Add(this); }).Add(this).IsVital(); @@ -522,6 +523,42 @@ public sealed class Bot Environment.FailFast("Failed to exit"); } + private async Task CleanupOldPrunedMessages() + { + _ = new Func(async () => + { + _ = this.CleanupOldPrunedMessages().Add(this); + }).CreateScheduledTask(DateTime.UtcNow.AddHours(24)); + + foreach (var guildDirectory in Directory.GetDirectories("WebServer").Select(x => new DirectoryInfo(x))) + { + if (guildDirectory.GetDirectories().Any(x => x.Name.Equals("DeletedMessages", StringComparison.CurrentCultureIgnoreCase))) + { + var deletedMessagesDirectory = guildDirectory.GetDirectories().First(x => x.Name.Equals("DeletedMessages", StringComparison.CurrentCultureIgnoreCase)); + foreach (var deletedMessageFile in deletedMessagesDirectory.GetFiles()) + { + if (deletedMessageFile.LastWriteTimeUtc.GetTimespanSince() > TimeSpan.FromDays(30)) + { + Log.Information("Deleting '{File}'..", deletedMessageFile.FullName); + deletedMessageFile.Delete(); + } + } + + if (deletedMessagesDirectory.GetFiles().Length == 0) + { + Log.Information("Deleting '{File}'..", deletedMessagesDirectory.FullName); + deletedMessagesDirectory.Delete(); + } + } + + if (guildDirectory.GetFiles().Length == 0 && guildDirectory.GetDirectories().Length == 0) + { + Log.Information("Deleting '{File}'..", guildDirectory.FullName); + guildDirectory.Delete(); + } + } + } + private async Task ProcessDeletionRequests() { _ = new Func(async () => From 50c60bf0dac1d0a7f4556f5dcad420c2c9dcc20a Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 19:49:03 +0200 Subject: [PATCH 56/61] feat: User Count Channel --- .../Commands/Configuration/JoinCommand.cs | 85 ++++++++++++++++++- ProjectMakoto/Entities/Guilds/JoinSettings.cs | 21 +++++ .../Entities/Translation/Translations.cs | 6 ++ ProjectMakoto/Events/JoinEvents.cs | 35 ++++++++ ProjectMakoto/Translations/strings.json | 24 ++++++ 5 files changed, 170 insertions(+), 1 deletion(-) diff --git a/ProjectMakoto/Commands/Configuration/JoinCommand.cs b/ProjectMakoto/Commands/Configuration/JoinCommand.cs index 24606e26..d04b1ff5 100644 --- a/ProjectMakoto/Commands/Configuration/JoinCommand.cs +++ b/ProjectMakoto/Commands/Configuration/JoinCommand.cs @@ -26,6 +26,8 @@ internal sealed class JoinCommand : BaseCommand var pad = TranslationUtil.CalculatePadding(ctx.DbUser, CommandKey.Autoban, CommandKey.JoinLogChannel, + CommandKey.UserCountChannel, + CommandKey.UserCountChannelFormat, CommandKey.Role, CommandKey.ReApplyRoles, CommandKey.ReApplyNickname, @@ -35,6 +37,7 @@ internal sealed class JoinCommand : BaseCommand return $"{"🌐".UnicodeToEmoji()} `{CommandKey.Autoban.Get(ctx.DbUser).PadRight(pad)}`: {ctx.DbGuild.Join.AutoBanGlobalBans.ToEmote(ctx.Bot)}\n" + $"{"👋".UnicodeToEmoji()} `{CommandKey.JoinLogChannel.Get(ctx.DbUser).PadRight(pad)}`: {(ctx.DbGuild.Join.JoinlogChannelId != 0 ? $"<#{ctx.DbGuild.Join.JoinlogChannelId}>" : false.ToEmote(ctx.Bot))}\n" + + $"{"🔢".UnicodeToEmoji()} `{CommandKey.UserCountChannel.Get(ctx.DbUser).PadRight(pad)}`: {(ctx.DbGuild.Join.UserCountChannelId != 0 ? $"<#{ctx.DbGuild.Join.UserCountChannelId}> (`{(ctx.DbGuild.Join.UserCountChannelFormat is not null ? ctx.DbGuild.Join.UserCountChannelFormat : "Users: %s")}`)" : false.ToEmote(ctx.Bot))}\n" + $"{"👤".UnicodeToEmoji()} `{CommandKey.Role.Get(ctx.DbUser).PadRight(pad)}`: {(ctx.DbGuild.Join.AutoAssignRoleId != 0 ? $"<@&{ctx.DbGuild.Join.AutoAssignRoleId}>" : false.ToEmote(ctx.Bot))}\n" + $"{"👥".UnicodeToEmoji()} `{CommandKey.ReApplyRoles.Get(ctx.DbUser).PadRight(pad)}`: {ctx.DbGuild.Join.ReApplyRoles.ToEmote(ctx.Bot)}\n" + $"{"💬".UnicodeToEmoji()} `{CommandKey.ReApplyNickname.Get(ctx.DbUser).PadRight(pad)}`: {ctx.DbGuild.Join.ReApplyNickname.ToEmote(ctx.Bot)}\n\n" + @@ -57,6 +60,8 @@ internal sealed class JoinCommand : BaseCommand var ToggleGlobalban = new DiscordButtonComponent((ctx.DbGuild.Join.AutoBanGlobalBans ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleGlobalBansButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🌐"))); var ChangeJoinlogChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeJoinlogChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👋"))); + var ChangeUserCountChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeUserCountChannel), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔢"))); + var ChangeUserCountFormat = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeUserCountChannelFormat), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔢"))); var ChangeRoleOnJoin = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeRoleButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👤"))); var ToggleReApplyRoles = new DiscordButtonComponent((ctx.DbGuild.Join.ReApplyRoles ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleReApplyRole), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👥"))); var ToggleReApplyName = new DiscordButtonComponent((ctx.DbGuild.Join.ReApplyNickname ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleReApplyNickname), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); @@ -76,6 +81,8 @@ internal sealed class JoinCommand : BaseCommand { ChangeJoinlogChannel, ChangeRoleOnJoin, + ChangeUserCountChannel, + ChangeUserCountFormat, }) .AddComponents(new List { @@ -93,7 +100,8 @@ internal sealed class JoinCommand : BaseCommand return; } - _ = e.Result.Interaction.CreateResponseAsync(InteractionResponseType.DeferredMessageUpdate); + if (e.GetCustomId() != ChangeUserCountFormat.CustomId) + _ = e.Result.Interaction.CreateResponseAsync(InteractionResponseType.DeferredMessageUpdate); if (e.GetCustomId() == ToggleGlobalban.CustomId) { @@ -156,6 +164,81 @@ internal sealed class JoinCommand : BaseCommand await this.ExecuteCommand(ctx, arguments); return; } + else if (e.GetCustomId() == ChangeUserCountChannel.CustomId) + { + var ChannelResult = await this.PromptChannelSelection(ChannelType.Text, new ChannelPromptConfiguration + { + CreateChannelOption = new() + { + Name = "tmp-usercount", + ChannelType = ChannelType.Text + }, + DisableOption = this.GetString(CommandKey.DisableUserCountChannel) + }); + + if (ChannelResult.TimedOut) + { + this.ModifyToTimedOut(true); + return; + } + else if (ChannelResult.Cancelled) + { + await this.ExecuteCommand(ctx, arguments); + return; + } + else if (ChannelResult.Failed) + { + if (ChannelResult.Exception.GetType() == typeof(NullReferenceException)) + { + _ = await this.RespondOrEdit(new DiscordEmbedBuilder().AsError(ctx).WithDescription(this.GetString(this.t.Commands.Common.Errors.NoChannels))); + await Task.Delay(3000); + await this.ExecuteCommand(ctx, arguments); + return; + } + + throw ChannelResult.Exception; + } + + ctx.DbGuild.Join.UserCountChannelId = ChannelResult.Result is null ? 0 : ChannelResult.Result.Id; + + await this.ExecuteCommand(ctx, arguments); + return; + } + else if (e.GetCustomId() == ChangeUserCountFormat.CustomId) + { + var modelResult = await this.PromptModalWithRetry(e.Result.Interaction, + new DiscordInteractionModalBuilder(this.GetString(CommandKey.ChangeUserCountChannelFormat)) + .AddTextComponent(new DiscordTextComponent(TextComponentStyle.Small, "new_format", this.GetString(CommandKey.ChangeUserCountChannelFormatModal), null, 2, 16)), + false); + + if (modelResult.TimedOut) + { + this.ModifyToTimedOut(true); + return; + } + else if (modelResult.Cancelled) + { + await this.ExecuteCommand(ctx, arguments); + return; + } + else if (modelResult.Failed) + { + if (modelResult.Exception.GetType() == typeof(NullReferenceException)) + { + _ = await this.RespondOrEdit(new DiscordEmbedBuilder().AsError(ctx).WithDescription(this.GetString(this.t.Commands.Common.Errors.NoChannels))); + await Task.Delay(3000); + await this.ExecuteCommand(ctx, arguments); + return; + } + + throw modelResult.Exception; + } + + ctx.DbGuild.Join.UserCountChannelFormat = modelResult.Result.Interaction.GetModalValueByCustomId("new_format"); + + await this.ExecuteCommand(ctx, arguments); + return; + } else if (e.GetCustomId() == ChangeRoleOnJoin.CustomId) { var RoleResult = await this.PromptRoleSelection(new RolePromptConfiguration { CreateRoleOption = this.GetString(CommandKey.AutoAssignRoleName), DisableOption = this.GetString(CommandKey.DisableRoleOnJoin) }); diff --git a/ProjectMakoto/Entities/Guilds/JoinSettings.cs b/ProjectMakoto/Entities/Guilds/JoinSettings.cs index f58c9d9a..925aee97 100644 --- a/ProjectMakoto/Entities/Guilds/JoinSettings.cs +++ b/ProjectMakoto/Entities/Guilds/JoinSettings.cs @@ -24,6 +24,27 @@ public sealed class JoinSettings(Bot bot, Guild parent) : RequiresParent( get => this.Bot.DatabaseClient.GetValue("guilds", "serverid", this.Parent.Id, "joinlog_channel_id", this.Bot.DatabaseClient.mainDatabaseConnection); set => _ = this.Bot.DatabaseClient.SetValue("guilds", "serverid", this.Parent.Id, "joinlog_channel_id", value, this.Bot.DatabaseClient.mainDatabaseConnection); } + + [ColumnName("usercount_channel_last_edit"), ColumnType(ColumnTypes.BigInt), Default("0")] + public DateTime UserCountChannelLastEdit + { + get => this.Bot.DatabaseClient.GetValue("guilds", "serverid", this.Parent.Id, "usercount_channel_last_edit", this.Bot.DatabaseClient.mainDatabaseConnection); + set => _ = this.Bot.DatabaseClient.SetValue("guilds", "serverid", this.Parent.Id, "usercount_channel_last_edit", value, this.Bot.DatabaseClient.mainDatabaseConnection); + } + + [ColumnName("usercount_channel_id"), ColumnType(ColumnTypes.BigInt), Default("0")] + public ulong UserCountChannelId + { + get => this.Bot.DatabaseClient.GetValue("guilds", "serverid", this.Parent.Id, "usercount_channel_id", this.Bot.DatabaseClient.mainDatabaseConnection); + set => _ = this.Bot.DatabaseClient.SetValue("guilds", "serverid", this.Parent.Id, "usercount_channel_id", value, this.Bot.DatabaseClient.mainDatabaseConnection); + } + + [ColumnName("usercount_channel_format"), ColumnType(ColumnTypes.Text), Nullable] + public string? UserCountChannelFormat + { + get => this.Bot.DatabaseClient.GetValue("guilds", "serverid", this.Parent.Id, "usercount_channel_format", this.Bot.DatabaseClient.mainDatabaseConnection); + set => _ = this.Bot.DatabaseClient.SetValue("guilds", "serverid", this.Parent.Id, "usercount_channel_format", value, this.Bot.DatabaseClient.mainDatabaseConnection); + } [ColumnName("autoban_global_ban"), ColumnType(ColumnTypes.TinyInt), Default("0")] public bool AutoBanGlobalBans diff --git a/ProjectMakoto/Entities/Translation/Translations.cs b/ProjectMakoto/Entities/Translation/Translations.cs index 0bfc5e2a..186fbf5e 100644 --- a/ProjectMakoto/Entities/Translation/Translations.cs +++ b/ProjectMakoto/Entities/Translation/Translations.cs @@ -380,11 +380,15 @@ public class Translations : ITranslations public SingleTranslationKey CantUseRole; public SingleTranslationKey DisableRoleOnJoin; public SingleTranslationKey AutoAssignRoleName; + public SingleTranslationKey DisableUserCountChannel; public SingleTranslationKey DisableJoinlog; public SingleTranslationKey JoinLogChannelName; public SingleTranslationKey ToggleReApplyNickname; public SingleTranslationKey ToggleReApplyRole; public SingleTranslationKey ChangeRoleButton; + public SingleTranslationKey ChangeUserCountChannelFormatModal; + public SingleTranslationKey ChangeUserCountChannelFormat; + public SingleTranslationKey ChangeUserCountChannel; public SingleTranslationKey ChangeJoinlogChannelButton; public SingleTranslationKey ToggleGlobalBansButton; public SingleTranslationKey TimeNotice; @@ -392,6 +396,8 @@ public class Translations : ITranslations public SingleTranslationKey ReApplyNickname; public SingleTranslationKey ReApplyRoles; public SingleTranslationKey Role; + public SingleTranslationKey UserCountChannelFormat; + public SingleTranslationKey UserCountChannel; public SingleTranslationKey JoinLogChannel; public SingleTranslationKey Autoban; public SingleTranslationKey Title; diff --git a/ProjectMakoto/Events/JoinEvents.cs b/ProjectMakoto/Events/JoinEvents.cs index 29e90c85..4034eeca 100644 --- a/ProjectMakoto/Events/JoinEvents.cs +++ b/ProjectMakoto/Events/JoinEvents.cs @@ -54,6 +54,7 @@ internal sealed class JoinEvents(Bot bot) : RequiresTranslation(bot) } } + await this.RunUserCountUpdater(e.Guild); await this.Bot.Guilds[e.Guild.Id].Members[e.Member.Id].PerformAutoKickChecks(e.Guild, e.Member); } @@ -81,5 +82,39 @@ internal sealed class JoinEvents(Bot bot) : RequiresTranslation(bot) }); } } + + await this.RunUserCountUpdater(e.Guild); + } + + private async Task RunUserCountUpdater(DiscordGuild Guild) + { + if (this.Bot.Guilds[Guild.Id].Join.UserCountChannelId != 0) + { + if (Guild.Channels.ContainsKey(this.Bot.Guilds[Guild.Id].Join.UserCountChannelId)) + { + foreach (var b in ScheduledTaskExtensions.GetScheduledTasks()) + { + if (b.CustomData is not ScheduledTaskIdentifier scheduledTaskIdentifier) + continue; + + if (scheduledTaskIdentifier.Snowflake == Guild.Id && scheduledTaskIdentifier.Type == "usercount") + b.Delete(); + } + + _ = new Func(async () => + { + _ = Guild.GetChannel(this.Bot.Guilds[Guild.Id].Join.UserCountChannelId).ModifyAsync(x => + { + x.Name = (this.Bot.Guilds[Guild.Id].Join.UserCountChannelFormat is null ? "Count: %s" : this.Bot.Guilds[Guild.Id].Join.UserCountChannelFormat) + .Replace("%s", Guild.MemberCount); + }) + .ContinueWith(x => + { + this.Bot.Guilds[Guild.Id].Join.UserCountChannelLastEdit = DateTime.UtcNow; + }); + }).CreateScheduledTask(this.Bot.Guilds[Guild.Id].Join.UserCountChannelLastEdit.AddMinutes(5), + new ScheduledTaskIdentifier(Guild.Id, "", "usercount")); + } + } } } diff --git a/ProjectMakoto/Translations/strings.json b/ProjectMakoto/Translations/strings.json index 63f43207..5f7a1544 100644 --- a/ProjectMakoto/Translations/strings.json +++ b/ProjectMakoto/Translations/strings.json @@ -3780,6 +3780,14 @@ "en": "Joinlog Channel", "de": "Beitrittsprotokoll-Kanal" }, + "UserCountChannel": { + "en": "User Count Channel", + "de": "Benutzeranzahl-Kanal" + }, + "UserCountChannelFormat": { + "en": "User Count Format", + "de": "Benutzeranzahl-Format" + }, "Role": { "en": "Role On Join", "de": "Rolle beim Beitritt" @@ -3808,6 +3816,18 @@ "en": "Change Joinlog Channel", "de": "Beitrittsprotokoll-Kanal ändern" }, + "ChangeUserCountChannel": { + "en": "Change User Count Channel", + "de": "Benutzeranzahl-Kanal ändern" + }, + "ChangeUserCountChannelFormat": { + "en": "Change User Count Format", + "de": "Benutzeranzahl-Format ändern" + }, + "ChangeUserCountChannelFormatModal": { + "en": "User Count Format | %s as placeholder", + "de": "Benutzeranzahl-Format | %s für Platzhalter" + }, "ChangeRoleButton": { "en": "Change Role assigned on join", "de": "Beim Beitritt zugewiesene Rolle ändern" @@ -3828,6 +3848,10 @@ "en": "Disable Joinlog", "de": "Beitrittsprotokoll deaktivieren" }, + "DisableUserCountChannel": { + "en": "Disable User Count Channel", + "de": "Benutzeranzahl-Kanal deaktivieren" + }, "AutoAssignRoleName": { "en": "Automatically Assigned Role", "de": "Automatisch zugewiesene Rolle" From 4f0bc4f6ad7bf7573b57c302c3f4577ee8c5efaa Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 20:15:26 +0200 Subject: [PATCH 57/61] fix: fix minor issues --- .../Commands/Configuration/JoinCommand.cs | 8 +++++++- ProjectMakoto/Events/JoinEvents.cs | 18 +++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ProjectMakoto/Commands/Configuration/JoinCommand.cs b/ProjectMakoto/Commands/Configuration/JoinCommand.cs index d04b1ff5..61c9f6a2 100644 --- a/ProjectMakoto/Commands/Configuration/JoinCommand.cs +++ b/ProjectMakoto/Commands/Configuration/JoinCommand.cs @@ -61,7 +61,7 @@ internal sealed class JoinCommand : BaseCommand var ToggleGlobalban = new DiscordButtonComponent((ctx.DbGuild.Join.AutoBanGlobalBans ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleGlobalBansButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🌐"))); var ChangeJoinlogChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeJoinlogChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👋"))); var ChangeUserCountChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeUserCountChannel), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔢"))); - var ChangeUserCountFormat = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeUserCountChannelFormat), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔢"))); + var ChangeUserCountFormat = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeUserCountChannelFormat), ctx.DbGuild.Join.UserCountChannelId == 0, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔢"))); var ChangeRoleOnJoin = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeRoleButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👤"))); var ToggleReApplyRoles = new DiscordButtonComponent((ctx.DbGuild.Join.ReApplyRoles ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleReApplyRole), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👥"))); var ToggleReApplyName = new DiscordButtonComponent((ctx.DbGuild.Join.ReApplyNickname ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleReApplyNickname), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("💬"))); @@ -201,6 +201,9 @@ internal sealed class JoinCommand : BaseCommand ctx.DbGuild.Join.UserCountChannelId = ChannelResult.Result is null ? 0 : ChannelResult.Result.Id; + if (ChannelResult.Result is not null) + await JoinEvents.RunUserCountUpdater(ctx.Bot, ctx.Guild); + await this.ExecuteCommand(ctx, arguments); return; } @@ -236,6 +239,9 @@ internal sealed class JoinCommand : BaseCommand ctx.DbGuild.Join.UserCountChannelFormat = modelResult.Result.Interaction.GetModalValueByCustomId("new_format"); + if (ctx.DbGuild.Join.UserCountChannelId != 0) + await JoinEvents.RunUserCountUpdater(ctx.Bot, ctx.Guild); + await this.ExecuteCommand(ctx, arguments); return; } diff --git a/ProjectMakoto/Events/JoinEvents.cs b/ProjectMakoto/Events/JoinEvents.cs index 4034eeca..584bb9b8 100644 --- a/ProjectMakoto/Events/JoinEvents.cs +++ b/ProjectMakoto/Events/JoinEvents.cs @@ -54,7 +54,7 @@ internal sealed class JoinEvents(Bot bot) : RequiresTranslation(bot) } } - await this.RunUserCountUpdater(e.Guild); + await RunUserCountUpdater(this.Bot, e.Guild); await this.Bot.Guilds[e.Guild.Id].Members[e.Member.Id].PerformAutoKickChecks(e.Guild, e.Member); } @@ -83,14 +83,14 @@ internal sealed class JoinEvents(Bot bot) : RequiresTranslation(bot) } } - await this.RunUserCountUpdater(e.Guild); + await RunUserCountUpdater(this.Bot, e.Guild); } - private async Task RunUserCountUpdater(DiscordGuild Guild) + internal static async Task RunUserCountUpdater(Bot bot, DiscordGuild Guild) { - if (this.Bot.Guilds[Guild.Id].Join.UserCountChannelId != 0) + if (bot.Guilds[Guild.Id].Join.UserCountChannelId != 0) { - if (Guild.Channels.ContainsKey(this.Bot.Guilds[Guild.Id].Join.UserCountChannelId)) + if (Guild.Channels.ContainsKey(bot.Guilds[Guild.Id].Join.UserCountChannelId)) { foreach (var b in ScheduledTaskExtensions.GetScheduledTasks()) { @@ -103,16 +103,16 @@ internal sealed class JoinEvents(Bot bot) : RequiresTranslation(bot) _ = new Func(async () => { - _ = Guild.GetChannel(this.Bot.Guilds[Guild.Id].Join.UserCountChannelId).ModifyAsync(x => + _ = Guild.GetChannel(bot.Guilds[Guild.Id].Join.UserCountChannelId).ModifyAsync(x => { - x.Name = (this.Bot.Guilds[Guild.Id].Join.UserCountChannelFormat is null ? "Count: %s" : this.Bot.Guilds[Guild.Id].Join.UserCountChannelFormat) + x.Name = (bot.Guilds[Guild.Id].Join.UserCountChannelFormat is null ? "Count: %s" : bot.Guilds[Guild.Id].Join.UserCountChannelFormat) .Replace("%s", Guild.MemberCount); }) .ContinueWith(x => { - this.Bot.Guilds[Guild.Id].Join.UserCountChannelLastEdit = DateTime.UtcNow; + bot.Guilds[Guild.Id].Join.UserCountChannelLastEdit = DateTime.UtcNow; }); - }).CreateScheduledTask(this.Bot.Guilds[Guild.Id].Join.UserCountChannelLastEdit.AddMinutes(5), + }).CreateScheduledTask(bot.Guilds[Guild.Id].Join.UserCountChannelLastEdit.AddMinutes(5), new ScheduledTaskIdentifier(Guild.Id, "", "usercount")); } } From 4cb76d7a9d7356030f486d55fc0c55e2594cddaa Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 20:18:39 +0200 Subject: [PATCH 58/61] fix: nre --- ProjectMakoto/Commands/Utility/LeaderboardCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs b/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs index 471af074..7bfb424c 100644 --- a/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs +++ b/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs @@ -14,7 +14,7 @@ internal sealed class LeaderboardCommand : BaseCommand { return Task.Run(async () => { - var ShowAmount = (int)arguments["amount"]; + var ShowAmount = arguments.ContainsKey("arguments") ? (int)arguments["amount"] : 10; if (await ctx.DbUser.Cooldown.WaitForModerate(ctx)) return; From 5901c9a13d4ce6b0bc051950412d1aeeb3816af8 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Wed, 7 May 2025 20:19:10 +0200 Subject: [PATCH 59/61] fix: im tired --- ProjectMakoto/Commands/Utility/LeaderboardCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs b/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs index 7bfb424c..a6dae3ec 100644 --- a/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs +++ b/ProjectMakoto/Commands/Utility/LeaderboardCommand.cs @@ -14,7 +14,7 @@ internal sealed class LeaderboardCommand : BaseCommand { return Task.Run(async () => { - var ShowAmount = arguments.ContainsKey("arguments") ? (int)arguments["amount"] : 10; + var ShowAmount = arguments.ContainsKey("amount") ? (int)arguments["amount"] : 10; if (await ctx.DbUser.Cooldown.WaitForModerate(ctx)) return; From 6cd828ac4f986f56cce966d18438c684083636c6 Mon Sep 17 00:00:00 2001 From: Mira Date: Sat, 17 May 2025 14:23:01 +0200 Subject: [PATCH 60/61] [ci skip] Update README.md Signed-off-by: Mira --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index ed2d2999..187fab65 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@

Makoto

A feature packed discord bot!

-

@@ -45,7 +44,7 @@ Makoto has a lot of features, current notable features are:

## Getting Makoto -## [Click here to invite the bot](https://discord.com/api/oauth2/authorize?client_id=947716263394824213&permissions=8&scope=bot%20applications.commands) +## The bot is no longer publicly available. Feel free to host it yourself. - Phishing Protection is enabled by default, people will be banned if they send a link known to be malicious. To change this, run `/config phishing`. - Automatic User/Bot Token invalidation is turned on by default. If you don't know what this means, just leave it on. If you know what this means and you don't want this happen, run `/config tokendetection` to disable it. From b1047bb3c24f8b70eb648fe9f5e8c61befb13643 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 22:58:38 +0000 Subject: [PATCH 61/61] chore(deps): update ncipollo/release-action action to v1.20.0 --- .github/workflows/main.yml | 2 +- .github/workflows/preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99f8f981..3ee52321 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: - name: Create Release if: ${{ !github.event.act }} # skip during local actions testing - uses: ncipollo/release-action@v1.14.0 + uses: ncipollo/release-action@v1.20.0 with: artifacts: "ProjectMakoto/ProjectMakoto/Release.zip" generateReleaseNotes: true diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 175be6a7..9e63fd36 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -135,7 +135,7 @@ jobs: - name: Create Release if: ${{ !github.event.act }} # skip during local actions testing - uses: ncipollo/release-action@v1.14.0 + uses: ncipollo/release-action@v1.20.0 with: artifacts: "ProjectMakotoPreview/ProjectMakoto/Release.zip" generateReleaseNotes: true