remove fsimport

This commit is contained in:
Flummi 2017-12-04 13:03:21 +01:00
parent 6d5b33bed4
commit e7b8f0b456
3 changed files with 6 additions and 17 deletions

View File

@ -1,7 +1,6 @@
import { logger } from "./inc/log"; import { logger } from "./inc/log";
import { read, cfg } from "./inc/cfg"; import { read, cfg } from "./inc/cfg";
import { wrapper } from "./inc/wrapper"; import { wrapper } from "./inc/wrapper";
import fs from "fs";
import triggers from "./inc/trigger/main"; import triggers from "./inc/trigger/main";
@ -13,19 +12,12 @@ read().then(() => {
trigger: trigger trigger: trigger
}; };
/*fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => {
if(file.substr(-3, 3) === ".js") {
logger.info(`(main) loading trigger: ${file}`);
require(`${__dirname}/inc/trigger/${file}`)(self);
}
});*/
triggers.forEach((mod, i) => { triggers.forEach((mod, i) => {
logger.info(`(main) loading trigger: ${i}`) logger.info(`(main) loading trigger: ${i}`)
mod(self); mod(self);
}); });
bot.on("message", e => { // Todo: eventhandler bot.on("message", e => {
for (var [name, trigger] of self._trigger.entries()) { for (var [name, trigger] of self._trigger.entries()) {
if (!trigger.call.exec(e.message)) if (!trigger.call.exec(e.message))
continue; continue;

View File

@ -6,8 +6,6 @@ import modules from "./irc/main";
import net from "net"; import net from "net";
import tls from "tls"; import tls from "tls";
import EventEmitter from "events"; import EventEmitter from "events";
import util from "util";
import fs from "fs";
const colors = { const colors = {
red: "\x0304$1\x0304", red: "\x0304$1\x0304",
@ -21,9 +19,9 @@ const replaceColor = (match, color, text) => {
return text; return text;
}; };
export class irc { export class irc extends EventEmitter {
constructor(options) { constructor(options) {
EventEmitter.call(this); super();
this.options = options || {}; this.options = options || {};
this.options.channels = this.options.channels || []; this.options.channels = this.options.channels || [];
this.options.host = this.options.host || "127.0.0.1"; this.options.host = this.options.host || "127.0.0.1";
@ -161,7 +159,6 @@ export class irc {
; ;
} }
} }
util.inherits(irc, EventEmitter);
Map.prototype.hasi = function(val) { Map.prototype.hasi = function(val) {
for (let [key] of this) for (let [key] of this)

View File

@ -1,6 +1,6 @@
import { logger } from "../log.mjs"; import { logger } from "../log";
import { getLevel } from "../admin.mjs"; import { getLevel } from "../admin";
import { spurdo } from "../spurdo.mjs"; import { spurdo } from "../spurdo";
import rp from "request-promise"; import rp from "request-promise";
import EventEmitter from "events"; import EventEmitter from "events";