trigger trigger trigger

This commit is contained in:
Flummi 2017-11-21 00:37:22 +01:00
parent ea25b51ae0
commit 52d0d1f99d
9 changed files with 168 additions and 129 deletions

View File

@ -85,9 +85,9 @@ class irc {
message: tmp.params[1],
time: ~~(Date.now() / 1000),
raw: tmp,
reply: msg => this.send(`PRIVMSG ${tmp.params[0]} :${this.format(msg)}`),
replyAction: msg => this.send(`PRIVMSG ${tmp.params[0]} :\u0001ACTION ${this.format(msg)}\u0001`),
replyNotice: msg => this.send(`NOTICE ${tmp.params[0]} :${this.format(msg)}`),
reply: msg => this.send(`PRIVMSG ${tmp.params[0]} :${this.format(""+msg)}`),
replyAction: msg => this.send(`PRIVMSG ${tmp.params[0]} :\u0001ACTION ${this.format(""+msg)}\u0001`),
replyNotice: msg => this.send(`NOTICE ${tmp.params[0]} :${this.format(""+msg)}`),
_chan: this.server.channel[tmp.params[0]],
_user: this.server.user,
_cmd: this._cmd,

View File

@ -52,7 +52,7 @@ class tg {
};
}
format(msg) {
return msg
return ""+msg
.replace(/\[b\](.*?)\[\/b\]/g, "<b>$1</b>") // bold
.replace(/\[i\](.*?)\[\/i\]/g, "<i>$1</i>") // italic
;

View File

@ -1,22 +0,0 @@
const Dest = [
"nach Syrien", "in die Ukraine", "nach Timbuktu", "nach Uruguay",
"nach Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch",
"nach Bagdad", "nach Nordkorea", "nach Kurdistan", "nach Bayern",
"nach Japan", "nach Irak", "in den Iran", "nach Saudi-Arabien",
"nach Libyen", "nach Niger", "nach Uganda", "nach Afghanistan"
];
module.exports = bot => {
bot._trigger.set("abschieben", {
call: /^(.|\/)abschieben/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(`schiebt [b]${args[0]}[/b] ${Dest[~~(Math.random() * Dest.length)]} ab.`);
}
});
};

View File

@ -1,14 +0,0 @@
module.exports = bot => {
bot._trigger.set("butterkaese", {
call: /^(.|\/)butterkäse/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(`drischt mit einem großen Stück Butterkäse auf [b]${args[0]}[/b] ein.`);
}
});
};

View File

