waifu/husbando
This commit is contained in:
parent
5fda55ca7a
commit
b4514b6682
@ -166,4 +166,34 @@ module.exports = bot => {
|
||||
e.reply(args.toUpperCase().split``.map(c => String.fromCharCode(65312 + (c.charCodeAt(0) - 64))).join``);
|
||||
}
|
||||
}));
|
||||
|
||||
bot._trigger.set("waifu_husbando", new bot.trigger({
|
||||
call: /^(\.|\/)(waifu|husbando)/i,
|
||||
f: e => {
|
||||
let nick = e.args[0] || e.user.nick;
|
||||
let mode = e.cmd;
|
||||
|
||||
if(e.args.length > 0 && e.args[0].charAt(0) === "=") {
|
||||
let tmp = e.args[0].slice(1);
|
||||
sql.any(`insert into nxy_users (nick, ${mode}) values (lower($1), $2) on conflict (nick) do update set ${mode} = excluded.${mode}`, [e.user.nick, tmp])
|
||||
.then(rows => {
|
||||
e.reply(`${mode.charAt(0).toUpperCase()+mode.slice(1)} set to: [b]${tmp}[/b]`)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
else {
|
||||
sql.any(`select ${mode} from nxy_users where lower(nick) = lower($1) limit 1`, [nick])
|
||||
.then(rows => {
|
||||
if(!rows[0])
|
||||
return e.reply(`[b]${mode.charAt(0).toUpperCase() + mode.slice(1)}[/b]: none`);
|
||||
e.reply(`${mode.charAt(0).toUpperCase() + mode.slice(1)}: [b]${rows[0][mode]}[/b]`);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
Loading…
Reference in New Issue
Block a user