Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. const commando = require('discord.js-commando');
  2. const mysql = require("mysql");
  3.  
  4. var con = mysql.createConnection({
  5. host: "localhost",
  6. user: "root",
  7. password: "-",
  8. database: "-"
  9. });
  10.  
  11. con.connect(err => {
  12. if(err) throw err;
  13. con.query("SHOW TABLES", console.log);
  14. });
  15.  
  16.  
  17. class ShowXPCommand extends commando.Command {
  18. constructor(client) {
  19. super(client, {
  20. name: 'showxp',
  21. group: 'xp',
  22. memberName: 'showxp',
  23. description: 'Shows the XP of mentioned user or you.'
  24. });
  25. }
  26.  
  27. let target = message.mentions.users.first() || message.guild.members.get(args[1]) || message.author;
  28.  
  29. con.query(`SELECT * FROM xp WHERE id = '${target.id}'`, (err, rows) => {
  30. if(err) throw err;
  31.  
  32. let xp = rows[0].xp;
  33. message.channel.send(xp);
  34. })
  35. }
  36.  
  37. module.exports = ShowXPCommand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement