I got this problem when the discord bot I write with discord.js shows a role as @deleted-role, The role itself is still available but the bot says deleted role. I tried to test it with another role same here are the images of the and the code:
if (message.content.includes("test"))
return message.channel.send("<@&" + 855179067388461076 + "> why is that ");
The result
The role
Can you guys help me with this?
The problem is that you use an integer (855179067388461076) as a snowflake. It should be a string. As this number is greater than 53 bits (MAX_SAFE_INTEGER) JavaScript has difficulty interpreting it. It can only safely represent integers between -(253 - 1) and 253 - 1.
| Max safe integer | 9007199254740992 |
| Your integer | 855179067388461076 |
| Your integer becomes | 855179067388461000 |
And there is no role with the ID of 855179067388461000. To solve this, make sure you only use strings as snowflakes:
message.channel.send("<@&" + "855179067388461076" + "> why is that")
// OR
const roleId = "855179067388461076"
message.channel.send("<@&" + roleId + "> why is that")
console.log('<@&' + 855179067388461076 + '> why is that ')
// => <@&855179067388461000> why is that