mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-29 15:42:18 +00:00
27 lines
600 B
JavaScript
27 lines
600 B
JavaScript
"use strict"
|
|
|
|
// Import the discord.js module
|
|
const Discord = require('discord.js');
|
|
const winston = require('winston');
|
|
|
|
function DiscordBot(config) {
|
|
this.hook = new Discord.WebhookClient(config.hook_id,config.hook_token);
|
|
this.spamProtection = {
|
|
fillStatus: null,
|
|
};
|
|
|
|
}
|
|
|
|
DiscordBot.prototype.notifyChannel = function(message) {
|
|
this.hook.send(message);
|
|
};
|
|
|
|
var bot;
|
|
|
|
module.exports = (config) => {
|
|
if (bot) return bot;
|
|
if (!config) throw new Error("No credentials provided for Discord Gather Bot");
|
|
bot = new DiscordBot(config);
|
|
bot.notifyChannel('Gather restarted');
|
|
return bot;
|
|
};
|