How do I listen for reactions on all messages in a channel?

doing discord bot dev after a long time. i wanted to listen for message reactions on every message in a channel and run a db query in the run function. but for some reason i can't even get a simple log to work rn. what am i doing wrong here?
// src/listeners/reaction.ts

import { ApplyOptions } from "@sapphire/decorators";
import { Events, Listener } from "@sapphire/framework";

@ApplyOptions<Listener.Options>({
event: Events.MessageReactionAdd,
enabled: true,
once: false,
name: "reaction",
})
export class UserEvent extends Listener {
public async run() {
const { logger } = this.container;
logger.info("Reaction added");
}
}
// src/listeners/reaction.ts

import { ApplyOptions } from "@sapphire/decorators";
import { Events, Listener } from "@sapphire/framework";

@ApplyOptions<Listener.Options>({
event: Events.MessageReactionAdd,
enabled: true,
once: false,
name: "reaction",
})
export class UserEvent extends Listener {
public async run() {
const { logger } = this.container;
logger.info("Reaction added");
}
}
Solution:
Do you have the GuildMessageReactions Intent enabled? And that event only triggers on cached messages so you would also need to enable the partials for reaction and I believe message....
Jump to solution
8 Replies
Solution
Stasium
Stasium2y ago
Do you have the GuildMessageReactions Intent enabled? And that event only triggers on cached messages so you would also need to enable the partials for reaction and I believe message.
nexxel
nexxelOP2y ago
i think i do have it enabled
And that event only triggers on cached messages so you would also need to enable the partials for reaction and I believe message.
what does this mean exactly?
Stasium
Stasium2y ago
cached messages are messages that has been sent after the bot is online, so once you restart the bot the previous messages are no longer cached
nexxel
nexxelOP2y ago
ah interesting for this bot i def have to keep checking the reactions for old messages as well is there a way to do that if the bot went offline for some time?
Stasium
Stasium2y ago
have a look at partials then
nexxel
nexxelOP2y ago
do you have a link to some kind of documentation or example? oh wait is it just an intent
Stasium
Stasium2y ago
discordjs guide has an example
nexxel
nexxelOP2y ago
ah got it thanks so much!
Want results from more Discord servers?
Add your server