This commit is contained in:
Flummi 2018-08-30 15:09:28 +02:00
commit 31dce61f36
5 changed files with 52 additions and 9 deletions

View File

@ -1,3 +1,6 @@
const max = 400;
let whois = [];
export default client => {
client._cmd.set("352", function (msg) { // who_entry
if (!this.server.channel[msg.params[1]])
@ -7,10 +10,18 @@ export default client => {
username: msg.params[2],
hostname: msg.params[3]
});
this.whois(msg.params[5]);
whois.push(msg.params[5]);
}.bind(client));
client._cmd.set("315", function (msg) { // who_end
//
this.whois(whois.reduce((a, b) => {
a += `${b},`;
if(a.length >= max) {
this.whois(a.slice(0, -1));
a = "";
}
return a;
}, "").slice(0, -1));
whois = [];
}.bind(client));
};

View File

@ -4,7 +4,6 @@ export default bot => {
bot._trigger.set("irpg", new bot.trigger({
call: /^(\.|\/)irpg/i,
set: "uwe",
active: false,
f: e => {
const user = e.args[0] || e.user.nick;
rp("https://irpg.zneb.org/players.php").then(top => {

View File

@ -5,7 +5,7 @@ class cleverbot {
constructor() {
this.api = "https://cleverbot.io/1.0";
this.nick = "";
setTimeout(()=>this.init(), 3000);
setTimeout(()=>this.init(), 5000);
}
init() {
@ -40,4 +40,4 @@ class cleverbot {
}
};
export default new cleverbot();
export default new cleverbot();

View File

@ -257,6 +257,39 @@ export default bot => {
}
}));
<<<<<<< HEAD
=======
bot._trigger.set("irpg", new bot.trigger({
call: /^(\.|\/)irpg/i,
set: "uwe",
f: e => {
const user = e.args[0] || e.user.nick;
rp("https://irpg.zneb.org/players.php").then(top => {
let prank = 0
, i = 1;
const dom = new jsdom.JSDOM(top);
let playerlist = dom.window.document.querySelectorAll("ol > li");
let player = null;
for(let p of playerlist) {
if (p.innerHTML.includes(`player=${user}">`)) {
prank = i;
player = p;
break;
}
i++;
}
if(player !== null) {
const [, plevel, pclass, puntil] = player.innerHTML.match(/.*, the level (.*?) (.*?)\. Next level in (.*?)\./);
e.reply(`([i]${prank} / ${playerlist.length}[/i]) [b]${user}[/b], the [b]${pclass}[/b]: level: ${plevel}, next level in ${puntil}.`);
}
else
e.reply(`player [b]${user}[/b] was not found`);
});
}
}));
>>>>>>> 2b731c211cc1fd05c446f3dbd2934bbc2c55d231
bot._trigger.set("blah", new bot.trigger({
call: /^[A-ZÄÖÜẞ](?: [A-ZÄÖÜẞ]){1,5}$/,
set: "uwe",

View File

@ -1,7 +1,7 @@
import { cfg } from "./cfg";
import { irc as irclib } from "../clients/irc";
import { tg as tglib } from "../clients/tg";
import { discord as discordlib } from "../clients/discord";
//import { discord as discordlib } from "../clients/discord";
import EventEmitter from "events";
@ -27,13 +27,13 @@ const wrapper = class wrapper extends EventEmitter {
client: new tglib(cfg.client[srv].val)
});
break;
case "discord":
/*case "discord":
clients.push({
name: "discord",
type: "discord",
client: new discordlib(cfg.client[srv].val)
});
break;
break;*/
}
}
}
@ -46,4 +46,4 @@ const wrapper = class wrapper extends EventEmitter {
}
};
export { wrapper, clients };
export { wrapper, clients };