From c73dee6ae7caf5f02ba0819463cd1ee52b1da502 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Fri, 2 May 2025 13:13:55 +0000 Subject: [PATCH 1/3] feat: add links to some resources in walkthrough --- src/commands/util/walkthrough.ts | 78 ++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 9 deletions(-) diff --git a/src/commands/util/walkthrough.ts b/src/commands/util/walkthrough.ts index 9c351a7..e3aa9f1 100644 --- a/src/commands/util/walkthrough.ts +++ b/src/commands/util/walkthrough.ts @@ -13,9 +13,64 @@ import { Colors, type PublicThreadChannel, type GuildTextBasedChannel, - FetchMessageOptions, + ButtonBuilder, + ButtonStyle, + ContainerBuilder, + MessageFlags, + SectionBuilder, + SeparatorBuilder, + TextDisplayBuilder, + MessageCreateOptions, + InteractionReplyOptions, } from "discord.js"; +const resourcesMessage = { + flags: MessageFlags.IsComponentsV2, + + components: [ + new ContainerBuilder().addSectionComponents([ + new SectionBuilder() + .addTextDisplayComponents( + new TextDisplayBuilder({ content: "Where to find logs" }), + ) + .setButtonAccessory( + new ButtonBuilder() + .setStyle(ButtonStyle.Link) + .setLabel("Docs") + .setURL("https://coder.com/docs/admin/monitoring/logs"), + ), + + new SectionBuilder() + .addTextDisplayComponents( + new TextDisplayBuilder({ + content: "Troubleshooting templates", + }), + ) + .setButtonAccessory( + new ButtonBuilder() + .setStyle(ButtonStyle.Link) + .setLabel("Docs") + .setURL("https://coder.com/docs/admin/templates/troubleshooting"), + ), + + new SectionBuilder() + .addTextDisplayComponents( + new TextDisplayBuilder({ + content: "Troubleshooting networking", + }), + ) + .setButtonAccessory( + new ButtonBuilder() + .setStyle(ButtonStyle.Link) + .setLabel("Docs") + .setURL("https://coder.com/docs/admin/networking/troubleshooting"), + ), + ]), + + new SeparatorBuilder(), + ], +}; + export function generateQuestion( question: string, component: StringSelectMenuBuilder, @@ -46,13 +101,9 @@ export async function doWalkthrough( threadChannel.setAppliedTags(appliedTags); } - // Generate the message with the action row - const message = generateQuestion( - "What are you creating this issue for?", - issueCategorySelector, - ); - + // Send the resources message (or reply to the user if they're running the command) if (interaction) { + // TODO: also check for components V2, but wait until revamp // If the bot has sent a message that contains an embed in the first 30 messages, then we assume it's the walkthrough message const firstMessage = await threadChannel.fetchStarterMessage(); const walkthroughMessage = await threadChannel.messages @@ -73,11 +124,20 @@ export async function doWalkthrough( ephemeral: true, }); } else { - return interaction.reply(message); + // TODO: fix the fact that it looks weird when the resources message is sent as a reply + await interaction.reply(resourcesMessage as InteractionReplyOptions); } } else { - return channel.send(message); + await channel.send(resourcesMessage as MessageCreateOptions); } + + // Generate the walkthrough message asking the user what they're creating this issue for + const message = generateQuestion( + "What are you creating this issue for?", + issueCategorySelector, + ); + + return channel.send(message); } } From 9afc8c1f95e29e932dbfd9aa46c1c905ef364649 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Fri, 2 May 2025 13:17:00 +0000 Subject: [PATCH 2/3] fix: fix lockfile --- bun.lockb | Bin 17460 -> 17476 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bun.lockb b/bun.lockb index 287f7c1c4359cb5e8b9f3d5620f9e35b66911393..0989ef0ec2f400c8a2da830077694c338712b465 100755 GIT binary patch delta 3422 zcmeHJ3tN*%7M?E`AW9%0AQ40mFoF`2keH+q5=5kt3WAE(3zeb^K`53`MYIGdDA;6)aY>MS;~Vii(!XR$;jbT`z#{`9h*RTkY--*m*MZ&Y3eg^PV#^ z-<*nUqAr`*#dW#tYk3{rI@Z}3F5co+8j$BTwblCLLHH!jo!6D>gT$w#YH(JF-MKxTs6ZHf>BaGDuHV*wMf ziV#a%#~?Hjr0)S801E-xfV% z4zy`l2Wb4=xo_aPqdf+-rdG8HqAfFuJ6)<$&fPt|iISXgN$C*p99 znVeA$BuTy$az5i3NCqNiVwNw2DiCxe5%W<*SQ(%Yfr4}pg8zykvl0|y!#^lSCs|Km zR0yLGab!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Ox}TwzcG;zty6Y971vKz@Yo=nr9s6R0^ zb33DZ&7wh%PuSLPxlk2WHBNB&n~dC{yQ5v&r#wH|aKqZWLensM#7K$qI=(M(HK-Sc zp``l5S=aL}ob3ry1pc|RWR-L7&5`U&?DS~W@HJ9L$`6^vDWz|Pzv1O=gB4)s2tz&lSGn-kbH0Cx+K@~`_KcR3!!^Khnj)Z z6{ahhY?fTfH1uK6y`dMuqej|dJk37|AM|ghJa8H914RJB^>jIhT-RhgK477jD2NX1 zt7qzW+?u$_`$roFHAO^=X)xG|MG~jMQW|Vrg=>IRS1YGiA762BY?*12h=zxu8>@r@ zjisup&T?v;SGY{fpro`(j4bt=bh(eDB(iN4gR%o3NGL27-26Sio&U9S$fRDKLa=Np zy_%B$xS4!*ijhG{XcxrywjEr82qA nq`;}ls5c7FDfyJJ?uv3Fi&quiyZ!a}i|}Ds?Z?8k;otll0RU}* From bb9436eddf8994dcbe43ca1aca34cd2c1199c704 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Fri, 2 May 2025 13:17:19 +0000 Subject: [PATCH 3/3] chore: format & lint --- src/commands/util/walkthrough.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/util/walkthrough.ts b/src/commands/util/walkthrough.ts index e3aa9f1..eac94bb 100644 --- a/src/commands/util/walkthrough.ts +++ b/src/commands/util/walkthrough.ts @@ -20,8 +20,8 @@ import { SectionBuilder, SeparatorBuilder, TextDisplayBuilder, - MessageCreateOptions, - InteractionReplyOptions, + type MessageCreateOptions, + type InteractionReplyOptions, } from "discord.js"; const resourcesMessage = {