I have a few lines of code that are causing issues,
role = await message.guild.roles.cache.find(role => role.name = "Muted");
member.roles.add(role.id);
This produces the following error:
UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Role
at RequestHandler.execute (/home/runner/Marvel-Infinity-Dev-Build/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (/home/runner/Marvel-Infinity-Dev-Build/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
at async GuildMemberRoleManager.add (/home/runner/Marvel-Infinity-Dev-Build/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:96:7)
I have no idea what the issue is and im really confused, any and all help is appreciated.
question from:
https://stackoverflow.com/questions/65866590/unhandledpromiserejectionwarning-discordapierror-unknown-role-in-my-code 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…