no try/catch needed anymore

This commit is contained in:
Flummi 2017-11-23 07:36:37 +01:00
parent f613990203
commit 74a6c9f235

View File

@ -30,15 +30,12 @@ module.exports = bot => {
active: true,
clients: ["irc", "tg"],
f: e => {
/* <cmd> <nick> <quote>...
* <nick> [<index>]
*/
let args = e.message.trim().substring(3).split(" ");
const cmd = args[0].toLowerCase();
let nick;
switch(cmd) {
case "add": // add user quote
case "add": // add quote
if(args.length < 3)
return e.reply("ob du behindert bist.");
args.shift();
@ -46,16 +43,11 @@ module.exports = bot => {
args.shift();
let quote = args.join(" ");
try {
sql.exec(_query_add, [ nick, quote, `${e.network}.${e.channel}`, e.user.nick ])
.then(rows => { })
.catch(err => {
e.reply("duplicate!");
});
}
catch(err) {
e.reply("duplicate!");
}
sql.exec(_query_add, [ nick, quote, `${e.network}.${e.channel}`, e.user.nick ])
.then(rows => { })
.catch(err => {
e.reply("duplicate!");
});
break;
default: // get quote
let nick = cmd;