Coretrigger

This commit is contained in:
Flummi 2017-11-25 19:45:46 +01:00
parent 831cde3cd9
commit d1c422f767

30
src/inc/trigger/core.js Normal file
View File

@ -0,0 +1,30 @@
import sql from "../sql.js";
import admins from "../admin.js";
module.exports = bot => {
bot._trigger.set("join", {
call: /^\!join .*/i,
level: 100,
active: true,
clients: ["irc"],
f: e => {
let args = e.message.trim().substring(6).split(" ");
let chans = args.filter(chan => chan.charAt(0) === "#");
chans.map(e.join);
e.reply(`joined channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`);
}
});
bot._trigger.set("part", {
call: /^\!part .*/i,
level: 100,
active: true,
clients: ["irc"],
f: e => {
let args = e.message.trim().substring(6).split(" ");
let chans = args.filter(chan => chan.charAt(0) === "#");
chans.map(e.part);
e.reply(`parted channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`);
}
});
};