From 2ca985d24861f56feccc901357283dacc72182bf Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Mon, 7 Apr 2025 21:33:05 +0200 Subject: [PATCH] fix: Fix method --- Commands/Music/ClearQueueCommand.cs | 6 +++--- Commands/Music/DisconnectCommand.cs | 6 +++--- Commands/Music/QueueCommand.cs | 2 +- Commands/Music/SkipCommand.cs | 6 +++--- Commands/MusicModuleAbstractions.cs | 2 +- Commands/Playlists/DeleteCommand.cs | 4 ++-- Commands/Playlists/ExportCommand.cs | 2 +- Commands/Playlists/ImportCommand.cs | 24 ++++++++++++------------ Commands/Playlists/LoadShareCommand.cs | 8 ++++---- Commands/Playlists/ManageCommand.cs | 2 +- Commands/Playlists/ModifyCommand.cs | 8 ++++---- Commands/Playlists/NewPlaylistCommand.cs | 10 +++++----- Commands/Playlists/SaveCurrentCommand.cs | 12 ++++++------ Commands/Playlists/ShareCommand.cs | 2 +- 14 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Commands/Music/ClearQueueCommand.cs b/Commands/Music/ClearQueueCommand.cs index bace3a0..392fcdd 100644 --- a/Commands/Music/ClearQueueCommand.cs +++ b/Commands/Music/ClearQueueCommand.cs @@ -63,7 +63,7 @@ internal sealed class ClearQueueCommand : BaseCommand Description = $"`{this.GetGuildString(CommandKey.ClearQueue.VoteStarted)} ({MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedClearQueueVotes.Count}/{Math.Ceiling((conn.Channel.Users.Count - 1.0) * 0.51)})`", }.AsAwaitingInput(ctx); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); DiscordButtonComponent DisconnectVote = new(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetGuildString(CommandKey.ClearQueue.VoteButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🗑"))); _ = builder.AddComponents(DisconnectVote); @@ -110,7 +110,7 @@ internal sealed class ClearQueueCommand : BaseCommand MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].SongQueue = []; MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedClearQueueVotes.Clear(); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.ClearQueue.Cleared, true), }.AsSuccess(ctx))); @@ -118,7 +118,7 @@ internal sealed class ClearQueueCommand : BaseCommand } embed.Description = $"`{this.GetGuildString(CommandKey.ClearQueue.VoteStarted)} ({MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedClearQueueVotes.Count}/{Math.Ceiling((conn.Channel.Users.Count - 1.0) * 0.51)})`"; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(DisconnectVote)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(DisconnectVote)); } }).Add(ctx.Bot); } diff --git a/Commands/Music/DisconnectCommand.cs b/Commands/Music/DisconnectCommand.cs index 5c735a1..6ce789d 100644 --- a/Commands/Music/DisconnectCommand.cs +++ b/Commands/Music/DisconnectCommand.cs @@ -65,7 +65,7 @@ internal sealed class DisconnectCommand : BaseCommand Description = $"`{this.GetGuildString(CommandKey.Disconnect.VoteStarted, true)} ({MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedDisconnectVotes.Count}/{Math.Ceiling((conn.Channel.Users.Count - 1.0) * 0.51)})`", }.AsAwaitingInput(ctx); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); DiscordButtonComponent DisconnectVote = new(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetGuildString(CommandKey.Disconnect.VoteButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⛔"))); _ = builder.AddComponents(DisconnectVote); @@ -114,7 +114,7 @@ internal sealed class DisconnectCommand : BaseCommand _ = await conn.StopAsync(); await conn.DisconnectAsync(); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Disconnect.Disconnected, true) }.AsSuccess(ctx))); @@ -122,7 +122,7 @@ internal sealed class DisconnectCommand : BaseCommand } embed.Description = $"`{this.GetGuildString(CommandKey.Disconnect.VoteStarted, true)} ({MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedDisconnectVotes.Count}/{Math.Ceiling((conn.Channel.Users.Count - 1.0) * 0.51)})`"; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(DisconnectVote)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(DisconnectVote)); } }).Add(ctx.Bot); } diff --git a/Commands/Music/QueueCommand.cs b/Commands/Music/QueueCommand.cs index 16ff125..653262b 100644 --- a/Commands/Music/QueueCommand.cs +++ b/Commands/Music/QueueCommand.cs @@ -91,7 +91,7 @@ internal sealed class QueueCommand : BaseCommand if ((CurrentPage * 10) + 10 >= MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].SongQueue.Length) NextPage = NextPage.Disable(); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = Description }.AsInfo(ctx)) diff --git a/Commands/Music/SkipCommand.cs b/Commands/Music/SkipCommand.cs index 580c367..f9faff4 100644 --- a/Commands/Music/SkipCommand.cs +++ b/Commands/Music/SkipCommand.cs @@ -62,7 +62,7 @@ internal sealed class SkipCommand : BaseCommand Description = $"`{this.GetGuildString(CommandKey.Skip.VoteStarted)} ({MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedSkips.Count}/{Math.Ceiling((conn.Channel.Users.Count - 1.0) * 0.51)})`", }.AsAwaitingInput(ctx); - var builder = new DiscordMessageBuilder().WithEmbed(embed); + var builder = new DiscordMessageBuilder().AddEmbed(embed); DiscordButtonComponent SkipSongVote = new(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetGuildString(CommandKey.Skip.VoteButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⏩"))); _ = builder.AddComponents(SkipSongVote); @@ -108,7 +108,7 @@ internal sealed class SkipCommand : BaseCommand { _ = await conn.StopAsync(); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Skip.Skipped, true), }.AsSuccess(ctx))); @@ -116,7 +116,7 @@ internal sealed class SkipCommand : BaseCommand } embed.Description = $"`{this.GetGuildString(CommandKey.Skip.VoteStarted)} ({MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedSkips.Count}/{Math.Ceiling((conn.Channel.Users.Count - 1.0) * 0.51)})`"; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(SkipSongVote)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(SkipSongVote)); } }).Add(ctx.Bot); } diff --git a/Commands/MusicModuleAbstractions.cs b/Commands/MusicModuleAbstractions.cs index f09cd18..5aae860 100644 --- a/Commands/MusicModuleAbstractions.cs +++ b/Commands/MusicModuleAbstractions.cs @@ -89,7 +89,7 @@ internal static class MusicModuleAbstractions var Spotify = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), "Spotify", false, EmojiTemplates.GetSpotify(ctx.Bot).ToComponent()); _ = await ctx.BaseCommand.RespondOrEdit( - new DiscordMessageBuilder().WithEmbed(embed) + new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { YouTube, SoundCloud, Spotify })); var Menu1 = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(2)); diff --git a/Commands/Playlists/DeleteCommand.cs b/Commands/Playlists/DeleteCommand.cs index d62d2b2..6282acc 100644 --- a/Commands/Playlists/DeleteCommand.cs +++ b/Commands/Playlists/DeleteCommand.cs @@ -33,14 +33,14 @@ internal sealed class DeleteCommand : BaseCommand var SelectedPlaylist = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.First(x => x.PlaylistId == playlistId); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Delete.Deleting, true, new TVar("Name", SelectedPlaylist.PlaylistName)), }.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); MusicPlugin.Plugin.Users[ctx.User.Id].Playlists = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Remove(x => x.PlaylistId, SelectedPlaylist); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Delete.Deleted, true, new TVar("Name", SelectedPlaylist.PlaylistName)), }.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title)))); diff --git a/Commands/Playlists/ExportCommand.cs b/Commands/Playlists/ExportCommand.cs index f479c6b..9ae1946 100644 --- a/Commands/Playlists/ExportCommand.cs +++ b/Commands/Playlists/ExportCommand.cs @@ -35,7 +35,7 @@ internal sealed class ExportCommand : BaseCommand using (MemoryStream stream = new(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(SelectedPlaylist, Formatting.Indented)))) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() { Description = this.GetString(CommandKey.Playlists.Export.Exported, true, new TVar("Name", SelectedPlaylist.PlaylistName)), }.AsInfo(ctx, this.GetString(CommandKey.Playlists.Title))).WithFile($"{Guid.NewGuid().ToString().Replace("-", "").ToLower()}.json", stream)); diff --git a/Commands/Playlists/ImportCommand.cs b/Commands/Playlists/ImportCommand.cs index 2d0a6e0..31f75c7 100644 --- a/Commands/Playlists/ImportCommand.cs +++ b/Commands/Playlists/ImportCommand.cs @@ -26,7 +26,7 @@ internal sealed class ImportCommand : BaseCommand if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -36,7 +36,7 @@ internal sealed class ImportCommand : BaseCommand var Link = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.Playlists.Import.Link), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("↘"))); var ExportedPlaylist = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), this.GetString(CommandKey.Playlists.Import.ExportedPlaylist), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("📂"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.ImportMethod, true), }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title))) @@ -84,7 +84,7 @@ internal sealed class ImportCommand : BaseCommand if (loadResult.LoadType == LavalinkLoadResultType.Error) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.NotLoaded, true), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -96,14 +96,14 @@ internal sealed class ImportCommand : BaseCommand if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); return; } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.Creating, true), }.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -116,7 +116,7 @@ internal sealed class ImportCommand : BaseCommand MusicPlugin.Plugin.Users[ctx.User.Id].Playlists = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Add(v); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.Created, true, new TVar("Name", v.PlaylistName), @@ -127,7 +127,7 @@ internal sealed class ImportCommand : BaseCommand } else { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.NotLoaded, true), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -140,7 +140,7 @@ internal sealed class ImportCommand : BaseCommand { _ = Menu.Result.Interaction.CreateResponseAsync(InteractionResponseType.DeferredMessageUpdate); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.UploadExport, true, new TVar("Command", $"{ctx.Prefix}upload")), }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -161,7 +161,7 @@ internal sealed class ImportCommand : BaseCommand return; } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.Importing, true), }.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -177,7 +177,7 @@ internal sealed class ImportCommand : BaseCommand if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -193,7 +193,7 @@ internal sealed class ImportCommand : BaseCommand MusicPlugin.Plugin.Users[ctx.User.Id].Playlists = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Add(v); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.Created, true, new TVar("Name", v.PlaylistName), @@ -204,7 +204,7 @@ internal sealed class ImportCommand : BaseCommand } catch (Exception ex) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Import.ImportFailed, true), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); diff --git a/Commands/Playlists/LoadShareCommand.cs b/Commands/Playlists/LoadShareCommand.cs index cddec91..07914aa 100644 --- a/Commands/Playlists/LoadShareCommand.cs +++ b/Commands/Playlists/LoadShareCommand.cs @@ -66,7 +66,7 @@ internal sealed class LoadShareCommand : BaseCommand DiscordButtonComponent Confirm = new(ButtonStyle.Success, Guid.NewGuid().ToString(), this.GetString(CommandKey.Playlists.LoadShare.ImportButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("📥"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(new List { Confirm, MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot) })); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(new List { Confirm, MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot) })); var e = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(1)); @@ -81,14 +81,14 @@ internal sealed class LoadShareCommand : BaseCommand if (e.GetCustomId() == Confirm.CustomId) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.LoadShare.Importing, true), }.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -97,7 +97,7 @@ internal sealed class LoadShareCommand : BaseCommand MusicPlugin.Plugin.Users[ctx.User.Id].Playlists = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Add(ImportJson); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.LoadShare.Imported, true, new TVar("Name", ImportJson.PlaylistName)), }.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title)))); diff --git a/Commands/Playlists/ManageCommand.cs b/Commands/Playlists/ManageCommand.cs index 6bc1b6f..dd5f781 100644 --- a/Commands/Playlists/ManageCommand.cs +++ b/Commands/Playlists/ManageCommand.cs @@ -28,7 +28,7 @@ internal sealed class ManageCommand : BaseCommand return countInt; } - var builder = new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + var builder = new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() { Description = $"{(MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length > 0 ? string.Join("\n", MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Select(x => $"**{GetCount()}**. `{x.PlaylistName.SanitizeForCode()}`: `{x.List.Length} {this.GetString(CommandKey.Playlists.Tracks)}`")) : this.GetString(CommandKey.Playlists.Manage.NoPlaylists, true))}" }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title))); diff --git a/Commands/Playlists/ModifyCommand.cs b/Commands/Playlists/ModifyCommand.cs index 2acba8b..a0cb457 100644 --- a/Commands/Playlists/ModifyCommand.cs +++ b/Commands/Playlists/ModifyCommand.cs @@ -91,7 +91,7 @@ internal sealed class ModifyCommand : BaseCommand embed.Title = $"{this.GetString(CommandKey.Playlists.Modify.ModifyingPlaylist)}: `{SelectedPlaylist.PlaylistName}`"; embed.Description = Description; embed.Thumbnail = new DiscordEmbedBuilder.EmbedThumbnail { Url = (SelectedPlaylist.PlaylistThumbnail.IsNullOrWhiteSpace() ? "" : SelectedPlaylist.PlaylistThumbnail) }; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { PreviousPage, NextPage }) .AddComponents(new List { AddSong, RemoveSong, RemoveDuplicates }) .AddComponents(new List { PlaylistName, ChangePlaylistColor, ChangePlaylistThumbnail }) @@ -205,7 +205,7 @@ internal sealed class ModifyCommand : BaseCommand $"⚠ {this.GetString(CommandKey.Playlists.ThumbnailModerationNote, true)}", }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); (Stream stream, int fileSize) stream; @@ -339,7 +339,7 @@ internal sealed class ModifyCommand : BaseCommand DiscordStringSelectComponent Tracks = new(this.GetString(CommandKey.Playlists.Modify.DeleteNote), TrackList, Guid.NewGuid().ToString(), 1, TrackList.Count); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(Tracks)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(Tracks)); var Response = await s.GetInteractivity().WaitForSelectAsync(ctx.ResponseMessage, x => x.User.Id == ctx.User.Id, ComponentType.StringSelect); @@ -358,7 +358,7 @@ internal sealed class ModifyCommand : BaseCommand if (SelectedPlaylist.List.Length <= 0) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.Delete.Deleted, true, new TVar("Name", SelectedPlaylist.PlaylistName)), }.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title)))); diff --git a/Commands/Playlists/NewPlaylistCommand.cs b/Commands/Playlists/NewPlaylistCommand.cs index f4ded9c..e15d94d 100644 --- a/Commands/Playlists/NewPlaylistCommand.cs +++ b/Commands/Playlists/NewPlaylistCommand.cs @@ -29,7 +29,7 @@ internal sealed class NewPlaylistCommand : BaseCommand { if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -49,7 +49,7 @@ internal sealed class NewPlaylistCommand : BaseCommand $"`{this.GetString(CommandKey.Playlists.CreatePlaylist.FirstTracks).PadRight(pad)}`: {(SelectedTracks.IsNotNullAndNotEmpty() ? (SelectedTracks.Length > 1 ? $"`{SelectedTracks.Length} {this.GetString(CommandKey.Playlists.Tracks)}`" : $"[`{SelectedTracks[0].Title}`]({SelectedTracks[0].Url})") : this.GetString(this.t.Common.NotSelected, true))}" }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { SelectName, SelectFirstTracks, Finish }) .AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); @@ -131,7 +131,7 @@ internal sealed class NewPlaylistCommand : BaseCommand if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -139,7 +139,7 @@ internal sealed class NewPlaylistCommand : BaseCommand return; } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Creating, true), }.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -152,7 +152,7 @@ internal sealed class NewPlaylistCommand : BaseCommand MusicPlugin.Plugin.Users[ctx.User.Id].Playlists = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Add(v); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Created, true, new TVar("Playlist", v.PlaylistName), diff --git a/Commands/Playlists/SaveCurrentCommand.cs b/Commands/Playlists/SaveCurrentCommand.cs index 1e15632..e1fefb6 100644 --- a/Commands/Playlists/SaveCurrentCommand.cs +++ b/Commands/Playlists/SaveCurrentCommand.cs @@ -24,7 +24,7 @@ internal sealed class SaveCurrentCommand : BaseCommand if (ctx.Member.VoiceState is null || ctx.Member.VoiceState.Channel.Id != (await ctx.Client.CurrentUser.ConvertToMember(ctx.Guild)).VoiceState?.Channel?.Id) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.NotSameChannel, true) }.AsError(ctx))); @@ -38,7 +38,7 @@ internal sealed class SaveCurrentCommand : BaseCommand { if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -57,7 +57,7 @@ internal sealed class SaveCurrentCommand : BaseCommand $"`{this.GetString(CommandKey.Playlists.CreatePlaylist.FirstTracks).PadRight(pad)}`: {(SelectedTracks.IsNotNullAndNotEmpty() ? (SelectedTracks.Length > 1 ? $"`{SelectedTracks.Length} {this.GetString(CommandKey.Playlists.Tracks)}`" : $"[`{SelectedTracks[0].Title}`]({SelectedTracks[0].Url})") : this.GetString(this.t.Common.NotSelected, true))}" }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed) .AddComponents(new List { SelectName, Finish }) .AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); @@ -103,7 +103,7 @@ internal sealed class SaveCurrentCommand : BaseCommand if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)), }.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -111,7 +111,7 @@ internal sealed class SaveCurrentCommand : BaseCommand return; } - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Creating, true), }.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); @@ -124,7 +124,7 @@ internal sealed class SaveCurrentCommand : BaseCommand MusicPlugin.Plugin.Users[ctx.User.Id].Playlists = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Add(v); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Created, true, new TVar("Playlist", v.PlaylistName), diff --git a/Commands/Playlists/ShareCommand.cs b/Commands/Playlists/ShareCommand.cs index c29e4e9..3305b5c 100644 --- a/Commands/Playlists/ShareCommand.cs +++ b/Commands/Playlists/ShareCommand.cs @@ -41,7 +41,7 @@ internal sealed class ShareCommand : BaseCommand if (!Directory.Exists($"PlaylistShares/{ctx.User.Id}")) _ = Directory.CreateDirectory($"PlaylistShares/{ctx.User.Id}"); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder() + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() { Description = this.GetString(CommandKey.Playlists.Share.Shared, true, new TVar("Command", $"{ctx.Prefix}playlists load-share {ctx.User.Id} {ShareCode}")),