cleanup
This commit is contained in:
parent
c348faee7d
commit
2c3b284e37
|
@ -22,7 +22,6 @@ const alphanoise = [8,20,10,14,12,11,26,16,4,21,22,13,24,6,5,15,2,23,7,19,18,25,
|
||||||
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[o.to] ? client.chans[o.to].users[o.from] : undefined;
|
|
||||||
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;
|
||||||
|
@ -65,11 +64,6 @@ p.run = function (o) {
|
||||||
client.say(o.to, "User limit reached");
|
client.say(o.to, "User limit reached");
|
||||||
return true;
|
return true;
|
||||||
case ".status":
|
case ".status":
|
||||||
/*if (level < getLevel("admin")) {
|
|
||||||
client.say(o.to, o.from + ": dein level: " + userLevelNames[level] + ", benötigtes level: admin");
|
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
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");
|
||||||
|
@ -101,24 +95,6 @@ p.run = function (o) {
|
||||||
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(", "));
|
||||||
/*var vid = rows[0];
|
|
||||||
if (!vid.id) {
|
|
||||||
client.say(to, from + ": konnte kein video finden D:");
|
|
||||||
con.release();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var txt = [];
|
|
||||||
if (vid.deleted_at) txt.push("\x02gelöscht\x0f");
|
|
||||||
if (webm) txt.push("Link: \x02https://w0bm.com/" + vid.id + "\x0f");
|
|
||||||
["interpret", "songtitle", "category", "username", "comments"].forEach((v, i) => {
|
|
||||||
if (vid[v]) {
|
|
||||||
txt.push(
|
|
||||||
["Interpret", "Titel", "Kategorie", "Uploader", "Kommentare"][i] + ": "
|
|
||||||
+"\x02" + vid[v] + "\x0f");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.say(to, txt.join(" | "));*/
|
|
||||||
con.release();
|
con.release();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
60
index.js
60
index.js
|
@ -17,38 +17,16 @@ let db = Mysql.createPool({
|
||||||
|
|
||||||
let irc = {};
|
let irc = {};
|
||||||
|
|
||||||
/*Irc.Client.prototype._connectionHandler = function() {
|
|
||||||
if (this.opt.webirc.ip && this.opt.webirc.pass && this.opt.webirc.host) {
|
|
||||||
this.send('WEBIRC', this.opt.webirc.pass, this.opt.userName, this.opt.webirc.host, this.opt.webirc.ip);
|
|
||||||
}
|
|
||||||
if (this.opt.password) {
|
|
||||||
this.send('PASS', this.opt.password);
|
|
||||||
}
|
|
||||||
if (this.opt.debug)
|
|
||||||
console.log('Sending irc NICK/USER');
|
|
||||||
this.send('NICK', this.opt.nick);
|
|
||||||
this.nick = this.opt.nick;
|
|
||||||
this._updateMaxLineLength();
|
|
||||||
this.send('USER', this.opt.userName, 'realnetzprotokolladresse.w0bm.com', 'realnetzprotokolladresse.w0bm.com', this.opt.realName);
|
|
||||||
this.emit('connect');
|
|
||||||
};*/
|
|
||||||
|
|
||||||
//irc.client = new Irc.Client('irc.rizon.so', 'w0bm', {
|
|
||||||
//irc.client = new Irc.Client('irc.n0xy.net', 'w0bm', {
|
|
||||||
|
|
||||||
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, {
|
||||||
// channels: ["#gz", "#w0bm"],
|
|
||||||
port: config.servers.n0xy.port,
|
port: config.servers.n0xy.port,
|
||||||
secure: config.servers.n0xy.secure,
|
secure: config.servers.n0xy.secure,
|
||||||
retryCount: 12000,
|
|
||||||
retryDelay: 3000,
|
|
||||||
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: false,
|
autoConnect: true,
|
||||||
password: config.servers.n0xy.srvPassword,
|
password: config.servers.n0xy.srvPassword,
|
||||||
channels: ["#w0bm", "#f0ck"]
|
channels: ["#w0bm", "#f0ck"]
|
||||||
});
|
});
|
||||||
|
@ -63,13 +41,9 @@ if (process.env.NODE_ENV != 'production') {
|
||||||
Object.defineProperty(repl.context, "q", {get:process.exit});
|
Object.defineProperty(repl.context, "q", {get:process.exit});
|
||||||
}
|
}
|
||||||
|
|
||||||
process.nextTick(()=>irc.client.connect());
|
|
||||||
|
|
||||||
const handleChatCommands = require("./chatCommands")(irc, db);
|
const handleChatCommands = require("./chatCommands")(irc, db);
|
||||||
|
|
||||||
const shiftRegex = /^(\.?\w+:?)(?:\s+(.+))?/;
|
const shiftRegex = /^(\.?\w+:?)(?:\s+(.+))?/;
|
||||||
//const w0bmregex = /(?:[^\/]|^|\/\/)w0bm\.com\/(?:\w+\/){0,3}([^ '\/@`´]+\.(webm)|\d+)/i;
|
|
||||||
//const w0bmregex = /(?:[^\/]|^|\/\/)(?:b\.)?w0bm\.com\/(?:\w+\/){0,3}([^ '\/@`´]+\.(webm)|\d+)/i;
|
|
||||||
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!",
|
||||||
|
@ -83,28 +57,8 @@ const capsmsg = [
|
||||||
|
|
||||||
irc.client.addListener("error", message => console.log("error: ", message));
|
irc.client.addListener("error", message => console.log("error: ", message));
|
||||||
|
|
||||||
irc.client.on("raw", raw => {
|
|
||||||
if (irc.client.opt.debugRaw) console.log(raw);
|
|
||||||
/*if (raw.command == "rpl_whoischannels") {
|
|
||||||
let chan = raw.args[2].split(" ").filter(c => /#w0bm$/.test(c));
|
|
||||||
if (!chan || !chan[0] || chan[0].split("#")) return;
|
|
||||||
let mode = chan[0].split("#")[0];
|
|
||||||
irc.client.chans["#w0bm"].users[raw.args[1]] = mode;
|
|
||||||
}*/
|
|
||||||
});
|
|
||||||
|
|
||||||
/*irc.client.on("-mode", (chan, nick, mode, user, message) => {
|
|
||||||
if (typeof user != "undefined")
|
|
||||||
irc.client.send("WHOIS", user);
|
|
||||||
})
|
|
||||||
irc.client.on("+mode", (chan, nick, mode, user, message) => {
|
|
||||||
if (typeof user != "undefined")
|
|
||||||
irc.client.send("WHOIS", user);
|
|
||||||
})*/
|
|
||||||
|
|
||||||
irc.client.addListener("message", (from, to, message, raw) => {
|
irc.client.addListener("message", (from, to, message, raw) => {
|
||||||
const client = irc.client;
|
const client = irc.client;
|
||||||
// if (client.opt.debug) console.log("raw:", raw);
|
|
||||||
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");
|
||||||
|
@ -123,25 +77,21 @@ irc.client.addListener("message", (from, to, message, raw) => {
|
||||||
cmd: cmd,
|
cmd: cmd,
|
||||||
args: args
|
args: args
|
||||||
})) {
|
})) {
|
||||||
//console.log("cmd:", cmd, "arg:", arg);
|
if (client.opt.debug)
|
||||||
|
console.log("cmd:", cmd, "arg:", args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (/w0bm\.com\/\d+/.test(message)) {
|
|
||||||
client.say(to, "durch Aufruf des Links: "+(message.match(/(w0bm\.com\/\d+)/)[0])+" machen Sie sich strafbar!");
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user