Skip to content
Snippets Groups Projects
Commit 66b9a303 authored by Reviath's avatar Reviath
Browse files

Fixed send command.

parent 1c8d1a12
No related branches found
No related tags found
No related merge requests found
......@@ -24,10 +24,26 @@ exports.run = async(client, message, args, connection) => {
connection.query(sql, function (err, result) {
if (err) throw err;
});
let sql2 = `UPDATE cashes SET cash ='${bal + amount}' WHERE guildid ='${message.guild.id}' AND userid ='${target.id}'`
const cash2 = await new Promise((resolve, reject) => {
let sql2 = `SELECT cash FROM cashes WHERE guildid ='${message.guild.id}' AND userid ='${target.id}'`
connection.query(sql2, function (err, result) {
if (err)
reject(err);
resolve(result);
});
});
var sql4 = "";
if (cash2.length < 1) {
sql4 = `INSERT INTO cashes (cash, guildid, userid) VALUES (${amount}, ${message.guild.id}, ${target.id})`
connection.query(sql4, function (err, result) {
if (err) throw err;
})
} else {
sql4 = `UPDATE cashes SET cash ='${bal + amount}' WHERE guildid ='${message.guild.id}' AND userid ='${target.id}'`
connection.query(sql4, function (err, result) {
if (err) throw err;
});
}
message.channel.send(`Sent ${amount}$ to <@${target.user.id}>`)
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment