Skip to content

Commit 09ad491

Browse files
committed
Bugfix: edit the most recent embed, not oldest
Turns out the array of messages is sorted with the most recent message first. By reversing the array, the bot would sometimes edit a higher-up status embed rather than the most recent one.
1 parent 16239be commit 09ad491

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/modules/helpchan.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,12 @@ export class HelpChanModule extends Module {
346346

347347
let lastMessage = channel.messages.cache
348348
.array()
349-
.reverse()
350349
.filter(m => m.author.id === this.client.user?.id)
351350
.find(m => m.embeds.some(isStatusEmbed));
352351

353352
if (!lastMessage)
354353
lastMessage = (await channel.messages.fetch({ limit: 5 }))
355354
.array()
356-
.reverse()
357355
.filter(m => m.author.id === this.client.user?.id)
358356
.find(m => m.embeds.some(isStatusEmbed));
359357

0 commit comments

Comments
 (0)