Uwev2/src/inc/trigger/drugs.mjs
2019-08-19 01:38:47 +00:00

46 lines
1.4 KiB
JavaScript

import sql from "../sql";
const data = {
dope_actions: {},
dope_strains: {}
};
export default async bot => {
Object.keys(data).forEach(cur => {
sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => {
data[cur] = JSON.parse(rows[0].data);
});
});
return [{
name: "dope",
call: /^(\.|\/)dope/i,
set: "nxy",
help: {
text: "Smoke weed everyday",
usage: "[b].dope[/b] [i](<nick>)[/i]"
},
f: e => {
const strain_types = Object.keys(data.dope_strains);
const action_types = Object.keys(data.dope_actions);
const strain_type = strain_types[~~(Math.random() * strain_types.length)]
, consume_type = action_types[~~(Math.random() * action_types.length)]
, action = data.dope_actions[consume_type][~~(Math.random() * data.dope_actions[consume_type].length)]
, strain = data.dope_strains[strain_type][~~(Math.random() * data.dope_strains[strain_type].length)];
e.replyAction(`${action[0]} a ${consume_type} of the finest ${strain_type} "${strain}" ${action[1]} [b]${e.args[0] || e.user.nick}[/b]`);
}
}, {
name: "meth",
call: /^(\.|\/)meth/i,
set: "nxy",
help: {
text: "Snort some meth *_*",
usage: "[b].meth[/b] [i](<nick>)[/i]"
},
f: e => {
e.replyAction(`legt [b]${e.args[0] || e.user.nick}[/b] eine dicke Line Meth \\________`);
}
}];
};