From e04294816e369176ba1a24e67ddca20c86ea35fb Mon Sep 17 00:00:00 2001 From: Flummi Date: Mon, 13 Nov 2017 21:11:13 +0100 Subject: [PATCH] ... --- src/bot.js | 9 +++++++-- src/inc/clients/irc.js | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/bot.js b/src/bot.js index ba93bb7..9409919 100644 --- a/src/bot.js +++ b/src/bot.js @@ -16,14 +16,19 @@ read().then(() => { args = e.message.substring(3); var context = { e: e, - gf: "nogf" + gf: "nogf", + c: clients, + console: { + log: console.log + } } try { var output = safeEval(args, context); if (typeof output !== undefined && output !== 'undefined' && output) { let blah = JSON.stringify(output); - if (blah != "Converting circular structure to JSON") + if (blah != "Converting circular structure to JSON") { e.reply(blah.length > 220 ? `holy fuck, Ausgabe wäre viel zu lang! (${blah.length} Zeichen :DDDDDD)` : blah); + } } } catch (err) { diff --git a/src/inc/clients/irc.js b/src/inc/clients/irc.js index f6466e8..0f3ad36 100644 --- a/src/inc/clients/irc.js +++ b/src/inc/clients/irc.js @@ -18,6 +18,7 @@ class irc { this.username = this.options.username || "test"; this.realname = this.options.realname || "test"; this.channels = this.options.channels || []; + this._recachetime = (10 * 1000); // 10 minutes this.server = { motd: "", me: {}, @@ -75,9 +76,10 @@ class irc { account: tmpuser.account || false, registered: tmpuser.registered || false, oper: tmpuser.oper || false, - channels: tmpuser.channels || [] + channels: tmpuser.channels || [], + cached: ~~(Date.now() / 1000) }; - this.server.user.set( msg.params[1], tmpuser ); + this.server.user.set( msg.params[1].toLowerCase(), tmpuser ); break; case "319": // Chanlist Todo let tmpchan = new Map(); @@ -119,6 +121,7 @@ class irc { username: msg.params[2], hostname: msg.params[3] }); + this.send(`WHOIS ${msg.params[5]}`); break; case "315": // who_end console.log(this.server.channel);