I am trying to setup a simple react role handler for my discord bot. The role gets added successfully, but I get the following error:
(node:17872) UnhandledPromiseRejectionWarning: Error: Adding the role timed out.
at C:UsersUserDocumentsjs_projectsdiscord-bot-sitepointnode_modulesdiscord.jssrcclientrestRESTMethods.js:560:16
at Timeout._onTimeout (C:UsersUserDocumentsjs_projectsdiscord-bot-sitepointnode_modulesdiscord.jssrcclientClient.js:436:7)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
(node:17872) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on
unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17872) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
bot.on("messageReactionAdd", async (messageReaction: Discord.MessageReaction, user: Discord.User) => {
if (messageReaction.message.channel.id == REACT_ROLE_CHANNEL_ID) {
let allRoles = messageReaction.message.guild.roles;
let reactingMember = messageReaction.message.member;
let reactWhiteBeltRole = reactingMember.roles.find(r => r.name === "White Belt");
if (!reactWhiteBeltRole) {
let wbRole = allRoles.find(r => r.name === "White Belt");
let member = messageReaction.message.guild.member(user);
member = await member.addRole(wbRole);
}
}
});
Further details:
I updated to v12 and everything worked fine
we no longer provide support for or maintain usability of v11.
Most helpful comment
we no longer provide support for or maintain usability of v11.