Skip to content

Commit 3b0dcdd

Browse files
committed
allow help threads to be reopened indefinitely
1 parent 87ce539 commit 3b0dcdd

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

src/modules/helpthread.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ See <#${howToGetHelpChannel}> for info on how to get better help.
8585
// The rate limit for thread naming is 2 time / 10 mins, tracked per thread
8686
const titleSetCooldown = 5 * 60 * 1000;
8787

88-
// Delay before fully closing the thread, in case of hasty closing
89-
const threadCloseDelay = 60 * 1000;
90-
9188
export class HelpThreadModule extends Module {
9289
@listener({ event: 'messageCreate' })
9390
async onNewQuestion(msg: Message) {
@@ -117,7 +114,8 @@ export class HelpThreadModule extends Module {
117114
)
118115
return;
119116
await thread.send({ embeds: [threadExpireEmbed] });
120-
await this.closeThread(thread);
117+
this.manuallyArchivedThreads.add(thread.id);
118+
await thread.setArchived(true);
121119
}
122120

123121
@command({
@@ -141,21 +139,6 @@ export class HelpThreadModule extends Module {
141139
await msg.react('✅');
142140
this.manuallyArchivedThreads.add(thread.id);
143141
await thread.setArchived(true);
144-
thread = (await thread.fetch()) as ThreadChannel;
145-
let archiveTimestamp = thread.archiveTimestamp;
146-
setTimeout(async () => {
147-
thread = (await thread.fetch()) as ThreadChannel;
148-
console.log(
149-
thread.archived,
150-
thread.archivedAt,
151-
archiveTimestamp,
152-
);
153-
if (
154-
thread.archived &&
155-
thread.archiveTimestamp == archiveTimestamp
156-
)
157-
this.closeThread(thread);
158-
}, threadCloseDelay);
159142
} else {
160143
return await sendWithMessageOwnership(
161144
msg,
@@ -164,13 +147,6 @@ export class HelpThreadModule extends Module {
164147
}
165148
}
166149

167-
private async closeThread(thread: ThreadChannel) {
168-
if (thread.archived) await thread.setArchived(false);
169-
this.manuallyArchivedThreads.add(thread.id);
170-
await thread.edit({ archived: true, locked: true });
171-
await HelpThread.delete(thread.id);
172-
}
173-
174150
private helpInfoLocks = new Map<string, Promise<void>>();
175151
private updateHelpInfo(channel: TextChannel) {
176152
this.helpInfoLocks.set(

0 commit comments

Comments
 (0)