Skip to content

Commit 0590efa

Browse files
authored
Merge pull request #182 from Josh-Cena/prefix-title
prefix default thread title with "Help" & open threads with [Open]
2 parents 5284d79 + 9b3d15a commit 0590efa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/modules/helpthread.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class HelpThreadModule extends Module {
9292
if (msg.author.id === this.client.user!.id) return;
9393
this.updateHelpInfo(msg.channel);
9494
let thread = await msg.startThread({
95-
name: msg.member?.nickname ?? msg.author.username,
95+
name: `[Open] Help ${msg.member?.nickname ?? msg.author.username}`,
9696
autoArchiveDuration: ThreadAutoArchiveDuration.OneDay,
9797
});
9898
thread.send(helpThreadWelcomeMessage(msg.member!));
@@ -115,7 +115,7 @@ export class HelpThreadModule extends Module {
115115
return;
116116
await thread.send({ embeds: [threadExpireEmbed] });
117117
this.manuallyArchivedThreads.add(thread.id);
118-
await thread.setName(`[Closed]: ${thread.name}`);
118+
await thread.setName(`[Closed] ${thread.name.replace(/\[.+?] /, '')}`);
119119
await thread.setArchived(true);
120120
}
121121

@@ -139,7 +139,9 @@ export class HelpThreadModule extends Module {
139139
) {
140140
await msg.react('✅');
141141
this.manuallyArchivedThreads.add(thread.id);
142-
await thread.setName(`[Closed]: ${thread.name}`);
142+
await thread.setName(
143+
`[Closed] ${thread.name.replace(/\[.+?] /, '')}`,
144+
);
143145
await thread.setArchived(true);
144146
} else {
145147
return await sendWithMessageOwnership(
@@ -261,7 +263,7 @@ export class HelpThreadModule extends Module {
261263
HelpThread.update(thread.id, {
262264
titleSetTimestamp: Date.now() + '',
263265
}),
264-
msg.channel.setName(`${username} - ${title}`),
266+
msg.channel.setName(`[Open] ${username} - ${title}`),
265267
]);
266268
}
267269

0 commit comments

Comments
 (0)