sets lol
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { logger } from "../inc/log";
|
||||
import { getLevel } from "../inc/admin";
|
||||
import { spurdo } from "../inc/spurdo";
|
||||
|
||||
import Discord from "discord.js";
|
||||
import EventEmitter from "events";
|
||||
@@ -9,14 +10,17 @@ export class discord extends EventEmitter {
|
||||
super();
|
||||
this.options = options || {};
|
||||
this.token = options.token || null;
|
||||
this.set = this.options.set || "all";
|
||||
|
||||
this.bot = new Discord.Client();
|
||||
this.bot.login(this.token);
|
||||
|
||||
this.server = {
|
||||
set: this.set,
|
||||
channel: new Map(),
|
||||
user: new Map(),
|
||||
me: {}
|
||||
me: {},
|
||||
spurdo: false
|
||||
};
|
||||
|
||||
this.bot.on("ready", () => {
|
||||
@@ -54,6 +58,7 @@ export class discord extends EventEmitter {
|
||||
},
|
||||
message: tmp.content,
|
||||
time: ~~(Date.now() / 1000),
|
||||
self: this.server,
|
||||
reply: msg => this.send(tmp, this.format(msg)),
|
||||
replyAction: msg => this.send(tmp, this.format(`*${msg}*`), "normal"),
|
||||
replyNotice: msg => this.send(tmp, this.format(msg))
|
||||
@@ -70,6 +75,8 @@ export class discord extends EventEmitter {
|
||||
}
|
||||
}
|
||||
format(msg) {
|
||||
if(this.server.spurdo)
|
||||
msg = spurdo(msg);
|
||||
return msg.toString()
|
||||
.replace(/\[b\](.*?)\[\/b\]/g, "**$1**") // bold
|
||||
.replace(/\[i\](.*?)\[\/i\]/g, "*$1*") // italic
|
||||
@@ -78,22 +85,6 @@ export class discord extends EventEmitter {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Channel:
|
||||
msg.channel.id
|
||||
msg.channel.name
|
||||
Server:
|
||||
msg.channel.guild.id
|
||||
msg.channel.guild.name
|
||||
|
||||
User:
|
||||
msg.author.id
|
||||
msg.author.username
|
||||
|
||||
Message:
|
||||
msg.content (msg.type === "DEFAULT")
|
||||
*/
|
||||
|
||||
Map.prototype.hasi = function(val) {
|
||||
for (let [key] of this)
|
||||
if(key.toLowerCase() === val.toLowerCase())
|
||||
|
||||
@@ -39,12 +39,14 @@ export class irc extends EventEmitter {
|
||||
this.username = this.options.username || "test";
|
||||
this.realname = this.options.realname || "test";
|
||||
this.channels = this.options.channels || [];
|
||||
this.set = this.options.set || "all";
|
||||
this._recachetime = 60 * 30; // 30 minutes
|
||||
this._cmd = new Map();
|
||||
|
||||
modules.forEach(mod => mod(this));
|
||||
|
||||
this.server = {
|
||||
set: this.set,
|
||||
motd: "",
|
||||
me: {},
|
||||
channel: [],
|
||||
|
||||
@@ -11,11 +11,13 @@ export class tg extends EventEmitter {
|
||||
this.options = options || {};
|
||||
this.token = options.token || null;
|
||||
this.options.pollrate = options.pollrate || 1000;
|
||||
this.set = this.options.set || "all";
|
||||
this.network = "Telegram";
|
||||
this.api = `https://api.telegram.org/bot${this.token}`;
|
||||
this.lastUpdate = 0;
|
||||
this.lastMessage = 0;
|
||||
this.server = {
|
||||
set: this.set,
|
||||
channel: new Map(),
|
||||
user: new Map(),
|
||||
me: {},
|
||||
|
||||
Reference in New Issue
Block a user