Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- module.exports.run = async (client, message, args) => {
- const member = message.mentions.members.first() || message.guild.members.get(args[0]) || message.member;
- const mySQL = require("mysql");
- const con = mySQL.createConnection({
- host: "no",
- port: "no",
- user: "no",
- password: "no",
- database: "no"
- });
- let sql;
- con.query(`SELECT * FROM rep WHERE UserID = '${member.user.id}'`, (err, rows) => {
- if (err) {
- throw err;
- }
- if (rows.length < 1) {
- $sql = `INSERT INTO rep(UserID, rep) VALUES ('${member.user.id}', '1')`; // Because he got the $rep @mention command in the first place, he got 1 rep, not 0, I guess.
- connection.query(sql)
- } else {
- }
- let rep = rows[1].rep;
- let info = new Discord.RichEmbed()
- .addField(`You gave ${member.user.username}`, rep)
- .setTimestamp(new Date());
- });
- };
Add Comment
Please, Sign In to add comment