refactor: Downgrade to stable & use AddEmbed over WithEmbed

This commit is contained in:
Mira 2025-04-07 21:36:42 +02:00
parent 4705cb5f26
commit 2e73d66dc2
Signed by untrusted user who does not match committer: Xorog
GPG key ID: 983798ED9C3E7C36
53 changed files with 190 additions and 179 deletions

@ -1 +1 @@
Subproject commit ff567821ed3e10c6918bf8a65bf8372af7e677dc Subproject commit 5f4f5c46f808fd2199a6cc8b6b9dabaa646b5d86

@ -1 +1 @@
Subproject commit 5ca2978d0b99f5f52eaa41b9822b908bf35e268f Subproject commit 2ca985d24861f56feccc901357283dacc72182bf

@ -1 +1 @@
Subproject commit 26d7d34d752cbfdd618fff9311e636bb6e2a4931 Subproject commit f2b6f1aaa49060e0592986d93ef45694dc157f4f

@ -1 +1 @@
Subproject commit 4e795fddc75a59f2512243f59c02de3d0823cdd2 Subproject commit 3bb0c0e17764905e8931346e7a5a3526a0441b7c

@ -1 +1 @@
Subproject commit ea04fd278535c33a3b78d056adf6c25a5cb687bc Subproject commit 0e28d28f051edb2e7cfb9699d2d12f3dd49fac78

View file

@ -13,7 +13,7 @@ for /d /r %%i in (*deps*) do (
cd /d "%original_dir%" cd /d "%original_dir%"
git submodule update --init --depth 0 REM git submodule update --init --depth 0
for /D %%i in (*) do ( for /D %%i in (*) do (
if /I "%%i" neq "deps" ( if /I "%%i" neq "deps" (

View file

@ -253,10 +253,10 @@ public abstract class BaseCommand
#region RespondOrEdit #region RespondOrEdit
public Task<DiscordMessage> RespondOrEdit(DiscordEmbed embed) public Task<DiscordMessage> RespondOrEdit(DiscordEmbed embed)
=> this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); => this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed));
public Task<DiscordMessage> RespondOrEdit(DiscordEmbedBuilder embed) public Task<DiscordMessage> RespondOrEdit(DiscordEmbedBuilder embed)
=> this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.Build())); => this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.Build()));
public Task<DiscordMessage> RespondOrEdit(string content) public Task<DiscordMessage> RespondOrEdit(string content)
=> this.RespondOrEdit(new DiscordMessageBuilder().WithContent(content)); => this.RespondOrEdit(new DiscordMessageBuilder().WithContent(content));
@ -274,7 +274,9 @@ public abstract class BaseCommand
foreach (var b in discordMessageBuilder.Files) foreach (var b in discordMessageBuilder.Files)
files.Add(b.Filename, b.Stream); files.Add(b.Filename, b.Stream);
if (discordMessageBuilder.Components.IsNotNullAndNotEmpty())
_ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components);
_ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds); _ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds);
_ = discordWebhookBuilder.AddFiles(files); _ = discordWebhookBuilder.AddFiles(files);
discordWebhookBuilder.Content = discordMessageBuilder.Content; discordWebhookBuilder.Content = discordMessageBuilder.Content;
@ -293,7 +295,9 @@ public abstract class BaseCommand
foreach (var b in discordMessageBuilder.Files) foreach (var b in discordMessageBuilder.Files)
files.Add(b.Filename, b.Stream); files.Add(b.Filename, b.Stream);
if (discordMessageBuilder.Components.IsNotNullAndNotEmpty())
_ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components);
_ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds); _ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds);
_ = discordWebhookBuilder.AddFiles(files); _ = discordWebhookBuilder.AddFiles(files);
discordWebhookBuilder.Content = discordMessageBuilder.Content; discordWebhookBuilder.Content = discordMessageBuilder.Content;
@ -312,7 +316,9 @@ public abstract class BaseCommand
foreach (var b in discordMessageBuilder.Files) foreach (var b in discordMessageBuilder.Files)
files.Add(b.Filename, b.Stream); files.Add(b.Filename, b.Stream);
if (discordMessageBuilder.Components.IsNotNullAndNotEmpty())
_ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components); _ = discordWebhookBuilder.AddComponents(discordMessageBuilder.Components);
_ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds); _ = discordWebhookBuilder.AddEmbeds(discordMessageBuilder.Embeds);
_ = discordWebhookBuilder.AddFiles(files); _ = discordWebhookBuilder.AddFiles(files);
discordWebhookBuilder.Content = discordMessageBuilder.Content; discordWebhookBuilder.Content = discordMessageBuilder.Content;
@ -437,7 +443,7 @@ public abstract class BaseCommand
async Task RefreshMessage() async Task RefreshMessage()
{ {
var dropdown = new DiscordRoleSelectComponent(this.GetString(this.t.Commands.Common.Prompts.SelectARole), SelectionInteractionId, 1, 1, false); 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()) if (Selected.IsNullOrWhiteSpace())
_ = ConfirmSelectionButton.Disable(); _ = ConfirmSelectionButton.Disable();
@ -541,7 +547,7 @@ public abstract class BaseCommand
this.ctx.Client.ComponentInteractionCreated -= RunInteraction; 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) if (ExceptionOccurred)
return new InteractionResult<DiscordRole>(ThrownException); return new InteractionResult<DiscordRole>(ThrownException);
@ -578,7 +584,7 @@ public abstract class BaseCommand
async Task RefreshMessage() async Task RefreshMessage()
{ {
var dropdown = new DiscordChannelSelectComponent(this.GetString(this.t.Commands.Common.Prompts.SelectAChannel), channelTypes, SelectionInteractionId); 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()) if (Selected.IsNullOrWhiteSpace())
_ = ConfirmSelectionButton.Disable(); _ = ConfirmSelectionButton.Disable();
@ -662,7 +668,7 @@ public abstract class BaseCommand
} }
this.ctx.Client.ComponentInteractionCreated -= RunInteraction; 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) if (ExceptionOccurred)
return new InteractionResult<DiscordChannel>(ThrownException); return new InteractionResult<DiscordChannel>(ThrownException);
@ -707,7 +713,7 @@ public abstract class BaseCommand
async Task RefreshMessage() 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 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); _ = NextPageButton.SetState(options.Skip(CurrentPage * 25).Count() <= 25);
_ = PrevPageButton.SetState(CurrentPage == 0); _ = PrevPageButton.SetState(CurrentPage == 0);
@ -784,7 +790,7 @@ public abstract class BaseCommand
this.ctx.Client.ComponentInteractionCreated -= RunInteraction; 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) if (ExceptionOccurred)
return new InteractionResult<string>(ThrownException); return new InteractionResult<string>(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("🔄"))); 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) Description = this.GetString(this.t.Commands.Common.Prompts.WaitingForModalResponse, true)
}.AsAwaitingInput(this.ctx)).AddComponents(new List<DiscordComponent> { ReOpen, MessageComponents.GetCancelButton(this.ctx.DbUser, this.ctx.Bot) })); }.AsAwaitingInput(this.ctx)).AddComponents(new List<DiscordComponent> { ReOpen, MessageComponents.GetCancelButton(this.ctx.DbUser, this.ctx.Bot) }));
@ -872,7 +878,7 @@ public abstract class BaseCommand
this.ctx.Client.ComponentInteractionCreated -= RunInteraction; this.ctx.Client.ComponentInteractionCreated -= RunInteraction;
if (ResetToOriginalEmbed) if (ResetToOriginalEmbed)
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(oriEmbed)); _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(oriEmbed));
if (ExceptionOccurred) if (ExceptionOccurred)
return new InteractionResult<ComponentInteractionCreateEventArgs>(ThrownException); return new InteractionResult<ComponentInteractionCreateEventArgs>(ThrownException);
@ -1445,7 +1451,7 @@ public abstract class BaseCommand
{ {
if (this.ctx.DbUser.PendingUserUpload.TimeOut.GetTotalSecondsUntil() > 0 && !this.ctx.DbUser.PendingUserUpload.InteractionHandled) 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.`", Description = $"`An upload interaction is already taking place. Please finish it beforehand.`",
}.AsError(this.ctx))); }.AsError(this.ctx)));
@ -1479,7 +1485,7 @@ public abstract class BaseCommand
#region FinishInteraction #region FinishInteraction
public void ModifyToTimedOut(bool Delete = false) 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) if (Delete)
_ = Task.Delay(5000).ContinueWith(_ => _ = Task.Delay(5000).ContinueWith(_ =>
@ -1635,19 +1641,19 @@ public abstract class BaseCommand
}.AsError(this.ctx)); }.AsError(this.ctx));
public void SendVoiceStateError() 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), Description = this.GetString(this.t.Commands.Common.Errors.VoiceChannel).Build(true),
}.AsError(this.ctx))); }.AsError(this.ctx)));
public void SendUserBanError(BanDetails entry) 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)), Description = this.t.Commands.Common.Errors.UserBan.t["en"].Build(true, new TVar("Reason", entry.Reason)),
}.AsError(this.ctx))); }.AsError(this.ctx)));
public void SendGuildBanError(BanDetails entry) 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)), Description = this.GetString(this.t.Commands.Common.Errors.GuildBan, true, new TVar("Reason", entry.Reason)),
}.AsError(this.ctx))); }.AsError(this.ctx)));
@ -1667,20 +1673,20 @@ public abstract class BaseCommand
}; };
public void SendDataError() 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")), Description = this.GetString(this.t.Commands.Common.Errors.Data, true, new TVar("Command", $"{this.ctx.Prefix}data delete")),
}.AsError(this.ctx))); }.AsError(this.ctx)));
public void SendDmError() 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)}", 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") 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))); }.AsError(this.ctx)));
public void SendDmRedirect() 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)}", Description = $"📩 {this.GetString(this.t.Commands.Common.DirectMessageRedirect, true)}",
}.AsSuccess(this.ctx))); }.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.**", 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); }.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 #endregion
} }

View file

@ -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 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("📣"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
{ Disable } { 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))), 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)); var e = await ctx.Client.GetInteractivity().WaitForSelectAsync(ctx.ResponseMessage, x => x.User.Id == ctx.User.Id, ComponentType.StringSelect, TimeSpan.FromMinutes(2));

View file

@ -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 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("✖"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
ExcludeBots, ExcludeBots,
@ -96,7 +96,7 @@ internal sealed class AutoCrosspostCommand : BaseCommand
{ {
if (ModalResult.Exception.GetType() == typeof(InvalidOperationException)) 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; 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.Description = this.GetString(CommandKey.ChannelLimit, true, new TVar("Invite", ctx.Bot.status.DevelopmentServerInvite));
embed = embed.AsError(ctx, this.GetString(CommandKey.Title)); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
@ -156,7 +156,7 @@ internal sealed class AutoCrosspostCommand : BaseCommand
if (ChannelResult.Result.Type != ChannelType.News) 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;

View file

@ -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 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("✖"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
Add, Add,

View file

@ -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 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("👤"))); 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))) .WithDescription(GetCurrentConfiguration(ctx)).AsAwaitingInput(ctx, this.GetString(CommandKey.Title)))
.AddComponents(new List<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {

View file

@ -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 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("🤖"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
ToggleMsg, ToggleMsg,

View file

@ -37,7 +37,7 @@ internal sealed class ExperienceCommand : BaseCommand
Description = GetCurrentConfiguration(ctx) Description = GetCurrentConfiguration(ctx)
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); }.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 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("⏫"))); var ToggleBumperBoost = new DiscordButtonComponent((ctx.DbGuild.Experience.BoostXpForBumpReminder ? ButtonStyle.Danger : ButtonStyle.Success), Guid.NewGuid().ToString(), this.GetString(CommandKey.ToggleExperienceBoostButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⏫")));

View file

@ -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 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("📋"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
ToggleDeletion, ToggleDeletion,

View file

@ -39,7 +39,7 @@ internal sealed class InviteNotesCommand : BaseCommand
if (!(ctx.DbGuild.InviteNotes.Notes.Length > 19)) if (!(ctx.DbGuild.InviteNotes.Notes.Length > 19))
{ {
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)
.AddComponents(new List<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
AddButton, AddButton,
@ -48,7 +48,7 @@ internal sealed class InviteNotesCommand : BaseCommand
} }
else else
{ {
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)
.AddComponents(new List<DiscordComponent> { RemoveButton }).AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); .AddComponents(new List<DiscordComponent> { 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}")}`" $"`{this.GetString(CommandKey.Invite).PadRight(pad)}`: `{(SelectedInvite is null ? this.GetString(this.t.Common.NotSelected) : $"{SelectedInvite.Code}")}`"
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); }.AsAwaitingInput(ctx, this.GetString(CommandKey.Title));
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)
.AddComponents(new List<DiscordComponent> { SelectTextButton, SelectInviteButton, Finish }) .AddComponents(new List<DiscordComponent> { SelectTextButton, SelectInviteButton, Finish })
.AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); .AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot)));

View file

@ -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("📲"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
Toggle Toggle

View file

@ -53,7 +53,7 @@ internal sealed class JoinCommand : BaseCommand
Description = GetCurrentConfiguration(ctx) Description = GetCurrentConfiguration(ctx)
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); }.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 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 ChangeJoinlogChannel = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.ChangeJoinlogChannelButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("👋")));

View file

@ -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"); var Dropdown = new DiscordStringSelectComponent(this.GetString(CommandKey.SelectDropdown), DefinedRewards.Skip(CurrentPage * 20).Take(20).ToList(), "RewardSelection");
embed = embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); embed = embed.AsAwaitingInput(ctx, this.GetString(CommandKey.Title));
var builder = new DiscordMessageBuilder().WithEmbed(embed); var builder = new DiscordMessageBuilder().AddEmbed(embed);
if (DefinedRewards.Count > 0) if (DefinedRewards.Count > 0)
_ = builder.AddComponents(Dropdown); _ = builder.AddComponents(Dropdown);
@ -196,7 +196,7 @@ internal sealed class LevelRewardsCommand : BaseCommand
$"`{this.GetString(CommandKey.Message).PadRight(pad)}`: `{selectedCustomText}`" $"`{this.GetString(CommandKey.Message).PadRight(pad)}`: `{selectedCustomText}`"
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); }.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<DiscordComponent> { SelectRole, SelectLevel, SelectCustomText, Finish }) .AddComponents(new List<DiscordComponent> { SelectRole, SelectLevel, SelectCustomText, Finish })
.AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); .AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot)));
@ -316,7 +316,7 @@ internal sealed class LevelRewardsCommand : BaseCommand
if (newMessage.Length > 256) if (newMessage.Length > 256)
{ {
action_embed.Description = this.GetString(CommandKey.MessageTooLong, true); 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); await Task.Delay(3000);
continue; 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)); 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 Task.Delay(5000);
await RefreshMessage(); await RefreshMessage();
@ -391,7 +391,7 @@ internal sealed class LevelRewardsCommand : BaseCommand
if (result.Length > 256) 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;

View file

@ -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 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("🔨"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
Toggle, Toggle,
@ -64,7 +64,7 @@ internal sealed class NameNormalizerCommand : BaseCommand
{ {
if (ctx.DbGuild.NameNormalizer.NameNormalizerRunning) 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)))); .WithDescription(this.GetString(CommandKey.NormalizerRunning, true))));
await Task.Delay(5000); await Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
@ -78,7 +78,7 @@ internal sealed class NameNormalizerCommand : BaseCommand
try 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)))); .WithDescription(this.GetString(CommandKey.RenamingAllMembers, true))));
var members = await ctx.Guild.GetAllMembersAsync(); 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))))); .WithDescription(this.GetString(CommandKey.RenamedMembers, true, new TVar("Count", Renamed)))));
await Task.Delay(5000); await Task.Delay(5000);
ctx.DbGuild.NameNormalizer.NameNormalizerRunning = false; ctx.DbGuild.NameNormalizer.NameNormalizerRunning = false;

View file

@ -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 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("🕒"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
{ ToggleDetectionButton }, { ToggleDetectionButton },
@ -188,7 +188,7 @@ internal sealed class PhishingCommand : BaseCommand
{ {
if (ctx.DbGuild.PhishingDetection.PunishmentType != PhishingPunishmentType.Timeout) 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
@ -211,7 +211,7 @@ internal sealed class PhishingCommand : BaseCommand
{ {
if (ModalResult.Exception.GetType() == typeof(InvalidOperationException)) 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;

View file

@ -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 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("🗝"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
{ TogglePrefixCommands }, { TogglePrefixCommands },

View file

@ -78,7 +78,7 @@ internal sealed class AddCommand : BaseCommand
case Enums.CommandType.ContextMenu: case Enums.CommandType.ContextMenu:
{ {
embed.Description = this.GetString(CommandKey.SelectRolePrompt, true); 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(); var RoleResult = await this.PromptRoleSelection();
if (RoleResult.TimedOut) if (RoleResult.TimedOut)
@ -122,7 +122,7 @@ internal sealed class AddCommand : BaseCommand
case Enums.CommandType.ContextMenu: case Enums.CommandType.ContextMenu:
{ {
embed.Description = this.GetString(CommandKey.ReactWithEmoji, true); 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)); 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)) if (emoji_parameter.Id != 0 && !ctx.Guild.Emojis.ContainsKey(emoji_parameter.Id))
{ {
embed.Description = this.GetString(CommandKey.NoAccessToEmoji); 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; return;
} }
@ -157,28 +157,28 @@ internal sealed class AddCommand : BaseCommand
if (ctx.DbGuild.ReactionRoles.Length > 100) if (ctx.DbGuild.ReactionRoles.Length > 100)
{ {
embed.Description = this.GetString(CommandKey.ReactionRoleLimitReached, true); 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; return;
} }
if (emoji_parameter.Id != 0 && !ctx.Guild.Emojis.ContainsKey(emoji_parameter.Id)) if (emoji_parameter.Id != 0 && !ctx.Guild.Emojis.ContainsKey(emoji_parameter.Id))
{ {
embed.Description = this.GetString(CommandKey.NoAccessToEmoji, true); 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; return;
} }
if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == message.Id && x.EmojiName == emoji_parameter.GetUniqueDiscordName()))) if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == message.Id && x.EmojiName == emoji_parameter.GetUniqueDiscordName())))
{ {
embed.Description = this.GetString(CommandKey.EmojiAlreadyUsed, true); 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; return;
} }
if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == role_parameter.Id)) if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == role_parameter.Id))
{ {
embed.Description = this.GetString(CommandKey.RoleAlreadyUsed, true); 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; return;
} }
@ -198,7 +198,7 @@ internal sealed class AddCommand : BaseCommand
new TVar("User", message.Author.Mention), new TVar("User", message.Author.Mention),
new TVar("Channel", message.Channel.Mention), new TVar("Channel", message.Channel.Mention),
new TVar("Emoji", emoji_parameter)); 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))));
}); });
} }
} }

View file

