Skip to content

Commit

Permalink
Update bot.js
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenJayz authored Dec 12, 2020
1 parent a9b3d90 commit 2a4388d
Showing 1 changed file with 37 additions and 17 deletions.
54 changes: 37 additions & 17 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ const rbx = require("noblox.js");
const discord = require("discord.js")
const client = new discord.Client();

//create a verification by getting the player status
//first create a randomizer and tell the user through the discord bot to put it as there status
//then create an if statement that checks it and gives the user the verified role
//i have to somehow make it get the persons player info through roblox. I will most likely create a message collector then search it.

let prefix = "v!";

let prefix = "v!"; //set this to whatever u want


client.on('ready', () => {
Expand All @@ -17,28 +14,42 @@ client.on('ready', () => {

client.on('message', msg => {
const args = msg.content.slice(prefix.length).trim().split(' ');
const command = args.shift().toLowerCase();
const command = args.shift().toLowerCase(); //allows user to add their username

if (!msg.content.startsWith(prefix) || msg.author.bot) return;
if (!msg.content.startsWith(prefix) || msg.author.bot) return; //so the bot doesnt respond to themself

else if (command == "verify") {
if (!args.length) {
msg.channel.send("Please provide a Roblox username to verify!")
//change to please provide a username!

}
else if (args.length) {

var randa = ["pepper", "onion", "ravioli", "chesse", "pizza", "french", "light", "bulb", "cricket"];


var rande = randa[Math.floor(Math.random()*randa.length)];

var randr = randa[Math.floor(Math.random()*randa.length)];

var randt = randa[Math.floor(Math.random()*randa.length)];

var randy = randa[Math.floor(Math.random()*randa.length)];

var bruh = `${rande} ${randr} ${randt} ${randy}`

const embed = new discord.MessageEmbed()

//word randomizer

.setTitle(`Verify ${args[0]}`)
.setAuthor(msg.author.tag, msg.author.avatarURL())
.setTimestamp()
.setFooter("Please say done, when done verifying!")
.addField("Display this as your status:", "```i like ramen noodles```");

.addField("Display this as your status:", "```" + bruh + "```");
msg.channel.send(embed)

var theid = args[0];

rbx.getIdFromUsername(args[0])
.then(id => rbx.getPlayerInfo(id))
Expand All @@ -53,12 +64,21 @@ client.on('message', msg => {
let collector = new discord.MessageCollector(msg.channel, filter);
collector.on('collect', (msg, col) => {
if(msg.content == "done") {
if(data.status == "i like ramen noodles") {
msg.channel.send("Verified!")
}

} else {
return;
//when user types done it checks the status again
rbx.getIdFromUsername(theid)
.then(id => rbx.getPlayerInfo(id))
.then((data) => {
console.log(data.status)
if(data.status == bruh) {
//if the status is equivalent to the one given by the bot then message verified
console.log(data.status);
msg.channel.send("Verified!");
} else {
//if not then write it doesnt match inside the terminal
console.log(bruh);
console.log("The status does not match!");
}
})
}
})

Expand All @@ -73,7 +93,7 @@ client.on('message', msg => {
})


//trying to make this verify. Not working... Maybe try a message collector


}
}
Expand Down

0 comments on commit 2a4388d

Please sign in to comment.