I wanted to know the error in this code and a solution to it. Thanks in advance! When the giveaway bot announces the winner, it starts with Congratulations <@user> . . . The bot needs to check the @user's roles and let the host know the claim time for the winner. I would be thankful if i get a response at the earliest. I'm using repl.it to code the bot (it's private, only for my server) and it shows error in line ,
if (message.member.roles.has(allowedRole.id) {
I want a solution for this to resolve my problem.
let winner = msg.mentions.users.first();
if (!winner) msg.reply("Unexpected Error");
let allowedRole = message.guild.roles.find("name", "・supporter");
if (message.member.roles.has(allowedRole.id) {
msg.channel.send(`GG! You have **15** seconds to DM the host!`)
.then(message => { setTimeout(function() { message.edit('**Time up!**')) }, 15000)})
} else {
let winner = msg.mentions.users.first();
if (!winner) msg.reply("Unexpected Error");
let allowedRole = message.guild.roles.find("name", "・donator");
if (message.member.roles.has(allowedRole.id) {
msg.channel.send(`GG! You have **25** seconds to DM the host!`)
.then(message => { setTimeout(function() { message.edit('**Time up!**')) }, 25000)})
} else {
let winner = msg.mentions.users.first();
if (!winner) msg.reply("Unexpected Error");
let allowedRole = message.guild.roles.find("name", "・booster");
if (message.member.roles.has(allowedRole.id) {
msg.channel.send(`GG! You have infinite time to DM!`)})
}
}