This commit is contained in:
GottZ 2018-04-25 13:34:25 +02:00
parent 7cf91c0df2
commit 76e0646ddf
No known key found for this signature in database
GPG Key ID: 68207F1F516E4FD2

View File

@ -45,6 +45,7 @@ const userLevels = ["","+","%","@","&","~"];
const userLevelNames = ["user", "voiced", "halfop", "op", "admin", "owner"];
const getLevel = name => userLevelNames.indexOf(name);
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];
p.run = function (o) {
let client = this.irc.client;
@ -54,8 +55,13 @@ p.run = function (o) {
level = level !== undefined ? level.split("").map(x=>userLevels.indexOf(x)).sort().pop() : -1;
if (level === null || level === undefined) level = -1;
switch(o.cmd) {
case ".watiso":
client.say(o.to, JSON.stringify(o));
case ".adhs":
let s = o.args.toLowerCase();
s = s.filter(c => /[a-z]/.test(c));
s = s.map((c, i) => {
return chars[((c.charCodeAt() -97) * (i+1) * 107) %26] /26;
}).reduce((a,b)=>a+b) %1;
client.say(o.to, o.args + " has " + (s * 100).toFixed(2) + "% adhs");
return true;
case ".level":
client.say(o.to, o.from + " dein level: " + userLevelNames[level]);