retab code with 4 spaces
This commit is contained in:
parent
2c3b284e37
commit
a18dae5fd2
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"servers": {
|
"servers": {
|
||||||
"asd": {
|
"asd": {
|
||||||
"host": "domain.tld",
|
"host": "domain.tld",
|
||||||
"port": 6667,
|
"port": 6667,
|
||||||
"secure": false,
|
"secure": false,
|
||||||
"srvPassword": "example",
|
"srvPassword": "example",
|
||||||
"nick": "bert",
|
"nick": "bert",
|
||||||
"userName": "foo",
|
"userName": "foo",
|
||||||
"realName": "bar"
|
"realName": "bar"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
282
chatCommands.js
282
chatCommands.js
|
@ -4,11 +4,11 @@ let crypto = require("crypto");
|
||||||
let VM = require('vm2').VM;
|
let VM = require('vm2').VM;
|
||||||
|
|
||||||
let sbhead = "\"use strict\";const mett=9000,belst=Math.random()*mett|0;";
|
let sbhead = "\"use strict\";const mett=9000,belst=Math.random()*mett|0;";
|
||||||
sbhead += Object.getOwnPropertyNames(Math).map(function(v){return "const " + v + "=Math." + v + ";"}).join("");
|
sbhead += Object.getOwnPropertyNames(Math).map(function(v){return "const " + v + "=Math." + v + ";"}).join("");
|
||||||
|
|
||||||
let handleChatCommands = function (irc, db) {
|
let handleChatCommands = function (irc, db) {
|
||||||
this.irc = irc;
|
this.irc = irc;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
};
|
};
|
||||||
|
|
||||||
let p = handleChatCommands.prototype;
|
let p = handleChatCommands.prototype;
|
||||||
|
@ -20,153 +20,153 @@ const exec = require("child_process").exec;
|
||||||
const alphanoise = [8,20,10,14,12,11,26,16,4,21,22,13,24,6,5,15,2,23,7,19,18,25,9,3,17,1];
|
const alphanoise = [8,20,10,14,12,11,26,16,4,21,22,13,24,6,5,15,2,23,7,19,18,25,9,3,17,1];
|
||||||
|
|
||||||
p.run = function (o) {
|
p.run = function (o) {
|
||||||
let client = this.irc.client;
|
let client = this.irc.client;
|
||||||
let db = this.db;
|
let db = this.db;
|
||||||
let level = client.chans["#w0bm"] ? client.chans["#w0bm"].users[o.from] : undefined;
|
let level = client.chans["#w0bm"] ? client.chans["#w0bm"].users[o.from] : undefined;
|
||||||
level = level !== undefined ? level.split("").map(x=>userLevels.indexOf(x)).sort().pop() : -1;
|
level = level !== undefined ? level.split("").map(x=>userLevels.indexOf(x)).sort().pop() : -1;
|
||||||
if (level === null || level === undefined) level = -1;
|
if (level === null || level === undefined) level = -1;
|
||||||
switch(o.cmd) {
|
switch(o.cmd) {
|
||||||
case ".adhs":
|
case ".adhs":
|
||||||
let fuckyoujs = [...(o.args || o.from).toLowerCase()];
|
let fuckyoujs = [...(o.args || o.from).toLowerCase()];
|
||||||
fuckyoujs = fuckyoujs.filter(c => /[a-z]/.test(c));
|
fuckyoujs = fuckyoujs.filter(c => /[a-z]/.test(c));
|
||||||
fuckyoujs = fuckyoujs.map((c, i) => {
|
fuckyoujs = fuckyoujs.map((c, i) => {
|
||||||
return alphanoise[((c.charCodeAt() -97) * (i+1) * 107) %26] /26;
|
return alphanoise[((c.charCodeAt() -97) * (i+1) * 107) %26] /26;
|
||||||
}).reduce((a,b)=>a+b) %1;
|
}).reduce((a,b)=>a+b) %1;
|
||||||
client.say(o.to, (o.args || o.from) + " has " + (fuckyoujs * 100).toFixed(2) + "% adhs");
|
client.say(o.to, (o.args || o.from) + " has " + (fuckyoujs * 100).toFixed(2) + "% adhs");
|
||||||
return true;
|
return true;
|
||||||
case ".level":
|
case ".level":
|
||||||
client.say(o.to, o.from + " your level: " + userLevelNames[level]);
|
client.say(o.to, o.from + " your level: " + userLevelNames[level]);
|
||||||
return true;
|
return true;
|
||||||
case ".reboot":
|
case ".reboot":
|
||||||
if (level < getLevel("admin")) {
|
if (level < getLevel("admin")) {
|
||||||
client.say(o.to, o.from + " go kill yourself");
|
client.say(o.to, o.from + " go kill yourself");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
client.say(o.to, "kthx bai");
|
client.say(o.to, "kthx bai");
|
||||||
setTimeout(process.exit, 100);
|
setTimeout(process.exit, 100);
|
||||||
return true;
|
return true;
|
||||||
/*case ".reg":
|
/*case ".reg":
|
||||||
if (level < getLevel("admin")) {
|
if (level < getLevel("admin")) {
|
||||||
client.say(o.to, o.from + ": your level: " + userLevelNames[level] + ", needed level: admin");
|
client.say(o.to, o.from + ": your level: " + userLevelNames[level] + ", needed level: admin");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!~["open", "close"].indexOf(o.args)) {
|
if (!~["open", "close"].indexOf(o.args)) {
|
||||||
client.say(o.to, "momentane befehle: open und close");
|
client.say(o.to, "momentane befehle: open und close");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
client.say(o.to, "Your word is my command");
|
client.say(o.to, "Your word is my command");
|
||||||
exec("/bin/bash /home/sirx/web/w0bm.com/resources/views/"+o.args+".sh", (err, sout, serr)=>{
|
exec("/bin/bash /home/sirx/web/w0bm.com/resources/views/"+o.args+".sh", (err, sout, serr)=>{
|
||||||
client.say(o.to, "Registration successfully " + (o.args == "open" ? "opened you can now register your account at https://w0bm.com/register" : "closed"));
|
client.say(o.to, "Registration successfully " + (o.args == "open" ? "opened you can now register your account at https://w0bm.com/register" : "closed"));
|
||||||
});
|
});
|
||||||
break;*/
|
break;*/
|
||||||
|
|
||||||
case ".reg":
|
case ".reg":
|
||||||
client.say(o.to, "User limit reached");
|
client.say(o.to, "User limit reached");
|
||||||
return true;
|
return true;
|
||||||
case ".status":
|
case ".status":
|
||||||
db.getConnection((err, con) => {
|
db.getConnection((err, con) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
client.say(o.to, "sorry.. datenbank is kapott D: nixc jkhsjdhjs Flummi");
|
client.say(o.to, "sorry.. datenbank is kapott D: nixc jkhsjdhjs Flummi");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
con.query("select disabled, deleted_at, banend, banreason, verified from users where username like ?", o.args || o.from, (err, rows, fields) => {
|
con.query("select disabled, deleted_at, banend, banreason, verified from users where username like ?", o.args || o.from, (err, rows, fields) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
client.say(o.to, "ich bin zu doof zum coden.. hier hat sich ein fehler eingeschlichen D:");
|
client.say(o.to, "ich bin zu doof zum coden.. hier hat sich ein fehler eingeschlichen D:");
|
||||||
con.release();
|
con.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rows.length == 0) {
|
if (rows.length == 0) {
|
||||||
client.say(o.to, "konnte keinen benutzer mit dem namen finden D:");
|
client.say(o.to, "konnte keinen benutzer mit dem namen finden D:");
|
||||||
con.release();
|
con.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rows.length > 1) {
|
if (rows.length > 1) {
|
||||||
client.say(o.to, "fick dich. hör auf wildcards zu nutzen… oder… wir haben ein datenbank problem…");
|
client.say(o.to, "fick dich. hör auf wildcards zu nutzen… oder… wir haben ein datenbank problem…");
|
||||||
con.release();
|
con.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const row = rows[0];
|
const row = rows[0];
|
||||||
const stati = [];
|
const stati = [];
|
||||||
if (row.disabled) stati.push("deaktiviert");
|
if (row.disabled) stati.push("deaktiviert");
|
||||||
if (!row.disabled) stati.push("aktiviert");
|
if (!row.disabled) stati.push("aktiviert");
|
||||||
if (!row.verified) stati.push("nicht verifiziert");
|
if (!row.verified) stati.push("nicht verifiziert");
|
||||||
if (row.banend) stati.push("gebannt mit grund: " + row.banreason + ", bis: " + row.banend);
|
if (row.banend) stati.push("gebannt mit grund: " + row.banreason + ", bis: " + row.banend);
|
||||||
if (row.deleted_at) stati.push("gelöscht seit: " + row.deleted_at);
|
if (row.deleted_at) stati.push("gelöscht seit: " + row.deleted_at);
|
||||||
|
|
||||||
client.say(o.to, (o.args || o.from) + " ist: " + stati.join(", "));
|
client.say(o.to, (o.args || o.from) + " ist: " + stati.join(", "));
|
||||||
con.release();
|
con.release();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case "md5sum":
|
case "md5sum":
|
||||||
case "sha1sum":
|
case "sha1sum":
|
||||||
case "sha256sum":
|
case "sha256sum":
|
||||||
case "sha512sum":
|
case "sha512sum":
|
||||||
o.cmd = o.cmd.substr(0, o.cmd.length -3);
|
o.cmd = o.cmd.substr(0, o.cmd.length -3);
|
||||||
case "md5":
|
case "md5":
|
||||||
case "sha1":
|
case "sha1":
|
||||||
case "sha256":
|
case "sha256":
|
||||||
case "sha512":
|
case "sha512":
|
||||||
let crypt = crypto.createHash(o.cmd);
|
let crypt = crypto.createHash(o.cmd);
|
||||||
crypt.update(o.args);
|
crypt.update(o.args);
|
||||||
client.say(o.to, "teh " + o.cmd + " sum iz: " + crypt.digest("hex"));
|
client.say(o.to, "teh " + o.cmd + " sum iz: " + crypt.digest("hex"));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "js":
|
case "js":
|
||||||
let s = new VM({timeout: 1000, sandbox: {}});
|
let s = new VM({timeout: 1000, sandbox: {}});
|
||||||
let text;
|
let text;
|
||||||
try {
|
try {
|
||||||
const out = s.run(sbhead + o.args + "+\"\"");
|
const out = s.run(sbhead + o.args + "+\"\"");
|
||||||
text = out.replace(/[\r\n\t]/g, " ");
|
text = out.replace(/[\r\n\t]/g, " ");
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
text = e.toString();
|
text = e.toString();
|
||||||
}
|
}
|
||||||
client.say(o.to, o.from + " it returned: " + (text.length > 400 ? "fuck you" : text));
|
client.say(o.to, o.from + " it returned: " + (text.length > 400 ? "fuck you" : text));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "throw":
|
case "throw":
|
||||||
if (o.args != "a dice") break;
|
if (o.args != "a dice") break;
|
||||||
client.say(o.to, o.from + ": the magic dice shows " + ((Math.random()*6|0)+1) + " eyes.");
|
client.say(o.to, o.from + ": the magic dice shows " + ((Math.random()*6|0)+1) + " eyes.");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ".choose":
|
case ".choose":
|
||||||
case "choose:":
|
case "choose:":
|
||||||
case "choice:":
|
case "choice:":
|
||||||
let choices = o.args.split(",").map((str)=>str.trim());
|
let choices = o.args.split(",").map((str)=>str.trim());
|
||||||
if (choices.length < 2) {
|
if (choices.length < 2) {
|
||||||
client.say(o.to, "fuck you " + o.from + "!");
|
client.say(o.to, "fuck you " + o.from + "!");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
let choice = ~choices.indexOf("w0bm") ? "w0bm of course!" : choices[Math.random() * choices.length | 0];
|
let choice = ~choices.indexOf("w0bm") ? "w0bm of course!" : choices[Math.random() * choices.length | 0];
|
||||||
client.say(o.to, o.from + ": i'd choose: " + choice);
|
client.say(o.to, o.from + ": i'd choose: " + choice);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "b2o":
|
case "b2o":
|
||||||
case "b2d":
|
case "b2d":
|
||||||
case "b2h":
|
case "b2h":
|
||||||
case "o2b":
|
case "o2b":
|
||||||
case "o2d":
|
case "o2d":
|
||||||
case "o2h":
|
case "o2h":
|
||||||
case "d2b":
|
case "d2b":
|
||||||
case "d2o":
|
case "d2o":
|
||||||
case "d2h":
|
case "d2h":
|
||||||
case "h2b":
|
case "h2b":
|
||||||
case "h2o":
|
case "h2o":
|
||||||
case "h2d":
|
case "h2d":
|
||||||
if ({b:/[^01]/,o:/[^0-7]/,d:/[^\d]/,h:/[^\da-fA-F]/}[o.cmd[0]].test(o.args)) return false;
|
if ({b:/[^01]/,o:/[^0-7]/,d:/[^\d]/,h:/[^\da-fA-F]/}[o.cmd[0]].test(o.args)) return false;
|
||||||
client.say(o.to, o.from + ": " + parseInt(o.args, {b:2,o:8,d:10,h:16}[o.cmd[0]]).toString({b:2,o:8,d:10,h:16}[o.cmd[2]]));
|
client.say(o.to, o.from + ": " + parseInt(o.args, {b:2,o:8,d:10,h:16}[o.cmd[0]]).toString({b:2,o:8,d:10,h:16}[o.cmd[2]]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = function (irc, db) {
|
module.exports = function (irc, db) {
|
||||||
let hcc = new handleChatCommands(irc, db);
|
let hcc = new handleChatCommands(irc, db);
|
||||||
return function (o) {
|
return function (o) {
|
||||||
hcc.run(o);
|
hcc.run(o);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
302
index.js
302
index.js
|
@ -8,37 +8,37 @@ const Mysql = require("mysql");
|
||||||
require('dotenv').config({path: '/srv/http/w0bm/.env'});
|
require('dotenv').config({path: '/srv/http/w0bm/.env'});
|
||||||
|
|
||||||
let db = Mysql.createPool({
|
let db = Mysql.createPool({
|
||||||
socketPath: '/run/mysqld/mysqld.sock',
|
socketPath: '/run/mysqld/mysqld.sock',
|
||||||
user: process.env.DB_USERNAME,
|
user: process.env.DB_USERNAME,
|
||||||
password: process.env.DB_PASSWORD,
|
password: process.env.DB_PASSWORD,
|
||||||
database: process.env.DB_DATABASE,
|
database: process.env.DB_DATABASE,
|
||||||
timezone: "utc"
|
timezone: "utc"
|
||||||
});
|
});
|
||||||
|
|
||||||
let irc = {};
|
let irc = {};
|
||||||
|
|
||||||
irc.client = new Irc.Client(config.servers.n0xy.host, config.servers.n0xy.nick, {
|
irc.client = new Irc.Client(config.servers.n0xy.host, config.servers.n0xy.nick, {
|
||||||
port: config.servers.n0xy.port,
|
port: config.servers.n0xy.port,
|
||||||
secure: config.servers.n0xy.secure,
|
secure: config.servers.n0xy.secure,
|
||||||
userName: config.servers.n0xy.userName,
|
userName: config.servers.n0xy.userName,
|
||||||
realName: config.servers.n0xy.realName,
|
realName: config.servers.n0xy.realName,
|
||||||
sasl: config.servers.n0xy.sasl,
|
sasl: config.servers.n0xy.sasl,
|
||||||
debug: false,
|
debug: false,
|
||||||
debugRaw: false,
|
debugRaw: false,
|
||||||
selfSigned: false,
|
selfSigned: false,
|
||||||
autoConnect: true,
|
autoConnect: true,
|
||||||
password: config.servers.n0xy.srvPassword,
|
password: config.servers.n0xy.srvPassword,
|
||||||
channels: ["#w0bm", "#f0ck"]
|
channels: ["#w0bm", "#f0ck"]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (process.env.NODE_ENV != 'production') {
|
if (process.env.NODE_ENV != 'production') {
|
||||||
const repl = require("repl").start("> ");
|
const repl = require("repl").start("> ");
|
||||||
repl.context.i = irc;
|
repl.context.i = irc;
|
||||||
repl.context.c = irc.client;
|
repl.context.c = irc.client;
|
||||||
repl.context.w = (msg) => irc.client.say("#w0bm", msg);
|
repl.context.w = (msg) => irc.client.say("#w0bm", msg);
|
||||||
repl.context.s = (cmd, msg) => irc.client.send(cmd, msg);
|
repl.context.s = (cmd, msg) => irc.client.send(cmd, msg);
|
||||||
|
|
||||||
Object.defineProperty(repl.context, "q", {get:process.exit});
|
Object.defineProperty(repl.context, "q", {get:process.exit});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleChatCommands = require("./chatCommands")(irc, db);
|
const handleChatCommands = require("./chatCommands")(irc, db);
|
||||||
|
@ -46,157 +46,157 @@ const handleChatCommands = require("./chatCommands")(irc, db);
|
||||||
const shiftRegex = /^(\.?\w+:?)(?:\s+(.+))?/;
|
const shiftRegex = /^(\.?\w+:?)(?:\s+(.+))?/;
|
||||||
const w0bmregex = /(?:\b(\w+)\.)?\bw0bm\.com\/(?:\w+\/){0,3}([^ '\/@`´]+\.(webm)|\d+)/i;
|
const w0bmregex = /(?:\b(\w+)\.)?\bw0bm\.com\/(?:\w+\/){0,3}([^ '\/@`´]+\.(webm)|\d+)/i;
|
||||||
const capsmsg = [
|
const capsmsg = [
|
||||||
"Captain capslock did not approve this!",
|
"Captain capslock did not approve this!",
|
||||||
"CAPS",
|
"CAPS",
|
||||||
"caps lock. unleash the mother fucking fury",
|
"caps lock. unleash the mother fucking fury",
|
||||||
"DON'T YOU TYPE AT ME IN THAT TONE OF VOICE.",
|
"DON'T YOU TYPE AT ME IN THAT TONE OF VOICE.",
|
||||||
"Suddenly, CAPS LOCK",
|
"Suddenly, CAPS LOCK",
|
||||||
"OH, so you wanna argue? BRING IT. I got my CAPS LOCK ON",
|
"OH, so you wanna argue? BRING IT. I got my CAPS LOCK ON",
|
||||||
"WELCOME TO THE INTERNET"
|
"WELCOME TO THE INTERNET"
|
||||||
];
|
];
|
||||||
|
|
||||||
irc.client.addListener("error", message => console.log("error: ", message));
|
irc.client.addListener("error", message => console.log("error: ", message));
|
||||||
|
|
||||||
irc.client.addListener("message", (from, to, message, raw) => {
|
irc.client.addListener("message", (from, to, message, raw) => {
|
||||||
const client = irc.client;
|
const client = irc.client;
|
||||||
let pm;
|
let pm;
|
||||||
if (pm = !/^#/.test(to)) {
|
if (pm = !/^#/.test(to)) {
|
||||||
if (client.opt.debug) console.log("setting to from:", to, "to:", from, "cause its a PM");
|
if (client.opt.debug) console.log("setting to from:", to, "to:", from, "cause its a PM");
|
||||||
to = from;
|
to = from;
|
||||||
}
|
}
|
||||||
if (client.opt.debug) console.log("from:", from, "to:", to, "message:", message);
|
if (client.opt.debug) console.log("from:", from, "to:", to, "message:", message);
|
||||||
if (shiftRegex.test(message)) {
|
if (shiftRegex.test(message)) {
|
||||||
let cmd = message.match(shiftRegex);
|
let cmd = message.match(shiftRegex);
|
||||||
let args = (cmd[2] || "").trim();
|
let args = (cmd[2] || "").trim();
|
||||||
cmd = cmd[1];
|
cmd = cmd[1];
|
||||||
|
|
||||||
if (handleChatCommands({
|
if (handleChatCommands({
|
||||||
from: from,
|
from: from,
|
||||||
to: to,
|
to: to,
|
||||||
message: message,
|
message: message,
|
||||||
cmd: cmd,
|
cmd: cmd,
|
||||||
args: args
|
args: args
|
||||||
})) {
|
})) {
|
||||||
if (client.opt.debug)
|
if (client.opt.debug)
|
||||||
console.log("cmd:", cmd, "arg:", args);
|
console.log("cmd:", cmd, "arg:", args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (/pr0gramm\.com/.test(message) && to == "#w0bm") {
|
/*if (/pr0gramm\.com/.test(message) && to == "#w0bm") {
|
||||||
client.say(to, pr0text[Math.random()*pr0text.length|0]);
|
client.say(to, pr0text[Math.random()*pr0text.length|0]);
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (message.toUpperCase() == message && message.trim().split("").filter(c=>/[A-Z]/.test(c)).length > 5) {
|
if (message.toUpperCase() == message && message.trim().split("").filter(c=>/[A-Z]/.test(c)).length > 5) {
|
||||||
client.say(to, capsmsg[Math.random()*capsmsg.length|0]);
|
client.say(to, capsmsg[Math.random()*capsmsg.length|0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (w0bmregex.test(message)) {
|
if (w0bmregex.test(message)) {
|
||||||
var link = message.match(w0bmregex);
|
var link = message.match(w0bmregex);
|
||||||
if (link) {
|
if (link) {
|
||||||
var id = link[2];
|
var id = link[2];
|
||||||
if (id.length > 20) {
|
if (id.length > 20) {
|
||||||
client.say(to, "fuck you");
|
client.say(to, "fuck you");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var webm = link[3];
|
var webm = link[3];
|
||||||
db.getConnection((err, con) => {
|
db.getConnection((err, con) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
client.say(to, "sorry.. there seems to be a database problem right now D:");
|
client.say(to, "sorry.. there seems to be a database problem right now D:");
|
||||||
con.release();
|
con.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
con.query(
|
con.query(
|
||||||
"select v.id, v.deleted_at, u.username, c.name as category, v.videotitle, v.interpret, v.songtitle, v.imgsource,"+
|
"select v.id, v.deleted_at, u.username, c.name as category, v.videotitle, v.interpret, v.songtitle, v.imgsource,"+
|
||||||
" (select 1 from taggable_taggables t where t.taggable_id = v.id and t.tag_id = 1) as sfw,"+
|
" (select 1 from taggable_taggables t where t.taggable_id = v.id and t.tag_id = 1) as sfw,"+
|
||||||
" (select count(cm.id) from comments cm where cm.video_id = v.id and cm.deleted_at is NULL) as comments"+
|
" (select count(cm.id) from comments cm where cm.video_id = v.id and cm.deleted_at is NULL) as comments"+
|
||||||
" from videos v, users u, categories c where v.user_id = u.id and v.category_id = c.id"+
|
" from videos v, users u, categories c where v.user_id = u.id and v.category_id = c.id"+
|
||||||
" and " + (webm ? "v.file" : "v.id") + " = '" + id + "'", (err, rows, fields) => {
|
" and " + (webm ? "v.file" : "v.id") + " = '" + id + "'", (err, rows, fields) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
client.say(to, "sorry.. there seems to be an sql query problem D:");
|
client.say(to, "sorry.. there seems to be an sql query problem D:");
|
||||||
client.say(to, "" + err);
|
client.say(to, "" + err);
|
||||||
con.release();
|
con.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var vid = rows[0];
|
var vid = rows[0];
|
||||||
if (!vid) {
|
if (!vid) {
|
||||||
client.say(to, from + ": konnte kein video finden D:");
|
client.say(to, from + ": konnte kein video finden D:");
|
||||||
con.release();
|
con.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var txt = [];
|
var txt = [];
|
||||||
if (vid.deleted_at) txt.push("\x02gelöscht\x0f");
|
if (vid.deleted_at) txt.push("\x02gelöscht\x0f");
|
||||||
if (webm) txt.push("Link: \x02https://w0bm.com/" + vid.id + "\x0f");
|
if (webm) txt.push("Link: \x02https://w0bm.com/" + vid.id + "\x0f");
|
||||||
txt.push(vid["sfw"] ? "\x039SFW\x0f" : "\x034NSFW\x0f");
|
txt.push(vid["sfw"] ? "\x039SFW\x0f" : "\x034NSFW\x0f");
|
||||||
["videotitle", "interpret", "songtitle", "category", "username", "comments"].forEach((v, i) => {
|
["videotitle", "interpret", "songtitle", "category", "username", "comments"].forEach((v, i) => {
|
||||||
if (vid[v]) {
|
if (vid[v]) {
|
||||||
txt.push(
|
txt.push(
|
||||||
["Video Title", "Artist", "Song Title", "Category", "Uploader", "Comments"][i] + ": "
|
["Video Title", "Artist", "Song Title", "Category", "Uploader", "Comments"][i] + ": "
|
||||||
+"\x02" + vid[v] + "\x0f"
|
+"\x02" + vid[v] + "\x0f"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.say(to, txt.join(" | "));
|
client.say(to, txt.join(" | "));
|
||||||
con.release();
|
con.release();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (haitext.includes(message.toLowerCase())) {
|
if (haitext.includes(message.toLowerCase())) {
|
||||||
client.say(to, haitext[Math.random()*haitext.length|0] + " " + from + "!");
|
client.say(to, haitext[Math.random()*haitext.length|0] + " " + from + "!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^!d$/.test(message)) {
|
if (/^!d$/.test(message)) {
|
||||||
client.say(to, from + ": the magic dice shows " + ((Math.random()*6|0)+1) + " eyes.");
|
client.say(to, from + ": the magic dice shows " + ((Math.random()*6|0)+1) + " eyes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^a+[yi][yiou]*$/.test(message)) {
|
if (/^a+[yi][yiou]*$/.test(message)) {
|
||||||
client.say(to, "ayy lmao");
|
client.say(to, "ayy lmao");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/.+\?\?$/.test(message)) {
|
if (/.+\?\?$/.test(message)) {
|
||||||
let ye = Math.random() * 2 | 0;
|
let ye = Math.random() * 2 | 0;
|
||||||
client.say(to, "[" + (ye?"x":" ") + "] ja [" + (ye?" ":"x") + "] nein | " + message);
|
client.say(to, "[" + (ye?"x":" ") + "] ja [" + (ye?" ":"x") + "] nein | " + message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (~[".guuchan", ".vizon", ".lottery"].indexOf(message)) {
|
if (~[".guuchan", ".vizon", ".lottery"].indexOf(message)) {
|
||||||
let values = new Array(29).fill().map((v,i)=>1+i);
|
let values = new Array(29).fill().map((v,i)=>1+i);
|
||||||
let choices = new Array(6).fill().map(()=>values.splice(Math.random()*values.length|0,1)).sort((x,y)=>x-y).join(" ");
|
let choices = new Array(6).fill().map(()=>values.splice(Math.random()*values.length|0,1)).sort((x,y)=>x-y).join(" ");
|
||||||
client.say(to, "/notice guuchan !bet " + choices);
|
client.say(to, "/notice guuchan !bet " + choices);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const haitext = ["ohaio", "ohayou", "ohayo", "ohaiou", "ohai", "nabend", "morgen", "guten tag", "hallo", "hi", "hai", "hey", "moin", "hellau", "hello", "hallu", "yo", "servus", "tag", "tach", "alaaf", "alaf", "As-Salamu 'alaikum wa Rahmatullahi wa Barakatuhu"];
|
const haitext = ["ohaio", "ohayou", "ohayo", "ohaiou", "ohai", "nabend", "morgen", "guten tag", "hallo", "hi", "hai", "hey", "moin", "hellau", "hello", "hallu", "yo", "servus", "tag", "tach", "alaaf", "alaf", "As-Salamu 'alaikum wa Rahmatullahi wa Barakatuhu"];
|
||||||
|
|
||||||
|
|
||||||
const pr0text = [
|
const pr0text = [
|
||||||
"pr0gramm.com existiert nicht!",
|
"pr0gramm.com existiert nicht!",
|
||||||
"endlich oc von deiner fotze?",
|
"endlich oc von deiner fotze?",
|
||||||
"Pfui Daibel",
|
"Pfui Daibel",
|
||||||
"kommandozeile war vorher da",
|
"kommandozeile war vorher da",
|
||||||
"keiner von uns",
|
"keiner von uns",
|
||||||
"Falsches Grau",
|
"Falsches Grau",
|
||||||
"das reicht uns nicht",
|
"das reicht uns nicht",
|
||||||
"Zapalot nochmal!",
|
"Zapalot nochmal!",
|
||||||
"meinten sie reddit, 9gag oder fagbook?",
|
"meinten sie reddit, 9gag oder fagbook?",
|
||||||
"lustig weil pr0gramm",
|
"lustig weil pr0gramm",
|
||||||
"lustig weil fett",
|
"lustig weil fett",
|
||||||
"marina die huuure",
|
"marina die huuure",
|
||||||
"har har har kefer",
|
"har har har kefer",
|
||||||
"Ach du scheiße. Da drückste Minus.",
|
"Ach du scheiße. Da drückste Minus.",
|
||||||
"0815 wie fick",
|
"0815 wie fick",
|
||||||
"stumpf ist trumpf",
|
"stumpf ist trumpf",
|
||||||
"f man weiß ja nie",
|
"f man weiß ja nie",
|
||||||
"lass das nicht die repost polizei sehen!"
|
"lass das nicht die repost polizei sehen!"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user