Error to retrieve data from "raw" event

Asked

Viewed 44 times

0

Well, I have a bot with this event:

Bot.on('raw', async (event) => {

  if (event.t == "MESSAGE_REACTION_ADD") {

const { d: data } = event;
const user = Bot.users.fetch(data.user_id);
const channel = Bot.channels.cache.get(data.channel_id)
const message = await channel.messages.fetch(data.message_id);

console.log(event.d.emoji.name)
}
});

But I’m making the following mistake:

TypeError: Bot.users.fetch is not a function

This worked on the old BOT. I know there is a specific event for MESSAGE_REACTION_ADD, but it doesn’t work for me.

If you can help me, I’d appreciate it.

the function is for a BOT for Discord

  • What library are you using? If it is discord.js, I tried to use the guide (https://discordjs.guide/creating-your-bot/#start-up-code-Explained) plus its code and it worked, I used version " 12.3.1". For if new here, when asking something, try to make it as clear as possible to make it easier to help you, see in [Ask] and [mcve]. In this case, never share the token.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.