Schwitzermod lol

This commit is contained in:
Flummi 2018-11-07 18:36:22 +01:00
parent 88dc71ea9b
commit 4afe02ffe8
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import { logger } from "../inc/log";
import { getLevel } from "../inc/admin"; import { getLevel } from "../inc/admin";
import { spurdo } from "../inc/spurdo"; import { spurdo } from "../inc/spurdo";
import { schmuser } from "../inc/schmuser"; import { schmuser } from "../inc/schmuser";
import { schwitzer } from "../inc/schwitzer";
import fetch from "../inc/fetch"; import fetch from "../inc/fetch";
import EventEmitter from "events"; import EventEmitter from "events";
@ -23,7 +24,8 @@ export class tg extends EventEmitter {
user: new Map(), user: new Map(),
me: {}, me: {},
spurdo: false, spurdo: false,
schmuser: false schmuser: false,
schwitzer: false
}; };
this.connect().then(() => { this.connect().then(() => {
this.poller = setInterval(() => { this.poll(); }, this.options.pollrate); this.poller = setInterval(() => { this.poll(); }, this.options.pollrate);
@ -138,6 +140,8 @@ export class tg extends EventEmitter {
msg = spurdo(msg); msg = spurdo(msg);
if(this.server.schmuser) if(this.server.schmuser)
msg = schmuser(msg); msg = schmuser(msg);
if(this.server.schwitzer)
msg = schwitzer(msg);
return msg.toString() return msg.toString()
.split("<").join("&lt;") .split("<").join("&lt;")
.split(">").join("&gt;") .split(">").join("&gt;")

4
src/inc/schwitzer.mjs Normal file
View File

@ -0,0 +1,4 @@
export function schwitzer(text) {
text = text.split(" ");
return text.map(word => word.match(/(i|l)$/gm) ? word : `${word}li`).join(" ")
}