This commit is contained in:
Flummi 2018-09-08 12:55:44 +02:00
parent 67238858bd
commit ea3757d86c
4 changed files with 27 additions and 26 deletions

View File

@ -1,6 +1,6 @@
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 { admins } from "./src/inc/admin";
import EventEmitter from "events"; import EventEmitter from "events";
@ -9,7 +9,7 @@ const clients = [];
const cuffeo = class cuffeo extends EventEmitter { const cuffeo = class cuffeo extends EventEmitter {
constructor(cfg, _admins = []) { constructor(cfg, _admins = []) {
super(); super();
admins.admins = _admins; 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,4 +1,4 @@
import admins from "../inc/admin"; import { getLevel } from "../inc/admin";
import modules from "./irc/index"; import modules from "./irc/index";
import net from "net"; import net from "net";
@ -102,7 +102,7 @@ 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: admins.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
})) }))

View File

@ -1,4 +1,4 @@
import admins from "../inc/admin"; import { getLevel } from "../inc/admin";
import fetch from "../inc/fetch"; import fetch from "../inc/fetch";
import EventEmitter from "events"; import EventEmitter from "events";
@ -105,7 +105,7 @@ 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: admins.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,

View File

@ -1,8 +1,6 @@
let _admins = []; let _admins = [];
export default { const getLevel = (network, user) => {
admins: _admins,
getLevel: (network, user) => {
let ret = { let ret = {
level: 0, level: 0,
verified: false verified: false
@ -20,5 +18,8 @@ export default {
} }
}; };
return ret; return ret;
} };
export {
_admins, getLevel
}; };