@ -1,47 +1,15 @@
const strains = {
'sativa': [
'Sour Diesel', 'Green Crack', 'Jack Herer', 'Durban Poison',
'Lemon Haze', 'Strawberry Cough', 'Super Silver Haze',
'Alaskan Thunder Fuck', 'Super Lemon Haze', 'Amnesia Haze',
'Maui Wowie', 'Chocolope', 'Harlequin'
],
'indica': [
'Granddaddy Purple', 'Bubba Kush', 'Northern Lights',
'Blue Cheese', 'Purple Kush', 'Blueberry', 'Grape Ape',
'Blackberry Kush', 'Master Kush', 'God\'s Gift',
'LA Confidential', 'Death Star', 'Purple Urkle',
'Afghan Kush', 'Skywalker', 'White Rhino', 'Hindu Kush'
],
'hybrid': [
'Blue Dream', 'Girl Scout Cookies', 'OG Kush', 'White Widow',
'Gorilla Glue #4', 'Pineapple Express', 'Trainwreck',
'AK-47', 'Headband', 'Chemdawg', 'Cheese', 'Cherry Pie',
'Skywalker OG', 'Tahoe OG Kush', 'Lemon Kush',
'Platinum Girl Scout Cookies', 'Golden Goat', 'Agent Orange'
]
import sql from "../sql.js";
const data = {
dope_actions: {},
dope_strains: {}
};
const actions = {
'joint': [
['passes', 'to'],
['rolls', 'for'],
['lights', 'for']
],
'bong': [
['passes', 'to'],
['preps', 'for'],
['lights', 'for']
],
'vape': [
['passes', 'to']
],
'blunt': [
['passes', 'to'],
['rolls', 'for'],
['lights', 'for']
]
};
const strain_types = Object.keys(strains);
const action_types = Object.keys(actions);
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", {
@ -54,10 +22,13 @@ module.exports = bot => {
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 = actions[consume_type][~~(Math.random() * actions[consume_type].length)]
, strain = strains[strain_type][~~(Math.random() * strains[strain_type].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]`);
}

View File

@ -1,19 +0,0 @@
const texte = [
`einen frisch gebrühten Kaffee aus aromatisch hochwertigen und laktosefreien Kaffeebohnen, die nach dem Vorbild der kolonisierten Ausbeutung herangewachsen und importiert worden sind`,
`einen frisch gebrühten Kaffee aus aromatisch minderwertigen Kaffeebohnen, die zu einem überhöhten Preis und nach dem Prinzip des Fairtrade® herangewachsen und importiert worden sind`
];
module.exports = bot => {
bot._trigger.set("kaffee", {
call: /^(.|\/)kaffee/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(`serviert [b]${args.join(" ")}[/b] ${texte[~~(Math.random() * texte.length)]}; Prost!`);
}
});
};

View File

@ -1,11 +0,0 @@
module.exports = bot => {
bot._trigger.set("lachs", {
call: /^(.|\/)lachs/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => {
e.reply("öhöhöhöhöhöhö");
}
});
};

View File

@ -1,14 +0,0 @@
module.exports = bot => {
bot._trigger.set("notschlachten", {
call: /^(.|\/)notschlachten/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(`notschlachtet [b]${args[0]}[/b] und entsorgt die Leiche im Biomüll`);
}
});
};

148
src/inc/trigger/useless.js Normal file
View File

@ -0,0 +1,148 @@
import sql from "../sql.js";
const data = {
yiff: [],
kill_templates: [],
kill_parts: {},
abschieben: [],
kaffee: []
};
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("kiss", {
call: /^(.|\/)kiss/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.reply(`[b](づ。◕‿‿◕。)づ" 。。・゜゜・。。・゜❤ ${args.join(" ").trim()} ❤[/b]`);
}
});
bot._trigger.set("hug", {
call: /^(.|\/)hug/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.reply(`[b]♥♡❤♡♥ ${args.join(" ").trim()} ♥♡❤♡♥[/b]`);
}
});
bot._trigger.set("kill", {
call: /^(.|\/)kill/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(data.kill_templates[~~(Math.random() * data.kill_templates.length)]
.replace("{user}", `[b]${args[0]}[/b]`)
.replace("{limbs}", data.kill_parts.limbs[~~(Math.random() * data.kill_parts.limbs.length)])
.replace("{gun}", data.kill_parts.gun[~~(Math.random() * data.kill_parts.gun.length)])
.replace("{weapon_stab}", data.kill_parts.weapon_stab[~~(Math.random() * data.kill_parts.weapon_stab.length)])
.replace("{weapon_slice}", data.kill_parts.weapon_slice[~~(Math.random() * data.kill_parts.weapon_slice.length)])
.replace("{weapon_crush}", data.kill_parts.weapon_crush[~~(Math.random() * data.kill_parts.weapon_crush.length)])
.replace("{weapon_explosive}", data.kill_parts.weapon_explosive[~~(Math.random() * data.kill_parts.weapon_explosive.length)])
.replace("{tall_thing}", data.kill_parts.tall_thing[~~(Math.random() * data.kill_parts.tall_thing.length)])
.replace("{spiked_thing}", data.kill_parts.spiked_thing[~~(Math.random() * data.kill_parts.spiked_thing.length)])
.replace("{bomb}", data.kill_parts.bomb[~~(Math.random() * data.kill_parts.bomb.length)])
);
}
});
bot._trigger.set("yiff", {
call: /^(.|\/)yiff/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(data.yiff[~~(Math.random() * data.yiff.length)]
.replace("{user}", `[b]${args[0]}[/b]`)
);
}
});
bot._trigger.set("abschieben", {
call: /^(.|\/)abschieben/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(`schiebt [b]${args[0]}[/b] ${data.abschieben[~~(Math.random() * data.abschieben.length)]} ab.`);
}
});
bot._trigger.set("butterkaese", {
call: /^(.|\/)butterkäse/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(`drischt mit einem großen Stück Butterkäse auf [b]${args[0]}[/b] ein.`);
}
});
bot._trigger.set("notschlachten", {
call: /^(.|\/)notschlachten/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(`notschlachtet [b]${args[0]}[/b] und entsorgt die Leiche im Biomüll`);
}
});
bot._trigger.set("lachs", {
call: /^(.|\/)lachs/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => {
e.reply("öhöhöhöhöhöhö");
}
});
bot._trigger.set("kaffee", {
call: /^(.|\/)kaffee/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(data.kaffee[~~(Math.random() * data.kaffee.length)]
.replace("{user}", `[b]${args[0]}[/b]`)
);
}
});
};