fix: Fix method

This commit is contained in:
Mira 2025-04-07 21:33:05 +02:00
parent 79e7cffb4e
commit 2ca985d248
Signed by untrusted user who does not match committer: Xorog
GPG key ID: 983798ED9C3E7C36
14 changed files with 47 additions and 47 deletions

View file

@ -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)})`", 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); }.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("🗑"))); DiscordButtonComponent DisconnectVote = new(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetGuildString(CommandKey.ClearQueue.VoteButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🗑")));
_ = builder.AddComponents(DisconnectVote); _ = 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].SongQueue = [];
MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].collectedClearQueueVotes.Clear(); 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), Description = this.GetString(CommandKey.ClearQueue.Cleared, true),
}.AsSuccess(ctx))); }.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)})`"; 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); }).Add(ctx.Bot);
} }

View file

@ -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)})`", 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); }.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("⛔"))); DiscordButtonComponent DisconnectVote = new(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetGuildString(CommandKey.Disconnect.VoteButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⛔")));
_ = builder.AddComponents(DisconnectVote); _ = builder.AddComponents(DisconnectVote);
@ -114,7 +114,7 @@ internal sealed class DisconnectCommand : BaseCommand
_ = await conn.StopAsync(); _ = await conn.StopAsync();
await conn.DisconnectAsync(); 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) Description = this.GetString(CommandKey.Disconnect.Disconnected, true)
}.AsSuccess(ctx))); }.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)})`"; 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); }).Add(ctx.Bot);
} }

View file

@ -91,7 +91,7 @@ internal sealed class QueueCommand : BaseCommand
if ((CurrentPage * 10) + 10 >= MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].SongQueue.Length) if ((CurrentPage * 10) + 10 >= MusicPlugin.Plugin!.Guilds![ctx.Guild.Id].SongQueue.Length)
NextPage = NextPage.Disable(); NextPage = NextPage.Disable();
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder
{ {
Description = Description Description = Description
}.AsInfo(ctx)) }.AsInfo(ctx))

View file

@ -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)})`", 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); }.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("⏩"))); DiscordButtonComponent SkipSongVote = new(ButtonStyle.Danger, Guid.NewGuid().ToString(), this.GetGuildString(CommandKey.Skip.VoteButton), false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("⏩")));
_ = builder.AddComponents(SkipSongVote); _ = builder.AddComponents(SkipSongVote);
@ -108,7 +108,7 @@ internal sealed class SkipCommand : BaseCommand
{ {
_ = await conn.StopAsync(); _ = 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), Description = this.GetString(CommandKey.Skip.Skipped, true),
}.AsSuccess(ctx))); }.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)})`"; 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); }).Add(ctx.Bot);
} }

View file

@ -89,7 +89,7 @@ internal static class MusicModuleAbstractions
var Spotify = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), "Spotify", false, EmojiTemplates.GetSpotify(ctx.Bot).ToComponent()); var Spotify = new DiscordButtonComponent(ButtonStyle.Primary, Guid.NewGuid().ToString(), "Spotify", false, EmojiTemplates.GetSpotify(ctx.Bot).ToComponent());
_ = await ctx.BaseCommand.RespondOrEdit( _ = await ctx.BaseCommand.RespondOrEdit(
new DiscordMessageBuilder().WithEmbed(embed) new DiscordMessageBuilder().AddEmbed(embed)
.AddComponents(new List<DiscordComponent> { YouTube, SoundCloud, Spotify })); .AddComponents(new List<DiscordComponent> { YouTube, SoundCloud, Spotify }));
var Menu1 = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(2)); var Menu1 = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(2));

View file

@ -33,14 +33,14 @@ internal sealed class DeleteCommand : BaseCommand
var SelectedPlaylist = MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.First(x => x.PlaylistId == playlistId); 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)), Description = this.GetString(CommandKey.Playlists.Delete.Deleting, true, new TVar("Name", SelectedPlaylist.PlaylistName)),
}.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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); 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)), Description = this.GetString(CommandKey.Playlists.Delete.Deleted, true, new TVar("Name", SelectedPlaylist.PlaylistName)),
}.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title))));