@ -37,7 +37,7 @@ internal sealed class ConfigCommand : BaseCommand
Description = this.GetString(CommandKey.ReactionRoleCount, true, new TVar("Count", ctx.DbGuild.ReactionRoles.Length)) Description = this.GetString(CommandKey.ReactionRoleCount, true, new TVar("Count", ctx.DbGuild.ReactionRoles.Length))
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Title)); }.AsAwaitingInput(ctx, this.GetString(CommandKey.Title));
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)
.AddComponents(new List<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
AddButton, RemoveButton AddButton, RemoveButton
@ -80,13 +80,13 @@ internal sealed class ConfigCommand : BaseCommand
if (ctx.DbGuild.ReactionRoles.Length > 100) if (ctx.DbGuild.ReactionRoles.Length > 100)
{ {
action_embed.Description = this.GetString(CommandKey.ReactionRoleLimitReached, true); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
} }
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(action_embed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(action_embed)
.AddComponents(new List<DiscordComponent> { SelectMessage, SelectEmoji, SelectRole, Finish }) .AddComponents(new List<DiscordComponent> { SelectMessage, SelectEmoji, SelectRole, Finish })
.AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); .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://ptb.discord.com/channels/012345678901234567/012345678901234567/012345678912345678`\n" +
$"`https://canary.discord.com/channels/012345678901234567/012345678901234567/012345678912345678`"; $"`https://canary.discord.com/channels/012345678901234567/012345678901234567/012345678912345678`";
action_embed.ImageUrl = ""; 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); await Task.Delay(3000);
continue; continue;
} }
@ -141,7 +141,7 @@ internal sealed class ConfigCommand : BaseCommand
{ {
action_embed.Description = this.GetString(CommandKey.MessageUrlWrongGuild, true); action_embed.Description = this.GetString(CommandKey.MessageUrlWrongGuild, true);
action_embed.ImageUrl = ""; 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); await Task.Delay(3000);
continue; continue;
} }
@ -150,7 +150,7 @@ internal sealed class ConfigCommand : BaseCommand
{ {
action_embed.Description = this.GetString(CommandKey.MessageUrlNoChannel, true); action_embed.Description = this.GetString(CommandKey.MessageUrlNoChannel, true);
action_embed.ImageUrl = ""; 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); await Task.Delay(3000);
continue; continue;
} }
@ -161,7 +161,7 @@ internal sealed class ConfigCommand : BaseCommand
{ {
action_embed.Description = this.GetString(CommandKey.MessageUrlNoMessage, true); action_embed.Description = this.GetString(CommandKey.MessageUrlNoMessage, true);
action_embed.ImageUrl = ""; 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); await Task.Delay(3000);
continue; continue;
} }
@ -175,7 +175,7 @@ internal sealed class ConfigCommand : BaseCommand
action_embed.Description = this.GetString(CommandKey.ReactWithEmoji, true); action_embed.Description = this.GetString(CommandKey.ReactWithEmoji, true);
action_embed.ImageUrl = ""; 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)); 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)) if (emoji.Id != 0 && !ctx.Guild.Emojis.ContainsKey(emoji.Id))
{ {
action_embed.Description = this.GetString(CommandKey.NoAccessToEmoji, true); 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); await Task.Delay(3000);
continue; continue;
} }
@ -202,7 +202,7 @@ internal sealed class ConfigCommand : BaseCommand
if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == selectedMessage.Id && x.EmojiName == emoji.GetUniqueDiscordName()))) if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == selectedMessage.Id && x.EmojiName == emoji.GetUniqueDiscordName())))
{ {
action_embed.Description = this.GetString(CommandKey.EmojiAlreadyUsed, true); 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); await Task.Delay(3000);
continue; continue;
} }
@ -242,7 +242,7 @@ internal sealed class ConfigCommand : BaseCommand
if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == RoleResult.Result.Id)) if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == RoleResult.Result.Id))
{ {
action_embed.Description = this.GetString(CommandKey.RoleAlreadyUsed, true); 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); await Task.Delay(3000);
continue; continue;
} }
@ -257,7 +257,7 @@ internal sealed class ConfigCommand : BaseCommand
if (ctx.DbGuild.ReactionRoles.Length > 100) if (ctx.DbGuild.ReactionRoles.Length > 100)
{ {
action_embed.Description = this.GetString(CommandKey.ReactionRoleLimitReached, true); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
@ -266,7 +266,7 @@ internal sealed class ConfigCommand : BaseCommand
if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == selectedRole.Id)) if (ctx.DbGuild.ReactionRoles.Any(x => x.RoleId == selectedRole.Id))
{ {
action_embed.Description = this.GetString(CommandKey.RoleAlreadyUsed, true); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
@ -275,7 +275,7 @@ internal sealed class ConfigCommand : BaseCommand
if (selectedEmoji.Id != 0 && !ctx.Guild.Emojis.ContainsKey(selectedEmoji.Id)) if (selectedEmoji.Id != 0 && !ctx.Guild.Emojis.ContainsKey(selectedEmoji.Id))
{ {
action_embed.Description = this.GetString(CommandKey.NoAccessToEmoji, true); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
@ -284,7 +284,7 @@ internal sealed class ConfigCommand : BaseCommand
if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == selectedMessage.Id && x.EmojiName == selectedEmoji.GetUniqueDiscordName()))) if (ctx.DbGuild.ReactionRoles.Any(x => (x.MessageId == selectedMessage.Id && x.EmojiName == selectedEmoji.GetUniqueDiscordName())))
{ {
action_embed.Description = this.GetString(CommandKey.EmojiAlreadyUsed, true); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
@ -306,7 +306,7 @@ internal sealed class ConfigCommand : BaseCommand
new TVar("User", selectedMessage.Author.Mention), new TVar("User", selectedMessage.Author.Mention),
new TVar("Channel", selectedMessage.Channel.Mention), new TVar("Channel", selectedMessage.Channel.Mention),
new TVar("Emoji", selectedEmoji)); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;
@ -357,7 +357,7 @@ internal sealed class ConfigCommand : BaseCommand
new TVar("User", reactionMessage?.Author.Mention ?? "`/`"), new TVar("User", reactionMessage?.Author.Mention ?? "`/`"),
new TVar("Channel", reactionMessage?.Channel.Mention ?? "`/`"), new TVar("Channel", reactionMessage?.Channel.Mention ?? "`/`"),
new TVar("Emoji", obj.GetEmoji(ctx.Client))); 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 Task.Delay(5000);
await this.ExecuteCommand(ctx, arguments); await this.ExecuteCommand(ctx, arguments);
return; return;

View file

@ -68,7 +68,7 @@ internal sealed class RemoveAllCommand : BaseCommand
if (!ctx.DbGuild.ReactionRoles.Any(x => x.MessageId == message.Id)) if (!ctx.DbGuild.ReactionRoles.Any(x => x.MessageId == message.Id))
{ {
embed.Description = this.GetString(CommandKey.NoReactionRoles, true); 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; return;
} }
@ -80,7 +80,7 @@ internal sealed class RemoveAllCommand : BaseCommand
embed.Description = this.GetString(CommandKey.RemovedAllReactionRoles, true, embed.Description = this.GetString(CommandKey.RemovedAllReactionRoles, true,
new TVar("User", message?.Author.Mention ?? "`/`"), new TVar("User", message?.Author.Mention ?? "`/`"),
new TVar("Channel", message?.Channel.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))));
}); });
} }
} }

View file

@ -77,7 +77,7 @@ internal sealed class RemoveCommand : BaseCommand
case Enums.CommandType.ContextMenu: case Enums.CommandType.ContextMenu:
{ {
embed.Description = this.GetString(CommandKey.ReactWithEmojiToRemove, true); 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)); 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())) if (!ctx.DbGuild.ReactionRoles.Any(x => x.MessageId == message.Id && x.EmojiName == emoji_parameter.GetUniqueDiscordName()))
{ {
embed.Description = this.GetString(CommandKey.NoReactionRoleFound); 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; return;
} }
@ -116,7 +116,7 @@ internal sealed class RemoveCommand : BaseCommand
new TVar("User", reactionMessage?.Author.Mention ?? "`/`"), new TVar("User", reactionMessage?.Author.Mention ?? "`/`"),
new TVar("Channel", reactionMessage?.Channel.Mention ?? "`/`"), new TVar("Channel", reactionMessage?.Channel.Mention ?? "`/`"),
new TVar("Emoji", obj.GetEmoji(ctx.Client))); 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))));
}); });
} }
} }

