Schmuser :_D
This commit is contained in:
parent
9144dc82de
commit
6923b973ad
@ -1,6 +1,7 @@
|
||||
import { logger } from "../inc/log";
|
||||
import { getLevel } from "../inc/admin";
|
||||
import { spurdo } from "../inc/spurdo";
|
||||
import { schmuser } from "../inc/schmuser";
|
||||
|
||||
import rp from "request-promise";
|
||||
import EventEmitter from "events";
|
||||
@ -21,7 +22,8 @@ export class tg extends EventEmitter {
|
||||
channel: new Map(),
|
||||
user: new Map(),
|
||||
me: {},
|
||||
spurdo: false
|
||||
spurdo: false,
|
||||
schmuser: false
|
||||
};
|
||||
this.connect().then(() => {
|
||||
this.poller = setInterval(() => { this.poll(); }, this.options.pollrate);
|
||||
@ -134,6 +136,8 @@ export class tg extends EventEmitter {
|
||||
format(msg) {
|
||||
if(this.server.spurdo)
|
||||
msg = spurdo(msg);
|
||||
if(this.server.schmuser)
|
||||
msg = schmuser(msg);
|
||||
return msg.toString()
|
||||
.split("<").join("<")
|
||||
.split(">").join(">")
|
||||
|
18
src/inc/schmuser.mjs
Normal file
18
src/inc/schmuser.mjs
Normal file
@ -0,0 +1,18 @@
|
||||
const replacements = [
|
||||
["blöd", "plöd"], ["nein", "neim"], ["ein", "1"], ["bitte", "bidde"],
|
||||
["Bitte", "Bidde"], ["ich", "i"], ["Ich", "i"], ["auch", "au"],
|
||||
["noch", "no"], ["Hallo", "Halo"], ["hallo", "halo"], ["bin", "bims"],
|
||||
["Bin", "Bims"], ["ist", "is"], ["Ist", "Is"], ["danke", "dangge"],
|
||||
["Danke", "Dangge"], ["t", "dd"], ["mm", "m"], ["n", "m"],
|
||||
["mir", "mi"], ["Mir", "Mi"], ["die", "di"], ["Die", "Di"],
|
||||
["Immer", "Imer"], ["immer", "imer"], ["Hab", "Han"], ["hab", "han"]
|
||||
];
|
||||
|
||||
export function schmuser(text) {
|
||||
replacements.forEach(filter => {
|
||||
let replaceFrom = new RegExp(filter[0], 'gm')
|
||||
, replaceTo = filter[1];
|
||||
text = text.replace(replaceFrom, replaceTo);
|
||||
});
|
||||
return text;
|
||||
}
|
Loading…
Reference in New Issue
Block a user