Skip to content

Commit d3145ce

Browse files
committed
allow helpers to close threads
1 parent 59f380b commit d3145ce

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/modules/helpthread.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ Consider rephrasing the question to maximize your chance of getting a good answe
2929
If you're not sure how, have a look through [StackOverflow's guide on asking a good question](https://stackoverflow.com/help/how-to-ask).
3030
`);
3131

32+
const helperCloseEmbed = (member: GuildMember) =>
33+
new MessageEmbed().setColor(BLOCKQUOTE_GREY).setDescription(`
34+
Because your issue seemed to be resolved, this thread was closed by ${member}.
35+
36+
If your issue is not resolved, **you can post another message here and the thread will automatically re-open**.
37+
38+
*If you have a different question, just ask in <#${generalHelpChannel}>.*
39+
`);
40+
3241
// A zero-width space (necessary to prevent discord from trimming the leading whitespace), followed by a three non-breaking spaces.
3342
const indent = '\u200b\u00a0\u00a0\u00a0';
3443

@@ -161,12 +170,19 @@ export class HelpThreadModule extends Module {
161170
let thread: ThreadChannel = msg.channel;
162171
const threadData = (await HelpThread.findOne(thread.id))!;
163172

173+
const isOwner = threadData.ownerId === msg.author.id;
174+
164175
if (
165-
threadData.ownerId === msg.author.id ||
176+
isOwner ||
177+
msg.member?.roles.cache.has(trustedRoleId) ||
166178
msg.member?.permissions.has('MANAGE_MESSAGES')
167179
) {
168180
console.log(`Closing help thread:`, thread);
169181
await msg.react('✅');
182+
if (!isOwner)
183+
await msg.channel.send({
184+
embeds: [helperCloseEmbed(msg.member!)],
185+
});
170186
this.manuallyArchivedThreads.add(thread.id);
171187
await this.archiveThread(thread);
172188
} else {

0 commit comments

Comments
 (0)