Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. if(command === "link") {
  2. if (message.channel.id !== '389512905592274946') return;
  3. let con = mysql.createConnection({
  4. host: "localhost",
  5. user: "root",
  6. password: "mOdT3r-dh8S(",
  7. database: "links",
  8. });
  9. let conStr = "SELECT * FROM `users` WHERE `userID` = '" + message.author.id+"'";
  10. con.query(conStr, function(error, row) {
  11. if(error) throw error;
  12. if (row && row.length) {
  13. message.channel.send("Votre discord est déja associer à un autre compte: " + row[0].username)
  14. }
  15. else
  16. {
  17.  
  18. let username = args.join().replace(/\,/g, ' ');
  19. let conStr = "SELECT * FROM `users` WHERE `username` = '" + username +"'";
  20. con.query(conStr, function(error, row) {
  21. if(error) throw error;
  22. if (row && row.length) {
  23. message.channel.send(row[0].username + " est déja associer à un autre compte discord")
  24. }
  25. else {
  26. let username = args.join().replace(/\,/g, ' ');
  27. fortniteAPI.login().then(() => {
  28. fortniteAPI
  29. .getStatsBR(username, "pc", "alltime")
  30. .then(stats => {
  31. let sql = "INSERT INTO users (userID, username) VALUES ('" + message.author.id + "', '" + username + "')";
  32. con.query(sql, function(error) {
  33. if(error) throw error;
  34. message.channel.send(username + " à bien été associer.")
  35. });
  36. })
  37. .catch(err => {
  38. message.channel.send("Ce joueur n'existe pas ou n'est pas un joueur PC");
  39. });
  40. });
  41. }
  42. });
  43. }
  44. });
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement