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