move back to d.js + emojis in config

This commit is contained in:
Emily 2021-07-15 12:26:02 +10:00
parent 1b5dc56eeb
commit c0c1945b2c
3 changed files with 28 additions and 36 deletions

View file

@ -1,8 +0,0 @@
{
"success": "<:success:466995111885144095>",
"botError": "<:warning:701681841190600704>",
"userError": "<:error:466995152976871434>",
"permError": "<:denied:466995195150336020>",
"wait": "<:wait:467115775849922570>"
}

View file

@ -1,6 +1,6 @@
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license. // Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
const Eris = (require('eris')); const Discord = require('discord.js');
const CommandLoader = require('./util/commandLoader'); const CommandLoader = require('./util/commandLoader');
const EventLoader = require('./util/eventLoader'); const EventLoader = require('./util/eventLoader');
const EventHandler = require('./util/handlers/eventHandler'); const EventHandler = require('./util/handlers/eventHandler');
@ -8,15 +8,13 @@ const MessageHandler = require('./util/handlers/messageHandler');
const Functions = require('./util/functions'); const Functions = require('./util/functions');
const Database = require('./util/database'); const Database = require('./util/database');
const Logger = require('./util/logger'); const Logger = require('./util/logger');
const RichEmbed = require('./util/embed');
const sentry = require('@sentry/node'); const sentry = require('@sentry/node');
const emojis = require('./assets/emojis.json');
const config = require('../botconfig.json'); const config = require('../botconfig.json');
const version = require('../package.json').version; const version = require('../package.json').version;
class WoomyClient extends Eris.Client { class WoomyClient extends Discord.Client {
constructor (token, options) { constructor (options) {
super(token, options); super(options);
// Important information Woomy needs to access // Important information Woomy needs to access
this.config = config; this.config = config;
@ -24,9 +22,7 @@ class WoomyClient extends Eris.Client {
this.version = version; this.version = version;
// Essential modules // Essential modules
this.emojis = emojis;
this.logger = Logger; this.logger = Logger;
this.RichEmbed = RichEmbed;
this.db = new Database(this); this.db = new Database(this);
this.functions = new Functions(this); this.functions = new Functions(this);
this.commandLoader = new CommandLoader(this); this.commandLoader = new CommandLoader(this);
@ -35,13 +31,13 @@ class WoomyClient extends Eris.Client {
this.messageHandler = new MessageHandler(this); this.messageHandler = new MessageHandler(this);
// Collections to store our successfully loaded events and commands in, as well as cooldowns. // Collections to store our successfully loaded events and commands in, as well as cooldowns.
this.commands = new Eris.Collection(); this.commands = new Discord.Collection();
this.aliases = new Eris.Collection(); this.aliases = new Discord.Collection();
this.eventModules = new Eris.Collection(); this.eventModules = new Discord.Collection();
this.cooldowns = new Eris.Collection(); this.cooldowns = new Discord.Collection();
} }
// Listen for Eris events and pass needed information to the event handler so we can respond to them. // Listen for Discord events and pass needed information to the event handler so we can respond to them.
createEventListeners () { createEventListeners () {
this.on('ready', this.runReadyModules); this.on('ready', this.runReadyModules);
this.on('error', this.runErrorModules); this.on('error', this.runErrorModules);
@ -98,26 +94,22 @@ class WoomyClient extends Eris.Client {
} }
// Initialize our client // Initialize our client
const client = new WoomyClient(config.token, { const client = new WoomyClient({
maxShards: 'auto', shards: 'auto',
restMode: true,
//getAllUsers: true,
defaultImageSize: 2048,
intents: [ intents: [
'guilds', 'GUILDS',
'guildMembers', 'GUILD_MEMBERS',
'guildEmojis', 'GUILD_EMOJIS',
'guildVoiceStates', 'GUILD_VOICE_STATES',
'guildMessages', 'GUILD_MESSAGES',
'guildMessageReactions', 'DIRECT_MESSAGES',
'guildMessageTyping' 'GUILD_MESSAGE_REACTIONS',
] ]
}); });
// Extensions of native javascript types, *not good practice* but they're useful // Extensions of native javascript types, *not good practice* but they're useful
require('./util/prototypes'); require('./util/prototypes');
// Load commands, event modules and create listeners for Eris events (ready, errors, messages, etc) // Load commands, event modules and create listeners for Discord events (ready, errors, messages, etc)
client.commandLoader.loadCommands(); client.commandLoader.loadCommands();
client.eventLoader.loadEventModules(); client.eventLoader.loadEventModules();
client.createEventListeners(); client.createEventListeners();
@ -134,7 +126,7 @@ if (client.config.developmentMode === false) {
} }
// Login to Discord // Login to Discord
client.connect(); client.login(config.token);
// Process exception/promise rejection listeners // Process exception/promise rejection listeners
process.on('uncaughtException', (error) => { process.on('uncaughtException', (error) => {

View file

@ -19,4 +19,12 @@
"password": "", "password": "",
"port": 0000 "port": 0000
} }
"emojis": {
"success": "<:success:466995111885144095>",
"botError": "<:warning:701681841190600704>",
"userError": "<:error:466995152976871434>",
"permError": "<:denied:466995195150336020>",
"wait": "<:wait:467115775849922570>"
}
} }