Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(command === "link") {
- if (message.channel.id !== '389512905592274946') return;
- let con = mysql.createConnection({
- host: "localhost",
- user: "root",
- password: "mOdT3r-dh8S(",
- database: "links",
- });
- let conStr = "SELECT * FROM `users` WHERE `userID` = '" + message.author.id+"'";
- con.query(conStr, function(error, row) {
- if(error) throw error;
- if (row && row.length) {
- message.channel.send("Votre discord est déja associer à un autre compte: " + row[0].username)
- }
- else
- {
- let username = args.join().replace(/\,/g, ' ');
- let conStr = "SELECT * FROM `users` WHERE `username` = '" + username +"'";
- con.query(conStr, function(error, row) {
- if(error) throw error;
- if (row && row.length) {
- message.channel.send(row[0].username + " est déja associer à un autre compte discord")
- }
- else {
- let username = args.join().replace(/\,/g, ' ');
- fortniteAPI.login().then(() => {
- fortniteAPI
- .getStatsBR(username, "pc", "alltime")
- .then(stats => {
- let sql = "INSERT INTO users (userID, username) VALUES ('" + message.author.id + "', '" + username + "')";
- con.query(sql, function(error) {
- if(error) throw error;
- message.channel.send(username + " à bien été associer.")
- });
- })
- .catch(err => {
- message.channel.send("Ce joueur n'existe pas ou n'est pas un joueur PC");
- });
- });
- }
- });
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement