From 58967ae5760c0a680583753b0e7ad67cbe322f32 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Thu, 13 Mar 2025 17:42:51 +0100 Subject: [PATCH 1/4] chore: add "discord" tag when creating PB notes * chore: add "discord" tag when creating PB notes * chore: format and lint --- src/commands/product/notes.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/product/notes.ts b/src/commands/product/notes.ts index fa8aaaf..b1dfd9a 100644 --- a/src/commands/product/notes.ts +++ b/src/commands/product/notes.ts @@ -39,6 +39,7 @@ export default { user: { external_id: `discord:${interaction.targetMessage.author.id}` }, source: { origin: "discord", record_id: interaction.targetId }, + tags: ["discord"], }); const replyComponents = []; From f51f4b6748d8bfef737c4095c85d1f4341050eae Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Tue, 29 Apr 2025 18:21:13 +0200 Subject: [PATCH 2/4] fix: fix "open" tag not being set when a member-set tag exists (#17) --- src/commands/util/walkthrough.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/util/walkthrough.ts b/src/commands/util/walkthrough.ts index fe16bae..9c351a7 100644 --- a/src/commands/util/walkthrough.ts +++ b/src/commands/util/walkthrough.ts @@ -40,8 +40,10 @@ export async function doWalkthrough( const threadChannel = channel as PublicThreadChannel; // necessary type cast, isHelpThread does the check already // Check for tags in the forum post - if (!threadChannel.appliedTags || threadChannel.appliedTags.length === 0) { - threadChannel.setAppliedTags([config.helpChannel.openedTag]); + const appliedTags = threadChannel.appliedTags ?? []; + if (!appliedTags.includes(config.helpChannel.openedTag)) { + appliedTags.push(config.helpChannel.openedTag); + threadChannel.setAppliedTags(appliedTags); } // Generate the message with the action row From 8a167c12d86f808139f1081957b6513c1d87f1a4 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Fri, 2 May 2025 13:49:16 +0200 Subject: [PATCH 3/4] fix: reconcile tags when changes occur (#18) --- bun.lockb | Bin 17076 -> 17460 bytes package.json | 3 +- src/commands/util/close.ts | 18 ++++++--- src/events/channels.ts | 80 +++++++++++++++++++++++++++++++++++++ src/index.ts | 2 + 5 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 src/events/channels.ts diff --git a/bun.lockb b/bun.lockb index 276287ac980a5fc01a8515b729fa3a1eb84159e7..287f7c1c4359cb5e8b9f3d5620f9e35b66911393 100755 GIT binary patch delta 3083 zcmb_e3rw6<7QXjq2Ka~mr95YT2ADpPmd*_G0s);Fp$6&*YqQm%%@$KB6*gViSZV-w zL)WxgYuU9Pt*!CZXkrOlwV}9$h!%BYjaoz0r1cRSwniH@ZjEsl(xraqXa2S-HL2N? zocrB#?>YCLbMEu-c6oS*e896b``+&Up4F=-$Mn}K%6k6z@~WYlwQt^j=J-2~=sDL=MmnWV?ohTm{U6T%5pkC`%P04cJ5LW%*5K;AjD)<3J~H z2&e-e2ReY;6W9*4Lv94-0;>~vY;48;B?pea`~7lXe%@2=+QCzDuT<-ifg7M@r7>H% ze1y7_BJyJzPKqctNmEH-WwoSAOIY4R-Ij>#qG6P;(4-}z%t@k3Ygqj)QnCUAB++$N z9$?rSk>AjyHKK$pRGA!>cTsn8L>{7HlwZ+gazt5drOK4BdJDp@gQbPWlFQ{2G@KGq zoXIqm5|&%2A~m9pCJRvu1%(w<3$l`!D7D;L2kCkmwN}YKs!${HRq9qFijqnrYFN20 zm8MkoxxyBaZ&0@l-l{ZW3oENsnz9)^X@*T&L`kvHNLtvMj7+bg(X=Y-t*G5>)DEMz z%BWfA2=N=Ew)#TtY1HbCwtu4*X(TG;r3&#aB6C-lOD{9be2z%Zk0vmwW%%Is2 zLGvCE*p9rj44MUdFV|r>QJgTm5@e@+V0MrX4PyYz#K;bX5?C%~<`?B?V7e5srA5SO z{q@M^znI~~{69+h|2f4*2(CmRmm+7X_exUBW3c{}rI@XLoLN&whAV%4ifP}x&S=VL z@5HXBzijMtRX?Hj-+!cjVDA7`?fL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H$v!V(YIE@_4nR&_)l%S|D}+& zcvXA!ZFah>v*NRpzt`RWUQ4IFDsP})ylP(bWjA^Km=*h~&*$EksuV_0R(olvZwwA8 z&GnV$zliOIY}dSUxbHY`9B}7wMC!uRVQI@#ONRTiT(r$;qi=kpY2t8uXKUHTcuQ7A PSRk(g7eX#=8@u6erS1oN diff --git a/package.json b/package.json index 3abecd6..cc3ee23 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "dependencies": { "@uwu/configmasher": "latest", "discord.js": "^14.15.3", - "ofetch": "^1.4.1" + "ofetch": "^1.4.1", + "throttle-debounce": "^5.0.2" }, "trustedDependencies": [ "@biomejs/biome" diff --git a/src/commands/util/close.ts b/src/commands/util/close.ts index c29f17f..89a1257 100644 --- a/src/commands/util/close.ts +++ b/src/commands/util/close.ts @@ -17,6 +17,17 @@ import { const getStateWord = (close) => (close ? "closed" : "reopened"); const getStateVerb = (close) => (close ? "close" : "reopen"); +export function getTagsForCloseState(close: boolean) { + return { + tagToAdd: close + ? config.helpChannel.closedTag + : config.helpChannel.openedTag, + tagToRemove: close + ? config.helpChannel.openedTag + : config.helpChannel.closedTag, + }; +} + export async function handleIssueState( interaction: ChatInputCommandInteraction, close = true, @@ -29,12 +40,7 @@ export async function handleIssueState( const stateWord = getStateWord(close); const stateVerb = getStateVerb(close); - const tagToAdd = close - ? config.helpChannel.closedTag - : config.helpChannel.openedTag; - const tagToRemove = close - ? config.helpChannel.openedTag - : config.helpChannel.closedTag; + const { tagToAdd, tagToRemove } = getTagsForCloseState(close); const postTags = threadChannel.appliedTags; diff --git a/src/events/channels.ts b/src/events/channels.ts new file mode 100644 index 0000000..f1e2e1b --- /dev/null +++ b/src/events/channels.ts @@ -0,0 +1,80 @@ +import { config } from "../lib/config.js"; +import { getTagsForCloseState } from "../commands/util/close.js"; +import { isHelpPost } from "../lib/discord/channels.js"; + +import { debounce } from "throttle-debounce"; + +import { type Client, Events, type ThreadChannel } from "discord.js"; + +// Map to store initial thread states +const threadUpdateMap = new Map(); + +// Create a debounced handler for processing thread updates +const handleEvent = debounce( + 1000, + async (threadId: string, newThread: ThreadChannel) => { + const initialThread = threadUpdateMap.get(threadId); + if (!initialThread) return; + + // Remove from map + threadUpdateMap.delete(threadId); + + // Handle tag additions + const addedTags = newThread.appliedTags.filter( + (t) => !initialThread.appliedTags.includes(t), + ); + if (addedTags.length > 0) { + for (const tag of addedTags) { + // If closed/opened tag is added, remove the opposite tag + if ( + tag === config.helpChannel.closedTag || + tag === config.helpChannel.openedTag + ) { + const isClose = tag === config.helpChannel.closedTag; + const { tagToRemove } = getTagsForCloseState(isClose); + if (newThread.appliedTags.includes(tagToRemove)) { + await newThread.setAppliedTags( + newThread.appliedTags.filter((t) => t !== tagToRemove), + ); + } + } + } + } + + // Handle tag removals + const removedTags = initialThread.appliedTags.filter( + (t) => !newThread.appliedTags.includes(t), + ); + if (removedTags.length > 0) { + for (const tag of removedTags) { + // If closed or opened tag is removed, add it back only if its opposite isn't present + if ( + tag === config.helpChannel.closedTag || + tag === config.helpChannel.openedTag + ) { + const isClose = tag === config.helpChannel.closedTag; + const { tagToRemove } = getTagsForCloseState(isClose); + if (!newThread.appliedTags.includes(tagToRemove)) { + await newThread.setAppliedTags([...newThread.appliedTags, tag]); + } + } + } + } + }, +); + +export default function registerEvents(client: Client) { + client.on(Events.ThreadUpdate, async (oldThread, newThread) => { + if (!(await isHelpPost(newThread))) { + return; + } + + // Store the initial state if this is the first update + if (!threadUpdateMap.has(newThread.id)) { + threadUpdateMap.set(newThread.id, oldThread); + } + + // Trigger the debounced handler + handleEvent(newThread.id, newThread); + }); +} diff --git a/src/index.ts b/src/index.ts index 8197d75..140f792 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,7 @@ import { config } from "./lib/config.js"; import registerCommandEvents from "./events/commands.js"; import registerWalkthroughEvents from "./events/walkthrough.js"; import registerMessageEvents from "./events/messages.js"; +import registerChannelEvents from "./events/channels.js"; import { Client, Events, GatewayIntentBits, ActivityType } from "discord.js"; @@ -37,6 +38,7 @@ client.once(Events.ClientReady, () => { registerCommandEvents(client); registerWalkthroughEvents(client); registerMessageEvents(client); + registerChannelEvents(client); shufflePresence(); setInterval(shufflePresence, config.presenceDelay); From 851a0b121620156094e168f91285e5a69833b1bd Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Fri, 2 May 2025 15:18:05 +0200 Subject: [PATCH 4/4] feat: add links to some resources in walkthrough (#19) * feat: add links to some resources in walkthrough * fix: fix lockfile * chore: format & lint --- bun.lockb | Bin 17460 -> 17476 bytes src/commands/util/walkthrough.ts | 78 +++++++++++++++++++++++++++---- 2 files changed, 69 insertions(+), 9 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!Jey44IAk%9suNge`31&SP8W5O^8g}-qDBX3p}jC#Gn4ugOVC5cjSE>%p- z!OF36Vk6Fhwi4^c$|*w(JjUFQJ_wukK4vm!(jcshFwcLwt?lhUel{p%o3U*|}@r<&1K-iCHBl?yBOK zWyNlvD(il{?z7OC)y;10RR>aN=R?>@hYmb&xNm>MBPv53*WIOAl=7~qjr0k(*Q2?fKW+RxvYC6x zUmCTARY)n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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}* diff --git a/src/commands/util/walkthrough.ts b/src/commands/util/walkthrough.ts index 9c351a7..eac94bb 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, + type MessageCreateOptions, + type 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); } }