import sql from "../sql.js"; const data = { dope_actions: {}, dope_strains: {} }; Object.keys(data).forEach(cur => { sql.exec(`select \`data\` from \`useless\` where \`trigger\` = '${cur}' limit 1`, (err, row) => { data[cur] = JSON.parse(row[0].data); }); }); module.exports = bot => { bot._trigger.set("dope", { call: /^(.|\/)dope/i, level: 0, active: true, clients: ["irc", "tg"], f: e => { let args = e.message.trim().split(" "); args.shift(); args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; 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]${args[0]}[/b]`); } }); bot._trigger.set("meth", { call: /^(.|\/)meth/i, level: 0, active: true, clients: ["irc", "tg"], f: e => { let args = e.message.trim().split(" "); args.shift(); args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; e.replyAction(`legt [b]${args[0]}[/b] eine dicke Line Meth \\________`); } }); };