Uwev2/src/inc/trigger/drugs.mjs
2017-12-04 12:22:53 +01:00

35 lines
1.2 KiB
JavaScript

import sql from "../sql";
const data = {
dope_actions: {},
dope_strains: {}
};
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);
});
});
export default bot => {
bot._trigger.set("dope", new bot.trigger({
call: /^(\.|\/)dope/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]`);
}
}));
bot._trigger.set("meth", new bot.trigger({
call: /^(\.|\/)meth/i,
f: e => {
e.replyAction(`legt [b]${e.args[0] || e.user.nick}[/b] eine dicke Line Meth \\________`);
}
}));
};