Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const commando = require('discord.js-commando');
- const mysql = require("mysql");
- var con = mysql.createConnection({
- host: "localhost",
- user: "root",
- password: "-",
- database: "-"
- });
- con.connect(err => {
- if(err) throw err;
- con.query("SHOW TABLES", console.log);
- });
- class ShowXPCommand extends commando.Command {
- constructor(client) {
- super(client, {
- name: 'showxp',
- group: 'xp',
- memberName: 'showxp',
- description: 'Shows the XP of mentioned user or you.'
- });
- }
- let target = message.mentions.users.first() || message.guild.members.get(args[1]) || message.author;
- con.query(`SELECT * FROM xp WHERE id = '${target.id}'`, (err, rows) => {
- if(err) throw err;
- let xp = rows[0].xp;
- message.channel.send(xp);
- })
- }
- module.exports = ShowXPCommand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement