nxy_rape
This commit is contained in:
parent
a35606a8c5
commit
993fb0f295
47
src/inc/trigger/rape.js
Normal file
47
src/inc/trigger/rape.js
Normal file
@ -0,0 +1,47 @@
|
||||
import sql from "../sql.js";
|
||||
|
||||
module.exports = bot => {
|
||||
bot._trigger.set("rape", new bot.trigger({
|
||||
call: /^(\.|\/)rape/i,
|
||||
f: e => {
|
||||
const nick = e.args[0] || e.user.nick;
|
||||
const rand = Math.round(Math.random());
|
||||
|
||||
if(rand !== 1)
|
||||
e.replyAction(`rapes [b]${nick}[/b].`)
|
||||
else {
|
||||
const fine = ~~(Math.random() * 500) + 1;
|
||||
const fined = [e.user.nick, nick][rand];
|
||||
const reason = ["raping", "being too lewd and getting raped"][rand];
|
||||
|
||||
sql.any("insert into nxy_users (nick, fines) values (lower($1), $2) on conflict (nick) do update set fines = nxy_users.fines + excluded.fines returning fines", [fined, fine])
|
||||
.then(rows => {
|
||||
e.replyAction(`fines [b]${nick}[/b] [b]$${fine}[/b] for ${reason}. You owe: [b]$${rows[0].fines}[/b].`);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
bot._trigger.set("owe", new bot.trigger({
|
||||
call: /^(\.|\/)owe/i,
|
||||
f: e => {
|
||||
const nick = e.args[0] || e.user.nick;
|
||||
sql.any("select fines from nxy_users where lower(nick) = lower($1) limit 1", [nick])
|
||||
.then(rows => {
|
||||
if(!rows[0])
|
||||
return e.reply("user not found");
|
||||
let fines = 0;
|
||||
if(rows[0].fines > 0)
|
||||
fines = rows[0].fines;
|
||||
e.reply(`[b]${nick}[/b] owes: [b]$${fines}[/b].`);
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
return e.reply("user not found");
|
||||
});
|
||||
}
|
||||
}));
|
||||
};
|
Loading…
Reference in New Issue
Block a user