This commit is contained in:
Flummi 2017-11-20 15:49:04 +01:00
parent feac3e4872
commit 98da8051f0

View File

@ -26,7 +26,7 @@ class irc {
const files = fs.readdirSync(`${__dirname}/irc/`); const files = fs.readdirSync(`${__dirname}/irc/`);
for(let file in files) { for(let file in files) {
if(files[file].substr(-3, 3) === ".js") { if(files[file].substr(-3, 3) === ".js") {
logger.info(`loading cmd: ${files[file]}`); logger.debug(`(${this.network}) loading cmd: ${files[file]}`);
require(`${__dirname}/irc/${files[file]}`)(this); require(`${__dirname}/irc/${files[file]}`)(this);
} }
} }
@ -61,11 +61,11 @@ class irc {
} }
send(data) { send(data) {
this.socket.write(`${data}\n`); this.socket.write(`${data}\n`);
logger.debug(`out: ${data}`); logger.debug(`(${this.network}) out: ${data}`);
} }
parse(data, [a, ...b] = data.split(/ +:/)) { parse(data, [a, ...b] = data.split(/ +:/)) {
let tmp = a.split(" ").concat(b); let tmp = a.split(" ").concat(b);
logger.debug(`in: ${[...tmp]}`); logger.debug(`(${this.network}) in: ${[...tmp]}`);
return data.charAt(0) === ":" ? { return data.charAt(0) === ":" ? {
prefix: tmp.shift(), prefix: tmp.shift(),
command: tmp.shift(), command: tmp.shift(),