From 71e8cf960c90fe5a78385d8751d008914e67b12a Mon Sep 17 00:00:00 2001 From: alyssa Date: Sun, 9 Mar 2025 15:25:33 +0000 Subject: [PATCH] feat(bot): make links in help/stats embeds clickable --- PluralKit.Bot/Commands/Help.cs | 12 +++++++----- PluralKit.Bot/Commands/Misc.cs | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/PluralKit.Bot/Commands/Help.cs b/PluralKit.Bot/Commands/Help.cs index 09980f48..e148714b 100644 --- a/PluralKit.Bot/Commands/Help.cs +++ b/PluralKit.Bot/Commands/Help.cs @@ -12,10 +12,11 @@ public class Help "If PluralKit is useful to you, please consider donating on [Patreon](https://patreon.com/pluralkit) or [Buy Me A Coffee](https://buymeacoffee.com/pluralkit).\n" + "## Use the buttons below to see more info!"; + public static string EmbedFooter = "-# PluralKit by @ske and contributors | Myriad design by @layl, icon by @tedkalashnikov, banner by @fulmine | GitHub: https://github.com/PluralKit/PluralKit/ | Website: https://pluralkit.me/"; + public static Embed helpEmbed = new() { Title = "PluralKit", - Footer = new("PluralKit by @ske and contributors | Myriad design by @layl, icon by @tedkalashnikov, banner by @fulmine | GitHub: https://github.com/PluralKit/PluralKit/ | Website: https://pluralkit.me/"), Color = DiscordUtils.Blue, }; @@ -142,7 +143,7 @@ public class Help => ctx.Rest.CreateMessage(ctx.Channel.Id, new MessageRequest { Content = $"{Emojis.Warn} If you cannot see the rest of this message see [the FAQ]()", - Embeds = new[] { helpEmbed with { Description = Help.Description.Replace("{prefix}", ctx.DefaultPrefix) } }, + Embeds = new[] { helpEmbed with { Description = Help.Description.Replace("{prefix}", ctx.DefaultPrefix), Fields = new Embed.Field[] { new("", EmbedFooter) } } }, Components = new[] { helpPageButtons(ctx.Author.Id) }, }); @@ -156,7 +157,7 @@ public class Help if (ctx.Event.Message.Components.First().Components.Where(x => x.CustomId == ctx.CustomId).First().Style == ButtonStyle.Primary) return ctx.Respond(InteractionResponse.ResponseType.UpdateMessage, new() { - Embeds = new[] { helpEmbed with { Description = Help.Description.Replace("{prefix}", prefix) } }, + Embeds = new[] { helpEmbed with { Description = Help.Description.Replace("{prefix}", prefix), Fields = new Embed.Field[] { new("", EmbedFooter) } } }, Components = new[] { buttons } }); @@ -164,8 +165,9 @@ public class Help return ctx.Respond(InteractionResponse.ResponseType.UpdateMessage, new() { - Embeds = new[] { helpEmbed with { Fields = helpEmbedPages.GetValueOrDefault(ctx.CustomId.Split("-")[2]).Select((item, index) => - new Embed.Field(item.Name.Replace("{prefix}", prefix), item.Value.Replace("{prefix}", prefix))).ToArray() } }, + Embeds = new[] { helpEmbed with { Fields = helpEmbedPages.GetValueOrDefault(ctx.CustomId.Split("-")[2]).Select( + (item, index) => new Embed.Field(item.Name.Replace("{prefix}", prefix), item.Value.Replace("{prefix}", prefix)) + ).Append(new("", EmbedFooter)).ToArray() } }, Components = new[] { buttons } }); } diff --git a/PluralKit.Bot/Commands/Misc.cs b/PluralKit.Bot/Commands/Misc.cs index 93c90088..8688f9ef 100644 --- a/PluralKit.Bot/Commands/Misc.cs +++ b/PluralKit.Bot/Commands/Misc.cs @@ -92,7 +92,7 @@ public class Misc + $"**{stats.db.switches:N0}** switches, **{stats.db.messages:N0}** messages\n" + $"**{stats.db.guilds:N0}** servers with **{stats.db.channels:N0}** channels")); - embed.Footer(Help.helpEmbed.Footer); + embed.Field(new("", Help.EmbedFooter)); var uptime = ((DateTimeOffset)process.StartTime).ToUnixTimeSeconds(); embed.Description($"### PluralKit [{BuildInfoService.Version}](https://github.com/pluralkit/pluralkit/commit/{BuildInfoService.FullVersion})\n" +