Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(commandIs("link", message))
- {
- var code = message.content.substring(6)
- console.log(code)
- var mysql = require('mysql');
- var connection = mysql.createConnection({
- host: process.env.HOST,
- database: "frogsboot",
- password: process.env.PASS,
- user: process.env.USER
- // database : 'frogsboot'
- });
- var connection2 = mysql.createConnection({
- host: process.env.HOST,
- database: "frogsboot",
- password: process.env.PASS,
- user: process.env.USER
- // database : 'frogsboot'
- });
- connection.connect();
- connection.query(`SELECT * FROM users WHERE discordCode='${code}';`, function (error2, results2, fields2) {
- if (error2) message.channel.send("Неправильно введен код")
- if(code == "") message.channel.send("Please enter the code. :unlock:")
- else
- {
- if(results2[0].discordStatus == "2")
- {
- message.channel.send("This code has already been used. :frowning2: ")
- }
- else
- {
- connection2.connect();
- connection2.query(`UPDATE users SET discordStatus = '2' WHERE discordCode='${code}';`, function (error, results, fields) {
- console.log('The solution is: ', results);
- client.guilds.get("514908242292244532").channels.get("514908242716131348").send("<@"+message.author.id+"> got Verified :white_check_mark:")
- var role = client.guilds.get("514908242292244532").roles.find('name', "USER")
- console.log(role)
- client.guilds.get("514908242292244532").members.get(message.author.id).addRole(role)
- })
- connection2.end();
- }
- }
- });
- connection.end();
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement