Skip to content

Commit 554a4ea

Browse files
committed
Only consider messages under 5 minutes old in autoreact on_message_update, prevent the bot adding reactions to very old messages that are supurriously updated
1 parent 8abfaea commit 554a4ea

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/modules/tccpp/components/autoreact.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ export default class Autoreact extends BotComponent {
173173
) {
174174
return;
175175
}
176+
// Only consider messages under 5 minutes old to prevent reactions on very old messages
177+
if (new_message.createdTimestamp && Date.now() - new_message.createdTimestamp > 5 * MINUTE) {
178+
return;
179+
}
176180
if (new_message.channel.id == this.wheatley.channels.memes) {
177181
const bot_starred = new_message.reactions.cache.get("⭐")?.users.cache.has(this.wheatley.user.id);
178182
// If we haven't stared (or don't know if we've starred) and the new message has media, star

0 commit comments

Comments
 (0)