client.on("message", message => {
const args = message.content.slice(config.prefix.length).trim().split(' ');
const args2 = message.content.slice('test', ',', args).trim(args).split(' ', args);
const command = args.shift().toLowerCase();
if (command === "tbal") {
if (message.author.bot) return;
const data = sql.prepare(`SELECT bal FROM ${args}`).get();
message.channel.send(`You have ${data.bal}`)
}
if (command == "tgive") {
//Get their current XP
let userscore = sql.prepare(`SELECT bal FROM ${args}`).get()
let pointsToAdd = parseInt(args2[1], [10]);
if(!pointsToAdd) return message.reply("How much? You didn't tell me that!");
//XP level update
const valueadd = sql.prepare(`INSERT OR REPLACE INTO ${args} (bal) VALUES (userscore + pointsToAdd);`)
client.setScore.run(userscore)
return message.channel.send(`${args} has received ${pointsToAdd}. New balance: ${data.bal}`);
}
});
Вот код, ошибка, которую я получаю, такова: let userscore = sql.prepare(`SELECT bal FROM ${args}`).get()
SqliteError: near "5": syntax error
Ближайшая "5" равна args2
, к которой я выполнил команду eco tgive args1 5
, args1 - имя таблицы SQLite.