make del trigger a bit more idiotensicher

This commit is contained in:
jkhsjdhjs 2017-12-02 18:55:30 +01:00
parent 8545576415
commit aeae405f64

View File

@ -10,7 +10,7 @@ module.exports = (lib) => {
var ids = e.message.split(' '); var ids = e.message.split(' ');
ids.shift(); ids.shift();
ids.forEach(id => { ids.forEach(id => {
if(Number.isInteger(parseInt(id))) { if(Number.isInteger(parseInt(id)) && parseInt(id) > 0) {
lib.sql.query("select `dest` from `f0ck`.`items` where `id` = ? limit 1", id, (err, rows) => { lib.sql.query("select `dest` from `f0ck`.`items` where `id` = ? limit 1", id, (err, rows) => {
if(rows[0]) { if(rows[0]) {
lib.sql.query("delete from `f0ck`.`items` where `id` = ? limit 1", id, err => { lib.sql.query("delete from `f0ck`.`items` where `id` = ? limit 1", id, err => {