diff --git a/Commands/ScoreSaberCommandAbstractions.cs b/Commands/ScoreSaberCommandAbstractions.cs index 4a0a55a..25d3e5b 100644 --- a/Commands/ScoreSaberCommandAbstractions.cs +++ b/Commands/ScoreSaberCommandAbstractions.cs @@ -39,7 +39,7 @@ internal static class ScoreSaberCommandAbstractions Description = cmd.GetString(CommandKey.Profile.LoadingPlayer, true) }.AsLoading(ctx, "Score Saber"); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); try { @@ -93,7 +93,7 @@ internal static class ScoreSaberCommandAbstractions _ = ShowProfile().Add(ctx.Bot, ctx); ScoreSaberPlugin.Plugin!.Users![ctx.User.Id].ScoreSaberId = Convert.ToUInt64(player.id); - var new_msg = await cmd.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + var new_msg = await cmd.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = cmd.GetString(CommandKey.Profile.LinkSuccessful).Build(true, new TVar("ProfileName", player.name), @@ -119,7 +119,7 @@ internal static class ScoreSaberCommandAbstractions embed = embed.AsError(ctx, "Score Saber"); embed.Description = cmd.GetString(CommandKey.InternalServerError, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); return; } @@ -130,7 +130,7 @@ internal static class ScoreSaberCommandAbstractions embed = embed.AsError(ctx, "Score Saber"); embed.Description = cmd.GetString(CommandKey.ForbiddenError, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); return; } catch (Exception) @@ -153,7 +153,7 @@ internal static class ScoreSaberCommandAbstractions embed = embed.AsError(ctx, "Score Saber"); embed.Description = cmd.GetString(CommandKey.InternalServerError, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); return; } catch (ForbiddenException) @@ -163,7 +163,7 @@ internal static class ScoreSaberCommandAbstractions embed = embed.AsError(ctx, "Score Saber"); embed.Description = cmd.GetString(CommandKey.ForbiddenError, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); return; } catch (Exception) @@ -223,7 +223,7 @@ internal static class ScoreSaberCommandAbstractions if (ScoreSaberPlugin.Plugin!.Users![ctx.User.Id].ScoreSaberId == 0 && AddLinkButton) _ = builder.AddComponents(LinkButton); - _ = await ctx.BaseCommand.RespondOrEdit(builder.WithEmbed(embed).AddComponents((scoreType == ScoreType.Top ? TopScoreInteractionRow : RecentScoreInteractionRow))); + _ = await ctx.BaseCommand.RespondOrEdit(builder.AddEmbed(embed).AddComponents((scoreType == ScoreType.Top ? TopScoreInteractionRow : RecentScoreInteractionRow))); } var LoadedGraph = ""; @@ -258,7 +258,7 @@ internal static class ScoreSaberCommandAbstractions _ = builder.AddComponents(ProfileInteractionRow); } - _ = await ctx.BaseCommand.RespondOrEdit(builder.WithEmbed(embed)); + _ = await ctx.BaseCommand.RespondOrEdit(builder.AddEmbed(embed)); var file = $"{Guid.NewGuid()}.png"; @@ -303,8 +303,8 @@ internal static class ScoreSaberCommandAbstractions LoadedGraph = asset.Attachments[0].Url; embed = embed.AsInfo(ctx, "Score Saber"); - embed.ImageUrl = asset.Attachments[0].Url; - builder = builder.WithEmbed(embed); + embed.ImageUrl = asset.Attachments[0].Url.ToString(); + builder = builder.AddEmbed(embed); _ = builder.AddComponents(ProfileInteractionRow); _ = await ctx.BaseCommand.RespondOrEdit(builder); } @@ -340,22 +340,22 @@ internal static class ScoreSaberCommandAbstractions catch (InternalServerErrorException) { embed.Description = cmd.GetString(CommandKey.InternalServerError, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); } catch (ForbiddenException) { embed.Description = cmd.GetString(CommandKey.ForbiddenError, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); } catch (NotFoundException) { embed.Description = cmd.GetString(CommandKey.Profile.InvalidId, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); } catch (UnprocessableEntityException) { embed.Description = cmd.GetString(CommandKey.Profile.InvalidId, true); - _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await ctx.BaseCommand.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); } catch (Exception) { diff --git a/Commands/ScoreSaberMapLeaderboardCommand.cs b/Commands/ScoreSaberMapLeaderboardCommand.cs index ac27a43..2596ed3 100644 --- a/Commands/ScoreSaberMapLeaderboardCommand.cs +++ b/Commands/ScoreSaberMapLeaderboardCommand.cs @@ -40,7 +40,7 @@ internal sealed class ScoreSaberMapLeaderboardCommand : BaseCommand Description = this.GetString(CommandKey.MapLeaderboard.LoadingScoreboard, true) }.AsLoading(ctx, "Score Saber"); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed)); var NextPageId = Guid.NewGuid().ToString(); var PrevPageId = Guid.NewGuid().ToString(); @@ -63,19 +63,19 @@ internal sealed class ScoreSaberMapLeaderboardCommand : BaseCommand catch (InternalServerErrorException) { embed.Description = this.GetString(CommandKey.InternalServerError, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); return; } catch (NotFoundException) { embed.Description = this.GetString(CommandKey.MapLeaderboard.ScoreboardNotExist, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); throw; } catch (ForbiddenException) { embed.Description = this.GetString(CommandKey.ForbiddenError, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); return; } catch (Exception) @@ -148,7 +148,7 @@ internal sealed class ScoreSaberMapLeaderboardCommand : BaseCommand if (scoreSaberPage > TotalPages) { embed.Description = this.GetString(CommandKey.MapLeaderboard.PageNotExist, true, new TVar("Page", scoreSaberPage)); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); return; } @@ -163,19 +163,19 @@ internal sealed class ScoreSaberMapLeaderboardCommand : BaseCommand catch (InternalServerErrorException) { embed.Description = this.GetString(CommandKey.InternalServerError, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); return; } catch (NotFoundException) { embed.Description = this.GetString(CommandKey.MapLeaderboard.ScoreboardNotExist, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); throw; } catch (ForbiddenException) { embed.Description = this.GetString(CommandKey.ForbiddenError, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); return; } catch (Exception) @@ -201,7 +201,7 @@ internal sealed class ScoreSaberMapLeaderboardCommand : BaseCommand var previousPageButton = new DiscordButtonComponent(ButtonStyle.Primary, PrevPageId, this.GetString(this.t.Common.PreviousPage), (scoreSaberPage + InternalPage - 1 <= 0), new DiscordComponentEmoji(DiscordEmoji.FromUnicode("◀"))); var nextPageButton = new DiscordButtonComponent(ButtonStyle.Primary, NextPageId, this.GetString(this.t.Common.NextPage), (scoreSaberPage + 1 > scores.Metadata.TotalPages / scores.Metadata.ItemCount), new DiscordComponentEmoji(DiscordEmoji.FromUnicode("▶"))); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(new List { previousPageButton, nextPageButton })); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(new List { previousPageButton, nextPageButton })); }; await SendPage(InternalPage, scoreSaberPage); diff --git a/Commands/ScoreSaberProfileCommand.cs b/Commands/ScoreSaberProfileCommand.cs index 7273008..d1e34fb 100644 --- a/Commands/ScoreSaberProfileCommand.cs +++ b/Commands/ScoreSaberProfileCommand.cs @@ -39,7 +39,7 @@ internal sealed class ScoreSaberProfileCommand : BaseCommand user = await ctx.Client.GetUserAsync(Convert.ToUInt64(Regex.Match(id, @"<@((!?)(\d*))>").Groups[3].Value)); else { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Profile.InvalidInput, true) }.AsError(ctx, "Score Saber"))); @@ -51,7 +51,7 @@ internal sealed class ScoreSaberProfileCommand : BaseCommand } catch (DisCatSharp.Exceptions.NotFoundException) { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Profile.NoUser, true) }.AsError(ctx, "Score Saber"))); @@ -65,7 +65,7 @@ internal sealed class ScoreSaberProfileCommand : BaseCommand } else { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Profile.NoProfile, true) }.AsError(ctx, "Score Saber"))); diff --git a/Commands/ScoreSaberSearchCommand.cs b/Commands/ScoreSaberSearchCommand.cs index f38211d..e64fad6 100644 --- a/Commands/ScoreSaberSearchCommand.cs +++ b/Commands/ScoreSaberSearchCommand.cs @@ -64,7 +64,7 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand Description = this.GetString(CommandKey.Search.SelectContinent, true) }.AsAwaitingInput(ctx, "Score Saber"); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(GetContinents("no_country")).AddComponents(start_search_button)); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(GetContinents("no_country")).AddComponents(start_search_button)); CancellationTokenSource tokenSource = new(); var selectedContinent = "no_country"; @@ -95,7 +95,7 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand } var page = GetCountries(selectedContinent, selectedCountry, currentPage); - var builder = new DiscordMessageBuilder().WithEmbed(embed).AddComponents(page); + var builder = new DiscordMessageBuilder().AddEmbed(embed).AddComponents(page); if (currentPage == 1 && ctx.Bot.CountryCodes.List.Where(x => x.Value.ContinentCode.ToLower() == selectedContinent.ToLower()).Count() > 25) { @@ -120,7 +120,7 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand { ctx.Client.ComponentInteractionCreated -= RunDropdownInteraction; embed.Description = this.GetString(CommandKey.Search.Searching, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsLoading(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsLoading(ctx, "Score Saber"))); if (currentFetchedPage != lastFetchedPage) { @@ -134,7 +134,7 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand ctx.Client.ComponentInteractionCreated -= RunDropdownInteraction; embed.Description = this.GetString(CommandKey.InternalServerError, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); return; } catch (ForbiddenException) @@ -143,7 +143,7 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand ctx.Client.ComponentInteractionCreated -= RunDropdownInteraction; embed.Description = this.GetString(CommandKey.ForbiddenError, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); return; } catch (Exception) @@ -182,7 +182,7 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand ctx.Client.ComponentInteractionCreated += RunDropdownInteraction; embed.Description = this.GetString(CommandKey.Search.FoundCount, true, new TVar("TotalCount", lastSearch.metadata.total)); - _ = await this.RespondOrEdit(builder.WithEmbed(embed.AsSuccess(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(builder.AddEmbed(embed.AsSuccess(ctx, "Score Saber"))); } if (e.GetCustomId() == "start_search") @@ -270,8 +270,8 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand selectedContinent = e.Values.First(); _ = selectedContinent != "no_country" - ? await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(GetContinents(selectedContinent)).AddComponents(next_step_button)) - : await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed).AddComponents(GetContinents(selectedContinent)).AddComponents(start_search_button)); + ? await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(GetContinents(selectedContinent)).AddComponents(next_step_button)) + : await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed).AddComponents(GetContinents(selectedContinent)).AddComponents(start_search_button)); } try @@ -289,7 +289,7 @@ internal sealed class ScoreSaberSearchCommand : BaseCommand catch (NotFoundException) { embed.Description = this.GetString(CommandKey.Search.NoSearchResult, true); - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(embed.AsError(ctx, "Score Saber"))); + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(embed.AsError(ctx, "Score Saber"))); } catch (Exception) { diff --git a/Commands/ScoreSaberUnlinkCommand.cs b/Commands/ScoreSaberUnlinkCommand.cs index 86f925e..3ab06d7 100644 --- a/Commands/ScoreSaberUnlinkCommand.cs +++ b/Commands/ScoreSaberUnlinkCommand.cs @@ -26,14 +26,14 @@ internal sealed class ScoreSaberUnlinkCommand : BaseCommand { ScoreSaberPlugin.Plugin!.Users![ctx.User.Id].ScoreSaberId = 0; - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Unlink.Unlinked, true) }.AsSuccess(ctx, "Score Saber"))); } else { - _ = await this.RespondOrEdit(new DiscordMessageBuilder().WithEmbed(new DiscordEmbedBuilder + _ = await this.RespondOrEdit(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder { Description = this.GetString(CommandKey.Unlink.NoLink, true) }.AsError(ctx, "Score Saber")));