Open BleachPoptart opened 6 years ago
rbx.getIdFromUsername()
returns a promise. Read this article:
https://anidiots.guide/other-guides/async-await to understand a bit more
about Promises. Consider using async/await or the classic .then statements.
One other small thing, I do not recommend writing code like this. Use some
kind of command module framework like Discord.js-commando.
var dateFormat = require('dateformat'); var now = new Date(); var variable = message.content.replace(';exile', ''); var ID = rbx.getIdFromUsername(variable); if(message.member.roles.some(r=>["Specialized Control Unit", "Combat Medic Leader", "Officer", "Lieutenant", "Captain", "Assistant Director", "Director", "Overseer", "The Administrator"].includes(r.name)) ) { console.log('Waiting for login.') rbx.login('username', 'my password'); console.log('Login verifed.') console.log(message.author.username + ' Has logged into SCPF_SECURITYDEPT At ' + dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT")) setTimeout(function(){ rbx.exile(3506926,ID); }, 10000); console.log(message.author.username + ' Has exiled ' + variable, ' from the Security Department At ' + dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT")) message.channel.send(message.author + ' Has exiled' + variable,' from the Security Department At' + dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT"))} else{ message.channel.send("Exile failed, Do you have the correct role to use this function?") console.log(message.author.username + ' Has attempted to exile' + variable + ' at' + dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT"))} break;