View file

@ -35,7 +35,7 @@ internal sealed class ExportCommand : BaseCommand
using (MemoryStream stream = new(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(SelectedPlaylist, Formatting.Indented)))) 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)), 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)); }.AsInfo(ctx, this.GetString(CommandKey.Playlists.Title))).WithFile($"{Guid.NewGuid().ToString().Replace("-", "").ToLower()}.json", stream));

View file

@ -26,7 +26,7 @@ internal sealed class ImportCommand : BaseCommand
if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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 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("📂"))); 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), Description = this.GetString(CommandKey.Playlists.Import.ImportMethod, true),
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title))) }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)))
@ -84,7 +84,7 @@ internal sealed class ImportCommand : BaseCommand
if (loadResult.LoadType == LavalinkLoadResultType.Error) 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), Description = this.GetString(CommandKey.Playlists.Import.NotLoaded, true),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsError(ctx, this.GetString(CommandKey.Playlists.Title))));
return; 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), Description = this.GetString(CommandKey.Playlists.Import.Creating, true),
}.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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); 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, Description = this.GetString(CommandKey.Playlists.Import.Created, true,
new TVar("Name", v.PlaylistName), new TVar("Name", v.PlaylistName),
@ -127,7 +127,7 @@ internal sealed class ImportCommand : BaseCommand
} }
else 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), Description = this.GetString(CommandKey.Playlists.Import.NotLoaded, true),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsError(ctx, this.GetString(CommandKey.Playlists.Title))));
@ -140,7 +140,7 @@ internal sealed class ImportCommand : BaseCommand
{ {
_ = Menu.Result.Interaction.CreateResponseAsync(InteractionResponseType.DeferredMessageUpdate); _ = 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")), Description = this.GetString(CommandKey.Playlists.Import.UploadExport, true, new TVar("Command", $"{ctx.Prefix}upload")),
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title))));
@ -161,7 +161,7 @@ internal sealed class ImportCommand : BaseCommand
return; 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), Description = this.GetString(CommandKey.Playlists.Import.Importing, true),
}.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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); 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, Description = this.GetString(CommandKey.Playlists.Import.Created, true,
new TVar("Name", v.PlaylistName), new TVar("Name", v.PlaylistName),
@ -204,7 +204,7 @@ internal sealed class ImportCommand : BaseCommand
} }
catch (Exception ex) 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), Description = this.GetString(CommandKey.Playlists.Import.ImportFailed, true),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsError(ctx, this.GetString(CommandKey.Playlists.Title))));

View file

@ -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("📥"))); 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<DiscordComponent> { Confirm, MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot) })); _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(new List<DiscordComponent> { Confirm, MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot) }));
var e = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(1)); var e = await ctx.WaitForButtonAsync(TimeSpan.FromMinutes(1));
@ -81,14 +81,14 @@ internal sealed class LoadShareCommand : BaseCommand
if (e.GetCustomId() == Confirm.CustomId) 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), Description = this.GetString(CommandKey.Playlists.LoadShare.Importing, true),
}.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title))));
if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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); 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)), Description = this.GetString(CommandKey.Playlists.LoadShare.Imported, true, new TVar("Name", ImportJson.PlaylistName)),
}.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title))));

View file

@ -28,7 +28,7 @@ internal sealed class ManageCommand : BaseCommand
return countInt; 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))}" 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))); }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)));

View file

