From 2def9e04d5c9215fa50bc92a3b13f8641db5c608 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Thu, 18 Mar 2021 08:46:38 -0400 Subject: [PATCH 01/13] Add "occupied help channel" embed https://discord.com/channels/508357248330760243/508357683506708514/821851432235433984 ^As @gencha#0069 points out, once a channel has been claimed, there's still a big 'ol embed just a little ways up that describes the channel as available -- which might contribute to help-channel sniping. This adds a new embed which marks the channel as occupied. It does not use it anywhere yet; that'll come soon. --- src/env.ts | 2 ++ src/modules/helpchan.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/env.ts b/src/env.ts index 8972c0c4..3107728d 100644 --- a/src/env.ts +++ b/src/env.ts @@ -38,3 +38,5 @@ export const ongoingEmptyTimeout = parseInt(process.env.ONGOING_EMPTY_TIMEOUT!); export const TS_BLUE = '#007ACC'; export const GREEN = '#77b155'; +// Picked from Discord's "hourglass" emoji (in ⌛ | Occupied Help Channels) +export const HOURGLASS_ORANGE = '#ffa647'; diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 249b122f..31ee5093 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -12,12 +12,14 @@ import { Guild, TextChannel, GuildMember, + User, } from 'discord.js'; import { HelpUser } from '../entities/HelpUser'; import { categories, TS_BLUE, GREEN, + HOURGLASS_ORANGE, askCooldownRoleId, channelNames, dormantChannelTimeout, @@ -39,6 +41,19 @@ This channel will be dedicated to answering your question only. Others will try For more tips, check out StackOverflow's guide on **[asking good questions](https://stackoverflow.com/help/how-to-ask)**. `; +const occupiedMessage = (tag: string) => ` +**This channel is claimed by @${tag}** + +This channel is dedicated to answering their question only (and any of their follow-up questions). Others will try to answer and help solve the issue. + +**To @${tag}, keep in mind:** +• It's always ok to just ask your question. You don't need permission. +• Explain what you expect to happen and what actually happens. +• Include a code sample and error message, if you got any. + +For more tips, check out StackOverflow's guide on **[asking good questions](https://stackoverflow.com/help/how-to-ask)**. +`; + const DORMANT_MESSAGE = ` This help channel has been marked as **dormant**, and has been moved into the **Help: Dormant** category at the bottom of the channel list. It is no longer possible to send messages in this channel until it becomes available again. @@ -62,6 +77,18 @@ export class HelpChanModule extends Module { } hours of inactivity or when you send !close.`, ); + occupiedEmbed(asker: User) { + return new MessageEmbed() + .setTitle('⌛ Occupied Help Channel') + .setColor(HOURGLASS_ORANGE) + .setDescription(occupiedMessage(asker.tag)) + .setFooter( + `Closes after ${ + dormantChannelTimeout / 60 / 60 / 1000 + } hours of inactivity or when ${asker.username} sends !close.`, + ); + } + DORMANT_EMBED = new MessageEmbed() .setColor(TS_BLUE) .setDescription(DORMANT_MESSAGE); From 3ff4e4648bc6b6d02c4bda0d20b1906deacb2012 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Thu, 18 Mar 2021 20:40:17 -0400 Subject: [PATCH 02/13] Update help status message when channel is claimed --- src/modules/helpchan.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 31ee5093..9b628f96 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -203,6 +203,27 @@ export class HelpChanModule extends Module { this.busyChannels.add(msg.channel.id); + let lastMessage = msg.channel.messages.cache + .array() + .reverse() + .find(m => m.author.id === this.client.user?.id); + + if (!lastMessage) + lastMessage = (await msg.channel.messages.fetch({ limit: 5 })) + .array() + .reverse() + .find(m => m.author.id === this.client.user?.id); + + let embed = this.occupiedEmbed(msg.author); + + if (lastMessage) { + // If there is a last message (the available message) by the bot, edit it + await lastMessage.edit(embed); + } else { + // Otherwise, just send a new message + await msg.channel.send(embed); + } + await msg.pin(); await this.addCooldown(msg.member, msg.channel); await this.moveChannel(msg.channel, categories.ongoing); From 6a5cda26efbbeed403abb96af45e921ceeed2750 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Thu, 18 Mar 2021 21:34:53 -0400 Subject: [PATCH 03/13] Also update the status for the !claim command Pull updateStatusEmbed out into a helper function while we're at it, used for changing the status from dormant to available, too. Occupied => dormant doesn't need to update the status since it always adds a new message. Maybe it doesn't need to when someone deletes their question, though.. --- src/modules/helpchan.ts | 63 +++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 9b628f96..7e82bd42 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -203,27 +203,9 @@ export class HelpChanModule extends Module { this.busyChannels.add(msg.channel.id); - let lastMessage = msg.channel.messages.cache - .array() - .reverse() - .find(m => m.author.id === this.client.user?.id); - - if (!lastMessage) - lastMessage = (await msg.channel.messages.fetch({ limit: 5 })) - .array() - .reverse() - .find(m => m.author.id === this.client.user?.id); - let embed = this.occupiedEmbed(msg.author); - if (lastMessage) { - // If there is a last message (the available message) by the bot, edit it - await lastMessage.edit(embed); - } else { - // Otherwise, just send a new message - await msg.channel.send(embed); - } - + await this.updateStatusEmbed(msg.channel, embed); await msg.pin(); await this.addCooldown(msg.member, msg.channel); await this.moveChannel(msg.channel, categories.ongoing); @@ -292,24 +274,7 @@ export class HelpChanModule extends Module { ); if (dormant && dormant instanceof TextChannel) { await this.moveChannel(dormant, categories.ask); - - let lastMessage = dormant.messages.cache - .array() - .reverse() - .find(m => m.author.id === this.client.user?.id); - - if (!lastMessage) - lastMessage = (await dormant.messages.fetch({ limit: 5 })) - .array() - .find(m => m.author.id === this.client.user?.id); - - if (lastMessage) { - // If there is a last message (the dormant message) by the bot, just edit it - await lastMessage.edit(this.AVAILABLE_EMBED); - } else { - // Otherwise, just send a new message - await dormant.send(this.AVAILABLE_EMBED); - } + await this.updateStatusEmbed(dormant, this.AVAILABLE_EMBED); } else { const chan = await guild.channels.create( this.getChannelName(guild), @@ -369,6 +334,27 @@ export class HelpChanModule extends Module { } } + private async updateStatusEmbed(channel: TextChannel, embed: MessageEmbed) { + let lastMessage = channel.messages.cache + .array() + .reverse() + .find(m => m.author.id === this.client.user?.id); + + if (!lastMessage) + lastMessage = (await channel.messages.fetch({ limit: 5 })) + .array() + .reverse() + .find(m => m.author.id === this.client.user?.id); + + if (lastMessage) { + // If there is a last message (the status message) by the bot, edit it + await lastMessage.edit(embed); + } else { + // Otherwise, just send a new message + await channel.send(embed); + } + } + private async addCooldown(member: GuildMember, channel: TextChannel) { await member.roles.add(askCooldownRoleId); const helpUser = new HelpUser(); @@ -463,7 +449,10 @@ export class HelpChanModule extends Module { .setAuthor(member.displayName, member.user.displayAvatarURL()) .setDescription(msgContent), ); + await toPin.pin(); + const occupied = this.updateOccupiedEmbed(msg.author); + await this.updateStatusEmbed(claimedChannel, occupied); await this.addCooldown(member, claimedChannel); await this.moveChannel(claimedChannel, categories.ongoing); await claimedChannel.send( From 4d51ec21bb7ac8867bf6dfacb879f2e1f2d139f2 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Thu, 18 Mar 2021 22:08:50 -0400 Subject: [PATCH 04/13] Update checkEmptyOngoing to reflect occupied embed It used to check against the available embed contents, but there's a new embed in town! We also need to check against the title now, because the occupied embed body changes depending on who claimed the channel. --- src/modules/helpchan.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 7e82bd42..a3fb1cfc 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -77,10 +77,12 @@ export class HelpChanModule extends Module { } hours of inactivity or when you send !close.`, ); + OCCUPIED_EMBED_BASE = new MessageEmbed() + .setTitle('⌛ Occupied Help Channel') + .setColor(HOURGLASS_ORANGE); + occupiedEmbed(asker: User) { - return new MessageEmbed() - .setTitle('⌛ Occupied Help Channel') - .setColor(HOURGLASS_ORANGE) + return new MessageEmbed(this.OCCUPIED_EMBED_BASE) .setDescription(occupiedMessage(asker.tag)) .setFooter( `Closes after ${ @@ -144,9 +146,8 @@ export class HelpChanModule extends Module { const embed = messages.first()?.embeds[0]; return ( - embed && - embed.description?.trim() === - this.AVAILABLE_EMBED.description?.trim() + embed?.title && + embed.title.trim() === this.OCCUPIED_EMBED_BASE.title?.trim() ); } @@ -451,7 +452,7 @@ export class HelpChanModule extends Module { ); await toPin.pin(); - const occupied = this.updateOccupiedEmbed(msg.author); + const occupied = this.occupiedEmbed(msg.author); await this.updateStatusEmbed(claimedChannel, occupied); await this.addCooldown(member, claimedChannel); await this.moveChannel(claimedChannel, categories.ongoing); From 4816e5040ed31e5c85527528680b94824a178f84 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Fri, 19 Mar 2021 16:13:48 -0400 Subject: [PATCH 05/13] Properly generate mentions in occupied help embed --- src/modules/helpchan.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index a3fb1cfc..1578d9ee 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -41,12 +41,12 @@ This channel will be dedicated to answering your question only. Others will try For more tips, check out StackOverflow's guide on **[asking good questions](https://stackoverflow.com/help/how-to-ask)**. `; -const occupiedMessage = (tag: string) => ` -**This channel is claimed by @${tag}** +const occupiedMessage = (asker: User) => ` +**This channel is claimed by ${asker.toString()}** This channel is dedicated to answering their question only (and any of their follow-up questions). Others will try to answer and help solve the issue. -**To @${tag}, keep in mind:** +**To ${asker.toString()}, keep in mind:** • It's always ok to just ask your question. You don't need permission. • Explain what you expect to happen and what actually happens. • Include a code sample and error message, if you got any. @@ -83,11 +83,11 @@ export class HelpChanModule extends Module { occupiedEmbed(asker: User) { return new MessageEmbed(this.OCCUPIED_EMBED_BASE) - .setDescription(occupiedMessage(asker.tag)) + .setDescription(occupiedMessage(asker)) .setFooter( `Closes after ${ dormantChannelTimeout / 60 / 60 / 1000 - } hours of inactivity or when ${asker.username} sends !close.`, + } hours of inactivity or when ${asker.toString()} sends !close.`, ); } From de5123c6be4db6900ca1b8832998bd64474ce6c1 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Fri, 19 Mar 2021 16:49:28 -0400 Subject: [PATCH 06/13] Bugfix: don't mistake any embed for a status embed When changing the channel status, the bot will update a previous embed if it's in the bottom 5 messages, rather than sending a new message. However, we were detecting *any* embed from the bot, rather than only status messages, so it would also replace playground links, for example. This detects status embeds by comparing their titles. In order to do that, it adds a title to the dormant embed. This isn't *necessary*; the following code would work instead: const isStatusEmbed = (embed: MessageEmbed) => ( embed.title === this.AVAILABLE_EMBED.title || embed.title === this.OCCUPIED_EMBED_BASE.title || embed.description === this.DORMANT_EMBED.description ); However, this way is both cleaner code-wise, and I think it's nice for all the status embeds to have the same format. --- src/modules/helpchan.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 1578d9ee..6157bc45 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -92,6 +92,7 @@ export class HelpChanModule extends Module { } DORMANT_EMBED = new MessageEmbed() + .setTitle('💤 Dormant Help Channel') .setColor(TS_BLUE) .setDescription(DORMANT_MESSAGE); @@ -336,16 +337,25 @@ export class HelpChanModule extends Module { } private async updateStatusEmbed(channel: TextChannel, embed: MessageEmbed) { + const isStatusEmbed = (embed: MessageEmbed) => + [ + this.AVAILABLE_EMBED.title, + this.OCCUPIED_EMBED_BASE.title, + this.DORMANT_EMBED.title, + ].includes(embed.title); + let lastMessage = channel.messages.cache .array() .reverse() - .find(m => m.author.id === this.client.user?.id); + .filter(m => m.author.id === this.client.user?.id) + .find(m => m.embeds.some(isStatusEmbed)); if (!lastMessage) lastMessage = (await channel.messages.fetch({ limit: 5 })) .array() .reverse() - .find(m => m.author.id === this.client.user?.id); + .filter(m => m.author.id === this.client.user?.id) + .find(m => m.embeds.some(isStatusEmbed)); if (lastMessage) { // If there is a last message (the status message) by the bot, edit it From 15bbbf0d52e4256351f4ee33c0416512767bf4cf Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Sat, 20 Mar 2021 09:30:52 -0400 Subject: [PATCH 07/13] Clean up occupied embed - "To @person" looks awkward; dropped the "To " - Mentions don't work in the footer, just use the username instead --- src/modules/helpchan.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 6157bc45..683cdd7f 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -46,7 +46,7 @@ const occupiedMessage = (asker: User) => ` This channel is dedicated to answering their question only (and any of their follow-up questions). Others will try to answer and help solve the issue. -**To ${asker.toString()}, keep in mind:** +**${asker.toString()}, keep in mind:** • It's always ok to just ask your question. You don't need permission. • Explain what you expect to happen and what actually happens. • Include a code sample and error message, if you got any. @@ -87,7 +87,7 @@ export class HelpChanModule extends Module { .setFooter( `Closes after ${ dormantChannelTimeout / 60 / 60 / 1000 - } hours of inactivity or when ${asker.toString()} sends !close.`, + } hours of inactivity or when ${asker.username} sends !close.`, ); } From 16239bef3d60f56e8f753bbaa42f5ee88c98a88f Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Sat, 20 Mar 2021 12:13:11 -0400 Subject: [PATCH 08/13] Only require SSL DB connection in production When running the bot locally, for development, SSL is an unnecessary extra setup step that makes it harder to get started. --- src/db.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/db.ts b/src/db.ts index 03444638..44a35261 100644 --- a/src/db.ts +++ b/src/db.ts @@ -8,18 +8,26 @@ let db: Connection | undefined; export async function getDB() { if (db) return db; + // Require ssl in production + const extraOpts = + process.env.NODE_ENV === 'production' + ? { + ssl: true, + extra: { + ssl: { + rejectUnauthorized: false, + }, + }, + } + : {}; + db = await createConnection({ type: 'postgres', url: dbUrl, synchronize: true, logging: false, entities: [RepUser, RepGive, HelpUser], - ssl: true, - extra: { - ssl: { - rejectUnauthorized: false, - }, - }, + ...extraOpts, }); console.log('Connected to DB'); return db; From 09ad491705708010aa95a222c9d389efe2e0fee7 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Sat, 20 Mar 2021 14:36:00 -0400 Subject: [PATCH 09/13] Bugfix: edit the most recent embed, not oldest Turns out the array of messages is sorted with the most recent message first. By reversing the array, the bot would sometimes edit a higher-up status embed rather than the most recent one. --- src/modules/helpchan.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 683cdd7f..ff238197 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -346,14 +346,12 @@ export class HelpChanModule extends Module { let lastMessage = channel.messages.cache .array() - .reverse() .filter(m => m.author.id === this.client.user?.id) .find(m => m.embeds.some(isStatusEmbed)); if (!lastMessage) lastMessage = (await channel.messages.fetch({ limit: 5 })) .array() - .reverse() .filter(m => m.author.id === this.client.user?.id) .find(m => m.embeds.some(isStatusEmbed)); From 9c71469381dbdc8dbe9b5284bc86b6d3580add7f Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Mon, 22 Mar 2021 10:50:32 -0400 Subject: [PATCH 10/13] Update Occupied Help Channel status message embed Updates the text to reflect things we commonly tell people with regard to asking good questions. --- src/modules/helpchan.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index ff238197..722b7384 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -26,6 +26,7 @@ import { dormantChannelLoop, askHelpChannelId, ongoingEmptyTimeout, + trustedRoleId, } from '../env'; import { isTrustedMember } from '../util/inhibitors'; @@ -42,14 +43,15 @@ For more tips, check out StackOverflow's guide on **[asking good questions](http `; const occupiedMessage = (asker: User) => ` -**This channel is claimed by ${asker.toString()}** +**This channel is claimed by ${asker.toString()}.** +It is dedicated to answering their questions only. -This channel is dedicated to answering their question only (and any of their follow-up questions). Others will try to answer and help solve the issue. +**${asker.toString()} You'll get better and faster answers if you:** +• Describe the context. What are you trying to accomplish? +• Copy-paste a short snippet (5-15 lines) that includes the problem. Start code blocks with \`\\\`\`ts for syntax highlighting. +• Try to reproduce your problem in the **[TypeScript Playground](https://www.typescriptlang.org/play)**. -**${asker.toString()}, keep in mind:** -• It's always ok to just ask your question. You don't need permission. -• Explain what you expect to happen and what actually happens. -• Include a code sample and error message, if you got any. +Usually someone will try to answer and help solve the issue within a few hours. If not, and you have followed the bullets above, you may ping the <@&${trustedRoleId}> role. For more tips, check out StackOverflow's guide on **[asking good questions](https://stackoverflow.com/help/how-to-ask)**. `; From 7a617bf15a6b09520df6838d7af534845bfc9d45 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Mon, 22 Mar 2021 12:22:43 -0400 Subject: [PATCH 11/13] Fix: always update the most recent help status The message cache does not have a stable order (I suspect it is simply the order in which the messages were added to the cache). Thus, when searching for the latest status message, sometimes a message other than the latest was picked. In practice, it seems like this only ever happened when the bot was offline for a number of hours, which is why it hasn't come up in production. But in development, it could be reproduced by: - Leave the bot offline for a while (24h?) - Start the bot - Claim a channel - The channel that is moved up from being dormant has the wrong message edited, so the message at the bottom still says "dormant". I suspect this is what the `.reverse()`, which was removed in commit 09ad491705708010aa95a222c9d389efe2e0fee7, was intended to solve (but it caused bugs during normal operation). This should be a full fix. I am not sure of the performance implications here. I think it should not be too bad, because we are filtering to only messages from the bot, before sorting. --- src/modules/helpchan.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 722b7384..7ed9d7ff 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -346,12 +346,16 @@ export class HelpChanModule extends Module { this.DORMANT_EMBED.title, ].includes(embed.title); + // The message cache does not have a stable order (at least with respect + // to creation date), so sorting is needed to find the latest embed. let lastMessage = channel.messages.cache .array() .filter(m => m.author.id === this.client.user?.id) + .sort((m1, m2) => m2.createdTimestamp - m1.createdTimestamp) .find(m => m.embeds.some(isStatusEmbed)); if (!lastMessage) + // Fetch has a stable order, with recent messages first lastMessage = (await channel.messages.fetch({ limit: 5 })) .array() .filter(m => m.author.id === this.client.user?.id) From b8baf21e1d315166d505b6ce0910ec1f96664a49 Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Tue, 23 Mar 2021 13:53:09 -0400 Subject: [PATCH 12/13] Update help channel occupied status message Based on code review & feedback: - Drop explicit `.toString()` in the template. - Add a link to the how-to-get-help channel. - Be explicit that code blocks > screenshots. - Be explicit that it may be impossible to reproduce in the playground. --- src/modules/helpchan.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 7ed9d7ff..43608b97 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -42,14 +42,20 @@ This channel will be dedicated to answering your question only. Others will try For more tips, check out StackOverflow's guide on **[asking good questions](https://stackoverflow.com/help/how-to-ask)**. `; +// The "empty" line has a braille pattern blank unicode character, in order to +// achieve a leading newline, since normally whitespace is stripped. This is a +// hack, but it works even on a system without the fonts to display Discord +// emoji, so it should work everywhere. https://www.compart.com/en/unicode/U+2800 const occupiedMessage = (asker: User) => ` -**This channel is claimed by ${asker.toString()}.** -It is dedicated to answering their questions only. +⠀ +**This channel is claimed by ${asker}.** +It is dedicated to answering their questions only. More info: <#${askHelpChannelId}> -**${asker.toString()} You'll get better and faster answers if you:** +**${asker} You'll get better and faster answers if you:** • Describe the context. What are you trying to accomplish? -• Copy-paste a short snippet (5-15 lines) that includes the problem. Start code blocks with \`\\\`\`ts for syntax highlighting. -• Try to reproduce your problem in the **[TypeScript Playground](https://www.typescriptlang.org/play)**. +• Include any error messages, and the code that produce them (5-15 lines). +• Use code blocks, not screenshots. Start with ${'```ts'} for syntax highlighting. +• Also reproduce the issue in the **[TypeScript Playground](https://www.typescriptlang.org/play)**, if possible. Usually someone will try to answer and help solve the issue within a few hours. If not, and you have followed the bullets above, you may ping the <@&${trustedRoleId}> role. From c18e1f70c50edbfdc633ae68e7b06b4f95933c3e Mon Sep 17 00:00:00 2001 From: Stephen Michel Date: Tue, 23 Mar 2021 14:05:04 -0400 Subject: [PATCH 13/13] Fix: set !claim command sets embed asker correctly It was setting the person who wrote "!claim", rather than the person who the channel was being claimed for. --- src/modules/helpchan.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 43608b97..5cfca5e7 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -472,7 +472,7 @@ export class HelpChanModule extends Module { ); await toPin.pin(); - const occupied = this.occupiedEmbed(msg.author); + const occupied = this.occupiedEmbed(member.user); await this.updateStatusEmbed(claimedChannel, occupied); await this.addCooldown(member, claimedChannel); await this.moveChannel(claimedChannel, categories.ongoing);