Commit de5123c
committed
Bugfix: don't mistake any embed for a status embed
When changing the channel status, the bot will update a previous embed
if it's in the bottom 5 messages, rather than sending a new message.
However, we were detecting *any* embed from the bot, rather than only
status messages, so it would also replace playground links, for example.
This detects status embeds by comparing their titles. In order to do
that, it adds a title to the dormant embed. This isn't *necessary*; the
following code would work instead:
const isStatusEmbed = (embed: MessageEmbed) => (
embed.title === this.AVAILABLE_EMBED.title ||
embed.title === this.OCCUPIED_EMBED_BASE.title ||
embed.description === this.DORMANT_EMBED.description
);
However, this way is both cleaner code-wise, and I think it's nice for
all the status embeds to have the same format.1 parent 4816e50 commit de5123c
1 file changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
339 | 347 | | |
340 | 348 | | |
341 | 349 | | |
342 | | - | |
| 350 | + | |
| 351 | + | |
343 | 352 | | |
344 | 353 | | |
345 | 354 | | |
346 | 355 | | |
347 | 356 | | |
348 | | - | |
| 357 | + | |
| 358 | + | |
349 | 359 | | |
350 | 360 | | |
351 | 361 | | |
| |||
0 commit comments