Issue with roles

.
2 Replies
d.js toolkit
d.js toolkit2mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Caneless
Caneless2mo ago
console.log(msg.member.roles.cache.keys())
if(msg.member.roles.cache.has("1226982509074579548")){
console.log("User has role")
toAdd = levelsdata.levelgains.permsg*2
await db.add(`${msg.guild.id}_${msg.author.id}_xp`, toAdd);
}else {
toAdd = levelsdata.levelgains.permsg
await db.add(`${msg.guild.id}_${msg.author.id}_xp`, toAdd);
}
console.log(msg.member.roles.cache.keys())
if(msg.member.roles.cache.has("1226982509074579548")){
console.log("User has role")
toAdd = levelsdata.levelgains.permsg*2
await db.add(`${msg.guild.id}_${msg.author.id}_xp`, toAdd);
}else {
toAdd = levelsdata.levelgains.permsg
await db.add(`${msg.guild.id}_${msg.author.id}_xp`, toAdd);
}
Code i have It returns user has role when user does not
[Map Iterator] {
'1216848932748136500',
'1216849687349297343',
'1225907718586503270',
'1225907902561255466',
'1226272267135225896',
'1226283313946431498',
'1226982516456427581',
'1226990131186110505',

[Map Iterator] {
'1216848932748136500',
'1216849687349297343',
'1225907718586503270',
'1225907902561255466',
'1226272267135225896',
'1226283313946431498',
'1226982516456427581',
'1226990131186110505',

What it logs The role id it should have to get 2x xp 1226982509074579548