This commit is contained in:
Flummi 2018-09-07 20:29:21 +02:00
parent f7303c804d
commit 15aca99a85
4 changed files with 11 additions and 5 deletions

View File

@ -1,13 +1,15 @@
import { irc as irclib } from "./src/clients/irc"; import { irc as irclib } from "./src/clients/irc";
import { tg as tglib } from "./src/clients/tg"; import { tg as tglib } from "./src/clients/tg";
import { admins } from "./src/inc/admin";
import EventEmitter from "events"; import EventEmitter from "events";
const clients = []; const clients = [];
const cuffeo = class wrapper extends EventEmitter { const cuffeo = class wrapper extends EventEmitter {
constructor(cfg) { constructor(cfg, _admins = []) {
super(); super();
admins = _admins;
for (let srv in cfg) { for (let srv in cfg) {
if(cfg[srv].val.enabled) { if(cfg[srv].val.enabled) {
switch (cfg[srv].val.type) { switch (cfg[srv].val.type) {

View File

@ -1,3 +1,4 @@
import { getLevel } from "../inc/admin";
import modules from "./irc/index"; import modules from "./irc/index";
import net from "net"; import net from "net";
@ -101,10 +102,10 @@ export class irc extends EventEmitter {
user: Object.assign(this.parsePrefix(tmp.prefix), { user: Object.assign(this.parsePrefix(tmp.prefix), {
account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account, account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account,
prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix, prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix,
/*level: getLevel(this.network, Object.assign(this.parsePrefix(tmp.prefix), { level: getLevel(this.network, Object.assign(this.parsePrefix(tmp.prefix), {
account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account, account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account,
prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix
}))*/ }))
}), }),
message: tmp.params[1], message: tmp.params[1],
time: ~~(Date.now() / 1000), time: ~~(Date.now() / 1000),

View File

@ -1,3 +1,4 @@
import { getLevel } from "../inc/admin";
import rp from "request-promise-native"; import rp from "request-promise-native";
import EventEmitter from "events"; import EventEmitter from "events";
@ -104,12 +105,12 @@ export class tg extends EventEmitter {
nick: tmp.from.first_name, nick: tmp.from.first_name,
username: tmp.from.username, username: tmp.from.username,
account: tmp.from.id.toString(), account: tmp.from.id.toString(),
/*level: getLevel("Telegram", { level: getLevel("Telegram", {
prefix: `${tmp.from.username}!${tmp.from.id}`, prefix: `${tmp.from.username}!${tmp.from.id}`,
nick: tmp.from.first_name, nick: tmp.from.first_name,
username: tmp.from.username, username: tmp.from.username,
account: tmp.from.id.toString() account: tmp.from.id.toString()
})*/ })
}, },
self: this.server, self: this.server,
message: tmp.text, message: tmp.text,

View File

@ -21,6 +21,8 @@ export const loadAdmins = () => {
}; };
loadAdmins();*/ loadAdmins();*/
export let admins = [];
export const getLevel = (network, user) => { export const getLevel = (network, user) => {
let ret = { let ret = {
level: 0, level: 0,