View file

@ -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("⚠"))); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
Toggle Toggle

View file

@ -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()); 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<DiscordComponent> .AddComponents(new List<DiscordComponent>
{ {
SetChannel SetChannel

View file

@ -23,7 +23,7 @@ internal sealed class EvaluationCommand : BaseCommand
{ {
if (ctx.CommandType is not Enums.CommandType.ApplicationCommand and not Enums.CommandType.ContextMenu) 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<DiscordComponent> { new DiscordButtonComponent(ButtonStyle.Success, "yes", "Yes"), .AddComponents(new List<DiscordComponent> { new DiscordButtonComponent(ButtonStyle.Success, "yes", "Yes"),
new DiscordButtonComponent(ButtonStyle.Danger, "no", "No")})); new DiscordButtonComponent(ButtonStyle.Danger, "no", "No")}));

View file

@ -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()); 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() _ = 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.`") .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<DiscordEmbedField>()))) .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<DiscordEmbedField>())))
.AddComponents(new List<DiscordComponent> { AddButton, RemoveButton }) .AddComponents(new List<DiscordComponent> { AddButton, RemoveButton })

View file

@ -44,7 +44,7 @@ internal sealed class CustomEmbedCommand : BaseCommand
try try
{ {
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(GeneratedEmbed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(GeneratedEmbed)
.AddComponents(new List<DiscordComponent> { SetTitle, SetAuthor, SetThumbnail }) .AddComponents(new List<DiscordComponent> { SetTitle, SetAuthor, SetThumbnail })
.AddComponents(new List<DiscordComponent> { SetDescription, SetImage, SetColor }) .AddComponents(new List<DiscordComponent> { SetDescription, SetImage, SetColor })
.AddComponents(new List<DiscordComponent> { SetFooter, SetTimestamp }) .AddComponents(new List<DiscordComponent> { 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 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("🖥"))); 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<DiscordComponent> { SetName, SetUrl, SetIcon }) .AddComponents(new List<DiscordComponent> { SetName, SetUrl, SetIcon })
.AddComponents(new List<DiscordComponent> { SetByUser, SetByGuild }) .AddComponents(new List<DiscordComponent> { SetByUser, SetByGuild })
.AddComponents(new List<DiscordComponent> { MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot) })); .AddComponents(new List<DiscordComponent> { 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 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("🖥"))); 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<DiscordComponent> { SetText, SetIcon }) .AddComponents(new List<DiscordComponent> { SetText, SetIcon })
.AddComponents(new List<DiscordComponent> { SetByUser, SetByGuild }) .AddComponents(new List<DiscordComponent> { SetByUser, SetByGuild })
.AddComponents(new List<DiscordComponent> { MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot) })); .AddComponents(new List<DiscordComponent> { MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot) }));

View file

@ -31,7 +31,7 @@ internal sealed class GuildPurgeCommand : BaseCommand
return; 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))) WithDescription(this.GetString(CommandKey.Scanning, true, new TVar("Victim", victim.Mention)))
.AsLoading(ctx))); .AsLoading(ctx)));
@ -49,7 +49,7 @@ internal sealed class GuildPurgeCommand : BaseCommand
currentProg++; 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" + WithDescription($"{this.GetString(CommandKey.Scanning, true, new TVar("Victim", victim.Mention))}\n" +
$"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg),3}%`") $"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg),3}%`")
.AsLoading(ctx))); .AsLoading(ctx)));
@ -118,7 +118,7 @@ internal sealed class GuildPurgeCommand : BaseCommand
if (message.CreationTimestamp.GetTimespanSince() > TimeSpan.FromDays(14)) if (message.CreationTimestamp.GetTimespanSince() > TimeSpan.FromDays(14))
_ = channel.Value.Remove(message); _ = 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" + .WithDescription($"{this.GetString(CommandKey.Deleting, true, new TVar("Victim", victim.Mention), new TVar("Count", allMsg))}\n" +
$"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg)}%`") $"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg)}%`")
.AsLoading(ctx))); .AsLoading(ctx)));
@ -133,7 +133,7 @@ internal sealed class GuildPurgeCommand : BaseCommand
{ {
try 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" + .WithDescription($"{this.GetString(CommandKey.Deleting, true, new TVar("Victim", victim.Mention), new TVar("Count", allMsg))}\n" +
$"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg)}%`") $"`{StringTools.GenerateASCIIProgressbar(currentProg, maxProg)} {MathTools.CalculatePercentage(currentProg, maxProg)}%`")
.AsLoading(ctx))); .AsLoading(ctx)));
@ -149,7 +149,7 @@ internal sealed class GuildPurgeCommand : BaseCommand
catch { } 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))) .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))); .AsSuccess(ctx)));
}); });

View file

@ -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()); DiscordButtonComponent YesButton = new(ButtonStyle.Success, Guid.NewGuid().ToString(), this.GetString(this.t.Common.Yes), false, DiscordEmoji.FromUnicode("✅").ToComponent());
_ = await this.RespondOrEdit(new DiscordMessageBuilder() _ = 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)); .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); var e = await ctx.ResponseMessage.WaitForButtonAsync(ctx.User);

View file

@ -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 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 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); var msg = await this.RespondOrEdit(builder);
@ -77,12 +77,12 @@ internal sealed class AvatarCommand : BaseCommand
if (e.GetCustomId() == ServerProfilePictureButton.CustomId) if (e.GetCustomId() == ServerProfilePictureButton.CustomId)
{ {
embed.ImageUrl = member.GuildAvatarUrl; 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) else if (e.GetCustomId() == ProfilePictureButton.CustomId)
{ {
embed.ImageUrl = member.AvatarUrl; embed.ImageUrl = member.AvatarUrl;
_ = this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(ServerProfilePictureButton)); _ = this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(ServerProfilePictureButton));
} }
} }
}).Add(ctx.Bot, ctx); }).Add(ctx.Bot, ctx);

View file

@ -29,7 +29,7 @@ internal sealed class BannerCommand : BaseCommand
Description = victim.BannerUrl.IsNullOrWhiteSpace() ? this.GetString(this.t.Commands.Utility.Banner.NoBanner, true) : "" 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()))); }.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); _ = await this.RespondOrEdit(builder);
}); });

View file

