Skip to content

Commit 18d100c

Browse files
committed
review changes
1 parent 6476307 commit 18d100c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

.env.example

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ ASK_COOLDOWN_ROLE=
2222

2323
CHANNEL_NAMES=list,help,channel,names,here,seperated,by,commas
2424

25-
# In milliseconds
25+
# Following variables are in milliseconds
2626
DORMANT_CHANNEL_TIMEOUT=
27-
# In milliseconds
2827
DORMANT_CHANNEL_LOOP=
29-
30-
# In milliseconds
3128
ONGOING_EMPTY_TIMEOUT=

src/modules/helpchan.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ export class HelpChanModule extends Module {
6767
.setDescription(DORMANT_MESSAGE);
6868

6969
busyChannels: Set<string> = new Set(); // a lock to eliminate race conditions
70-
// a lock used to prevent multiple timeouts running on the same channel
71-
ongoingEmptyTimeouts: Set<string> = new Set();
70+
ongoingEmptyTimeouts: Set<string> = new Set(); // a lock used to prevent multiple timeouts running on the same channel
7271

7372
private getChannelName(guild: Guild) {
7473
const takenChannelNames = guild.channels.cache
@@ -115,7 +114,7 @@ export class HelpChanModule extends Module {
115114
async checkEmptyOngoing(channel: TextChannel) {
116115
const messages = await channel.messages.fetch();
117116

118-
return messages.array()[0].author.id === this.client.user?.id;
117+
return messages.first()?.author.id === this.client.user?.id;
119118
}
120119

121120
async startEmptyTimeout(channel: TextChannel) {
@@ -309,7 +308,8 @@ export class HelpChanModule extends Module {
309308
for (const channel of this.getOngoingChannels()) {
310309
const messages = await channel.messages.fetch();
311310

312-
const diff = Date.now() - messages.array()[0].createdAt.getTime();
311+
const diff =
312+
Date.now() - (messages.first()?.createdAt.getTime() ?? 0);
313313

314314
if (diff > dormantChannelTimeout)
315315
await this.markChannelAsDormant(channel);

0 commit comments

Comments
 (0)