@ -91,7 +91,7 @@ internal sealed class ModifyCommand : BaseCommand
embed.Title = $"{this.GetString(CommandKey.Playlists.Modify.ModifyingPlaylist)}: `{SelectedPlaylist.PlaylistName}`"; embed.Title = $"{this.GetString(CommandKey.Playlists.Modify.ModifyingPlaylist)}: `{SelectedPlaylist.PlaylistName}`";
embed.Description = Description; embed.Description = Description;
embed.Thumbnail = new DiscordEmbedBuilder.EmbedThumbnail { Url = (SelectedPlaylist.PlaylistThumbnail.IsNullOrWhiteSpace() ? "" : SelectedPlaylist.PlaylistThumbnail) }; 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<DiscordComponent> { PreviousPage, NextPage }) .AddComponents(new List<DiscordComponent> { PreviousPage, NextPage })
.AddComponents(new List<DiscordComponent> { AddSong, RemoveSong, RemoveDuplicates }) .AddComponents(new List<DiscordComponent> { AddSong, RemoveSong, RemoveDuplicates })
.AddComponents(new List<DiscordComponent> { PlaylistName, ChangePlaylistColor, ChangePlaylistThumbnail }) .AddComponents(new List<DiscordComponent> { PlaylistName, ChangePlaylistColor, ChangePlaylistThumbnail })
@ -205,7 +205,7 @@ internal sealed class ModifyCommand : BaseCommand
$"⚠ {this.GetString(CommandKey.Playlists.ThumbnailModerationNote, true)}", $"⚠ {this.GetString(CommandKey.Playlists.ThumbnailModerationNote, true)}",
}.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title)); }.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; (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); 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); 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) 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)), Description = this.GetString(CommandKey.Playlists.Delete.Deleted, true, new TVar("Name", SelectedPlaylist.PlaylistName)),
}.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsSuccess(ctx, this.GetString(CommandKey.Playlists.Title))));

View file

@ -29,7 +29,7 @@ internal sealed class NewPlaylistCommand : BaseCommand
{ {
if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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))}" $"`{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)); }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title));
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)
.AddComponents(new List<DiscordComponent> { SelectName, SelectFirstTracks, Finish }) .AddComponents(new List<DiscordComponent> { SelectName, SelectFirstTracks, Finish })
.AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); .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) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsError(ctx, this.GetString(CommandKey.Playlists.Title))));
@ -139,7 +139,7 @@ internal sealed class NewPlaylistCommand : BaseCommand
return; 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), Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Creating, true),
}.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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); 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, Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Created, true,
new TVar("Playlist", v.PlaylistName), new TVar("Playlist", v.PlaylistName),

View file

@ -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) 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) Description = this.GetString(CommandKey.NotSameChannel, true)
}.AsError(ctx))); }.AsError(ctx)));
@ -38,7 +38,7 @@ internal sealed class SaveCurrentCommand : BaseCommand
{ {
if (MusicPlugin.Plugin.Users[ctx.User.Id].Playlists.Length >= 10) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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))}" $"`{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)); }.AsAwaitingInput(ctx, this.GetString(CommandKey.Playlists.Title));
_ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed) _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)
.AddComponents(new List<DiscordComponent> { SelectName, Finish }) .AddComponents(new List<DiscordComponent> { SelectName, Finish })
.AddComponents(MessageComponents.GetCancelButton(ctx.DbUser, ctx.Bot))); .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) 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)), Description = this.GetString(CommandKey.Playlists.PlayListLimit, true, new TVar("Count", 10)),
}.AsError(ctx, this.GetString(CommandKey.Playlists.Title)))); }.AsError(ctx, this.GetString(CommandKey.Playlists.Title))));
@ -111,7 +111,7 @@ internal sealed class SaveCurrentCommand : BaseCommand
return; 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), Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Creating, true),
}.AsLoading(ctx, this.GetString(CommandKey.Playlists.Title)))); }.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); 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, Description = this.GetString(CommandKey.Playlists.CreatePlaylist.Created, true,
new TVar("Playlist", v.PlaylistName), new TVar("Playlist", v.PlaylistName),

View file

@ -41,7 +41,7 @@ internal sealed class ShareCommand : BaseCommand
if (!Directory.Exists($"PlaylistShares/{ctx.User.Id}")) if (!Directory.Exists($"PlaylistShares/{ctx.User.Id}"))
_ = Directory.CreateDirectory($"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, Description = this.GetString(CommandKey.Playlists.Share.Shared, true,
new TVar("Command", $"{ctx.Prefix}playlists load-share {ctx.User.Id} {ShareCode}")), new TVar("Command", $"{ctx.Prefix}playlists load-share {ctx.User.Id} {ShareCode}")),