@ -23,7 +23,7 @@ internal sealed class DeleteCommand : BaseCommand
if (ctx.Bot.objectedUsers.Contains(ctx.User.Id)) 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) Description = this.GetString(this.t.Commands.Utility.Data.Object.ProfileAlreadyDeleted, true)
}.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { Yes, No })); }.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { Yes, No }));
@ -75,7 +75,7 @@ internal sealed class DeleteCommand : BaseCommand
if (ctx.DbUser.Data.DeletionRequested) 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, Description = this.GetString(this.t.Commands.Utility.Data.Object.DeletionAlreadyScheduled, true,
new TVar("RequestTimestamp", ctx.DbUser.Data.DeletionRequestDate.AddDays(-14).ToTimestamp()), new TVar("RequestTimestamp", ctx.DbUser.Data.DeletionRequestDate.AddDays(-14).ToTimestamp()),
@ -110,7 +110,7 @@ internal sealed class DeleteCommand : BaseCommand
return; 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) Description = this.GetString(this.t.Commands.Utility.Data.Object.ObjectionDisclaimer, true, true)
}.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { Yes, No })); }.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { Yes, No }));
@ -127,7 +127,7 @@ internal sealed class DeleteCommand : BaseCommand
if (Menu.GetCustomId() == Yes.CustomId) 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)}**" Description = $"**{this.GetString(this.t.Commands.Utility.Data.Object.SecondaryConfirm, true)}**"
}.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { No, Yes })); }.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { No, Yes }));

View file

@ -55,7 +55,7 @@ internal sealed class RequestCommand : BaseCommand
{ {
case Enums.CommandType.ApplicationCommand: 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) Description = this.GetString(this.t.Commands.Utility.Data.Request.Confirm, true)
}.AsSuccess(ctx)).WithFile("userdata.json", stream)); }.AsSuccess(ctx)).WithFile("userdata.json", stream));
@ -66,7 +66,7 @@ internal sealed class RequestCommand : BaseCommand
{ {
try 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) Description = this.GetString(this.t.Commands.Utility.Data.Request.Confirm, true)
}.AsSuccess(ctx)).WithFile("userdata.json", stream)); }.AsSuccess(ctx)).WithFile("userdata.json", stream));

View file

@ -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 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)) if (SanitizedEmoteList.Any(x => x.Value.EntryType == EmojiType.STICKER))
_ = builder.AddComponents(IncludeStickersButton); _ = builder.AddComponents(IncludeStickersButton);
@ -268,7 +268,7 @@ internal sealed class EmojiStealerCommand : BaseCommand
new TVar("Min", 0), new TVar("Min", 0),
new TVar("Max", (IncludeStickers ? SanitizedEmoteList.Count : SanitizedEmoteList.Where(x => x.Value.EntryType == EmojiType.EMOJI).Count()))); new TVar("Max", (IncludeStickers ? SanitizedEmoteList.Count : SanitizedEmoteList.Where(x => x.Value.EntryType == EmojiType.EMOJI).Count())));
_ = embed.AsLoading(ctx); _ = 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++) 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.Description = this.GetString(this.t.Commands.Utility.EmojiStealer.SendingDm, true, new TVar("Type", emojiText));
_ = embed.AsLoading(ctx); _ = embed.AsLoading(ctx);
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed));
try try
{ {
@ -416,7 +416,7 @@ internal sealed class EmojiStealerCommand : BaseCommand
cancellationTokenSource.Cancel(); cancellationTokenSource.Cancel();
embed.Description = this.GetString(this.t.Commands.Utility.EmojiStealer.PreparingZip, true); 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)) using (var archive = new ZipArchive(zipFileStream, ZipArchiveMode.Create, true))
{ {
@ -476,7 +476,7 @@ internal sealed class EmojiStealerCommand : BaseCommand
new TVar("Type", emojiText)); new TVar("Type", emojiText));
_ = zipFileStream.Seek(0, SeekOrigin.Begin); _ = 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; 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)))); 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(""))); 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)) if (SanitizedEmoteList.Any(x => x.Value.EntryType == EmojiType.STICKER))
_ = builder.AddComponents(IncludeStickersButton); _ = builder.AddComponents(IncludeStickersButton);

View file

@ -108,13 +108,13 @@ internal sealed class GuildInfoCommand : BaseCommand
if (guild.RawFeatures.Count > 0) 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()))}`"))}")); _ = 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()) if (!guild.VanityUrlCode.IsNullOrWhiteSpace())
_ = builder.AddComponents(new DiscordLinkButtonComponent($"https://discord.gg/{guild.VanityUrlCode}", this.GetString(CommandKey.JoinServer), false, DiscordEmoji.FromUnicode("🔗").ToComponent())); _ = builder.AddComponents(new DiscordLinkButtonComponent($"https://discord.gg/{guild.VanityUrlCode}", this.GetString(CommandKey.JoinServer), false, DiscordEmoji.FromUnicode("🔗").ToComponent()));
_ = await this.RespondOrEdit(new DiscordMessageBuilder() _ = 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), .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.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), 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)) // using (var file = new FileStream($"cache/{imageHash}", FileMode.Open, FileAccess.Read))
// { // {
// _ = await this.RespondOrEdit(new DiscordMessageBuilder() // _ = await this.RespondOrEdit(new DiscordMessageBuilder()
// .WithEmbed(embed) // .AddEmbed(embed)
// .WithFile("banner.png", file)); // .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()))}`"))}")); _ = 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 = ""; 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")); _ = 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()) if (!widget.InstantInviteUrl.IsNullOrWhiteSpace())
_ = builder.AddComponents(new DiscordLinkButtonComponent(widget.InstantInviteUrl, this.GetString(CommandKey.JoinServer), false, DiscordEmoji.FromUnicode("🔗").ToComponent())); _ = builder.AddComponents(new DiscordLinkButtonComponent(widget.InstantInviteUrl, this.GetString(CommandKey.JoinServer), false, DiscordEmoji.FromUnicode("🔗").ToComponent()));

View file

@ -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 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 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) if (!PreviousButton.Disabled || !NextButton.Disabled)
_ = builder.AddComponents(PreviousButton, NextButton); _ = builder.AddComponents(PreviousButton, NextButton);

View file

@ -34,7 +34,7 @@ internal sealed class RemindersCommand : BaseCommand
if (snoozeDescription is null) if (snoozeDescription is null)
{ {
_ = await this.RespondOrEdit(new DiscordMessageBuilder() _ = 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" + .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" + $"{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)}**") $"**⚠ {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()})")}" $"`{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)); }.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<DiscordComponent> { SelectDescriptionButton, SelectDueDateButton, Finish }) .AddComponents(new List<DiscordComponent> { SelectDescriptionButton, SelectDueDateButton, Finish })
.AddComponents(MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot))); .AddComponents(MessageComponents.GetBackButton(ctx.DbUser, ctx.Bot)));

View file

@ -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"); 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)); 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("✅"))); 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<DiscordComponent> _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(new List<DiscordComponent>
{ {
{ ContinueButton }, { ContinueButton },
{ MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot) } { 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 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 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) }, Author = new DiscordEmbedBuilder.EmbedAuthor { IconUrl = StatusIndicatorIcons.Success, Name = this.GetString(this.t.Commands.Utility.ReportHost.Title) },
Color = EmbedColors.Success, Color = EmbedColors.Success,

View file

@ -49,7 +49,7 @@ internal sealed class ReportTranslationCommand : BaseCommand
tos_embed.Description = tos_embed.Description.Insert(0, $"**{this.GetString(CommandKey.TosChangedNotice)}**\n\n"); 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)); var TosAccept = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(2));

View file

@ -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 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))); 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) Description = this.GetString(this.t.Commands.Utility.UrbanDictionary.AdultContentWarning, true)
}.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { Yes, No })); }.AsAwaitingInput(ctx)).AddComponents(new List<DiscordComponent> { Yes, No }));

View file

@ -189,7 +189,7 @@ internal sealed class UserInfoCommand : BaseCommand
if (bMember is not null && bMember.CommunicationDisabledUntil.HasValue && bMember.CommunicationDisabledUntil.Value.GetTotalSecondsUntil() > 0) 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)); _ = 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) if (InviterButtonAdded)
{ {

View file

@ -52,6 +52,7 @@ public sealed class Status
public EmojiConfig Emojis = new(config); public EmojiConfig Emojis = new(config);
public DiscordConfig Discord = new(config); public DiscordConfig Discord = new(config);
public ChannelsConfig Channels = new(config); public ChannelsConfig Channels = new(config);
public QuickChartConfig QuickChart = new(config);
public sealed class DiscordConfig(Config config) public sealed class DiscordConfig(Config config)
{ {
@ -113,6 +114,13 @@ public sealed class Status
public ulong AbuseIPDB => config.Emojis.AbuseIPDB; public ulong AbuseIPDB => config.Emojis.AbuseIPDB;
public ulong Spotify => config.Emojis.Spotify; 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 #region Legacy

View file

@ -48,7 +48,7 @@ public sealed class ReminderSettings : RequiresParent<User>
var user = await this.Bot.DiscordClient.GetFirstShard().GetUserAsync(this.Parent.Id); 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" + .WithDescription($"> {b.Description.FullSanitize()}\n" +
$"{CommandKey.CreatedOn.Get(this.Bot.Users[user.Id]).Build(new TVar("Guild", b.CreationPlace))}\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" + $"{CommandKey.CreatedAt.Get(this.Bot.Users[user.Id]).Build(new TVar("Timestamp", $"{b.CreationTime.ToTimestamp()} ({b.CreationTime.ToTimestamp(TimestampFormat.LongDateTime)})"))}\n" +

View file

@ -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))); $"{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); 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)) 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()}`"; 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) 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()) 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))); _ = 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++) for (var i = 0; i < 3; i++)
{ {
@ -106,7 +106,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
embed.Footer = new(); 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])}'"))})"; 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; break;
} }
@ -160,7 +160,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
if (embed.Fields.Count == 0) if (embed.Fields.Count == 0)
return; 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) 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 != NewChannel)
if (PreviousChannel is null && NewChannel is not null) 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) .WithAuthor(this.tKey.UserJoinedVoiceChannel.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.VoiceStateUserJoined)
.WithThumbnail(e.User.AvatarUrl) .WithThumbnail(e.User.AvatarUrl)
.WithColor(EmbedColors.Success) .WithColor(EmbedColors.Success)
@ -185,7 +185,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
} }
else if (PreviousChannel is not null && NewChannel is null) 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) .WithAuthor(this.tKey.UserLeftVoiceChannel.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.VoiceStateUserLeft)
.WithThumbnail(e.User.AvatarUrl) .WithThumbnail(e.User.AvatarUrl)
.WithColor(EmbedColors.Error) .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) 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) .WithAuthor(this.tKey.UserSwitchedVoiceChannel.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.VoiceStateUserUpdated)
.WithThumbnail(e.User.AvatarUrl) .WithThumbnail(e.User.AvatarUrl)
.WithColor(EmbedColors.Warning) .WithColor(EmbedColors.Warning)
@ -264,7 +264,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
using (var fileStream = new MemoryStream(Encoding.UTF8.GetBytes(Messages))) 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", .AddComponents(new DiscordLinkButtonComponent($"{this.Bot.status.LoadedConfig.WebServer.UrlPrefix}/{e.Guild.Id}/DeletedMessages/{FileName}", "Open in Browser",
this.Bot.status.LoadedConfig.WebServer.UrlPrefix.IsNullOrWhiteSpace()))); this.Bot.status.LoadedConfig.WebServer.UrlPrefix.IsNullOrWhiteSpace())));
} }
@ -311,7 +311,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
return; 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) internal async Task MemberUpdated(DiscordClient sender, GuildMemberUpdateEventArgs e)
@ -339,7 +339,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
else else
_ = embed.AddField(new DiscordEmbedField(this.tKey.NewNickname.Get(this.Bot.Guilds[e.Guild.Id]), $"`{e.NicknameAfter}`")); _ = 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; var RolesUpdated = false;
@ -427,7 +427,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
embed.Description += $"\n\n{Roles}"; 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) 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(); var timeBefore = (e.TimeoutBefore ?? DateTime.Today.AddDays(-300)).ToUniversalTime();
if (timeAfter > timeBefore) 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) .WithAuthor(this.tKey.TimedOut.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserBanned)
.WithColor(EmbedColors.Error) .WithColor(EmbedColors.Error)
.WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") .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()})"))); $"**{this.tKey.TimedOutUntil.Get(this.Bot.Guilds[e.Guild.Id])}**: {timeAfter.Timestamp(TimestampFormat.LongDateTime)} ({timeAfter.Timestamp()})")));
if (timeAfter < timeBefore) 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) .WithAuthor(this.tKey.TimeoutRemoved.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserBanRemoved)
.WithColor(EmbedColors.Success) .WithColor(EmbedColors.Success)
.WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") .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 try
{ {
if ((e.PendingBefore is null && e.PendingAfter is true) || (e.PendingAfter is true && e.PendingBefore is false)) 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) .WithAuthor(this.tKey.MembershipApproved.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserAdded)
.WithColor(EmbedColors.Success) .WithColor(EmbedColors.Success)
.WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") .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. // // 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" }, // Author = new DiscordEmbedBuilder.EmbedAuthor { IconUrl = AuditLogIcons.UserUpdated, Name = $"Member Profile Picture updated" },
// Color = EmbedColors.Warning, // Color = EmbedColors.Warning,
@ -492,7 +492,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
if (e.GuildAvatarHashBefore != e.GuildAvatarHashAfter) 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) .WithAuthor(this.tKey.GuildProfilePictureUpdated.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.UserUpdated)
.WithColor(EmbedColors.Warning) .WithColor(EmbedColors.Warning)
.WithFooter($"{this.tKey.UserId.Get(this.Bot.Guilds[e.Guild.Id])}: {e.Member.Id}") .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}" + $"{Integration}" +
$"\n**{this.tKey.Permissions.Get(this.Bot.Guilds[e.Guild.Id])}**: {GeneratePermissions}"); $"\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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; break;
} }
@ -597,7 +597,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
$"{Integration}\n" + $"{Integration}\n" +
$"\n**{this.tKey.Permissions.Get(this.Bot.Guilds[e.Guild.Id])}**: {GeneratePermissions}"); $"\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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; break;
} }
@ -702,7 +702,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
$"{Integration}" + $"{Integration}" +
$"{PermissionDifference}"); $"{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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; break;
} }
@ -751,7 +751,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
.TruncateWithIndication(1000))); .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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; break;
} }
@ -793,7 +793,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
.WithThumbnail(e.Member.AvatarUrl) .WithThumbnail(e.Member.AvatarUrl)
.WithDescription($"**{this.tKey.User.Get(this.Bot.Guilds[e.Guild.Id])}**: {e.Member.Mention} `{e.Member.GetUsernameWithIdentifier()}`"); .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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; break;
} }
@ -927,7 +927,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
if (e.GuildBefore.IconHash != e.GuildAfter.IconHash) if (e.GuildBefore.IconHash != e.GuildAfter.IconHash)
embed.ImageUrl = e.GuildAfter.IconUrl; 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) if (!this.Bot.Guilds[e.GuildAfter.Id].ActionLog.AttemptGettingMoreDetails)
return; return;
@ -946,7 +946,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
embed.Footer = new(); 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])}'"))})"; 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; break;
} }
@ -966,7 +966,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
.WithTimestamp(DateTime.UtcNow) .WithTimestamp(DateTime.UtcNow)
.WithDescription($"**{this.tKey.Name.Get(this.Bot.Guilds[e.Guild.Id])}**: {e.Channel.Mention} `[{e.Channel.GetIcon()}{e.Channel.Name}]`"); .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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; break;
} }
@ -1005,7 +1005,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
.WithTimestamp(DateTime.UtcNow) .WithTimestamp(DateTime.UtcNow)
.WithDescription($"**{this.tKey.Name.Get(this.Bot.Guilds[e.Guild.Id])}**: `[{e.Channel.GetIcon()}{e.Channel.Name}]`"); .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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; break;
} }
@ -1055,7 +1055,7 @@ internal sealed class ActionlogEvents(Bot bot) : RequiresTranslation(bot)
.WithTimestamp(DateTime.UtcNow) .WithTimestamp(DateTime.UtcNow)
.WithDescription(Description); .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) if (!this.Bot.Guilds[e.Guild.Id].ActionLog.AttemptGettingMoreDetails)
return; 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])}'"))})"; 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; 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) if (!await this.ValidateServer(e.Guild) || !this.Bot.Guilds[e.Guild.Id].ActionLog.InvitesModified)
return; 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) .WithAuthor(this.tKey.InviteCreated.Get(this.Bot.Guilds[e.Guild.Id]), null, AuditLogIcons.InviteAdded)
.WithColor(EmbedColors.Success) .WithColor(EmbedColors.Success)
.WithTimestamp(DateTime.UtcNow) .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.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}]`"); $"**{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) 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 = 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])}'"))})"; 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; break;
} }

View file

@ -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 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()}" }, Author = new DiscordEmbedBuilder.EmbedAuthor { IconUrl = message.Author.AvatarUrl, Name = $"{message.Author.GetUsernameWithIdentifier()}" },
Color = message.Author.BannerColor ?? EmbedColors.Info, Color = message.Author.BannerColor ?? EmbedColors.Info,

View file

@ -81,7 +81,7 @@ internal sealed class PhishingProtectionEvents(Bot bot) : RequiresTranslation(bo
_ = embed.AddFields(report_fields.Take(2)); _ = 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]))));
} }
} }

View file

@ -87,7 +87,7 @@ internal sealed class TokenLeakEvents(Bot bot) : RequiresTranslation(bot)
var s = (InvalidateCount > 1 ? "s" : ""); var s = (InvalidateCount > 1 ? "s" : "");
_ = e.Channel.SendMessageAsync(new DiscordMessageBuilder().WithEmbed( _ = e.Channel.SendMessageAsync(new DiscordMessageBuilder().AddEmbed(
new DiscordEmbedBuilder() new DiscordEmbedBuilder()
.WithColor(EmbedColors.Error) .WithColor(EmbedColors.Error)
.WithAuthor(sender.CurrentUser.GetUsername(), null, sender.CurrentUser.AvatarUrl) .WithAuthor(sender.CurrentUser.GetUsername(), null, sender.CurrentUser.AvatarUrl)

View file

@ -49,7 +49,7 @@ internal sealed class VcCreatorEvents(Bot bot) : RequiresTranslation(bot)
_ = await newChannel.SendMessageAsync(new DiscordMessageBuilder() _ = await newChannel.SendMessageAsync(new DiscordMessageBuilder()
.WithContent(e.User.Mention) .WithContent(e.User.Mention)
.WithEmbed(new DiscordEmbedBuilder() .AddEmbed(new DiscordEmbedBuilder()
.WithAuthor(e.Guild.Name, "", e.Guild.IconUrl) .WithAuthor(e.Guild.Name, "", e.Guild.IconUrl)
.WithColor(EmbedColors.Info) .WithColor(EmbedColors.Info)
.WithTimestamp(DateTime.UtcNow) .WithTimestamp(DateTime.UtcNow)

View file

@ -173,7 +173,7 @@ internal sealed class ExperienceHandler : RequiresTranslation
this.Bot.Users[user.Id].ExperienceUser.DirectMessageOptOut = true; 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( _ = await (await user.CreateDmChannelAsync()).SendMessageAsync(this.tKey.AutomaticDeletion.Get(this.Bot.Users[user.Id]).Build(
new TVar("Command", "`/levelrewards-optin`"), 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("⛔"))) }, { 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; this.Bot.DiscordClient.ComponentInteractionCreated += RunInteraction;
@ -195,7 +195,7 @@ internal sealed class ExperienceHandler : RequiresTranslation
{ {
await Task.Delay(3600000); await Task.Delay(3600000);
embed.Footer.Text += $" • {this.t.Commands.Common.InteractionTimeout.Get(this.Bot.Users[user.Id])}"; 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; this.Bot.DiscordClient.ComponentInteractionCreated -= RunInteraction;
} }

View file

@ -15,9 +15,6 @@ public static class DiscordExtensions
{ {
private static string? LoadedHtml = null; private static string? LoadedHtml = null;
public static DiscordMessageBuilder WithEmbed(this DiscordMessageBuilder builder, DiscordEmbed embed)
=> builder.AddEmbed(embed);
public static IReadOnlyDictionary<ulong, DiscordGuild> GetGuilds(this DiscordShardedClient client) public static IReadOnlyDictionary<ulong, DiscordGuild> GetGuilds(this DiscordShardedClient client)
{ {
var Guilds = new Dictionary<ulong, DiscordGuild>(); var Guilds = new Dictionary<ulong, DiscordGuild>();