Skip to content

Commit 6aa285a

Browse files
authored
Merge branch 'master' into fix-helper
2 parents abe6a92 + ded352d commit 6aa285a

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/modules/helpthread.ts

Lines changed: 25 additions & 3 deletions
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

@@ -80,7 +89,8 @@ If not, and if you have followed the bullets above, you can ping helpers by runn
8089
];
8190

8291
const helpThreadWelcomeMessage = (owner: GuildMember) => `
83-
${owner} This thread is for your question; when it's resolved, please type \`!close\`. \
92+
${owner} This thread is for your question; type \`!title <brief description>\`. \
93+
When it's resolved, please type \`!close\`. \
8494
See <#${howToGetHelpChannel}> for info on how to get better help.
8595
`;
8696

@@ -141,8 +151,12 @@ export class HelpThreadModule extends Module {
141151
this.manuallyArchivedThreads.delete(thread.id)
142152
)
143153
return;
154+
const threadData = (await HelpThread.findOne(thread.id))!;
144155
console.log(`Help thread expired:`, thread);
145-
await thread.send({ embeds: [threadExpireEmbed] });
156+
await thread.send({
157+
content: `<@${threadData.ownerId}>`,
158+
embeds: [threadExpireEmbed],
159+
});
146160
this.manuallyArchivedThreads.add(thread.id);
147161
await this.archiveThread(thread);
148162
}
@@ -161,12 +175,20 @@ export class HelpThreadModule extends Module {
161175
let thread: ThreadChannel = msg.channel;
162176
const threadData = (await HelpThread.findOne(thread.id))!;
163177

178+
const isOwner = threadData.ownerId === msg.author.id;
179+
164180
if (
165-
threadData.ownerId === msg.author.id ||
181+
isOwner ||
182+
msg.member?.roles.cache.has(trustedRoleId) ||
166183
msg.member?.permissions.has('MANAGE_MESSAGES')
167184
) {
168185
console.log(`Closing help thread:`, thread);
169186
await msg.react('✅');
187+
if (!isOwner)
188+
await msg.channel.send({
189+
content: `<@${threadData.ownerId}>`,
190+
embeds: [helperCloseEmbed(msg.member!)],
191+
});
170192
this.manuallyArchivedThreads.add(thread.id);
171193
await this.archiveThread(thread);
172194
} else {

0 commit comments

Comments
 (0)