refactor: update to discord.js v13 (#203)

* build: bump djs version

* refactor(add): update

* refactor(blacklist): update

* refactor(close): update

* refactor(help): update

* refactor(new): update

* refactor(panel): update

* refactor(remove): update

* refactor(stats): update

* refactor(survey): update

* refactor(tag): update

* refactor(topic): update

* refactor(guild): update, now Structures doesn't exist

Also I don't know if this would work actually, let's see

* refactor(guild_member)

* refactor(index.js): add intents

I can't understand how you do the indentation, sorry if I made a mistake

* Update package.json

* fix(intents): add `DIRECT_MESSAGES` intents


- also fix code style and indentation

* style: fix properties order and indentation

* fix(guild)

* Update and rename message.js to messageCreate.js

* Update guild.js

* refactor(manager): fix

* Update manager.js

* fix(help)

* style: fix spacing

* fix: permission overwrites

* fix(new)

* fix(presence): rename activity to activities

* fix(presence): fix debug message

* fix: update channel types

* Update new.js

* fix(embeds): update footer function

* fix: broken code

* style: add new lines around embed blocks

* fix(messages): update remaining `send()` calls

* fix(messages): i missed one

* build: replace fastify logger with standard logger

* refactor: update message and reaction collectors

Co-authored-by: Isaac <git@eartharoid.me>
This commit is contained in:
Puneet Gopinath
2021-08-17 01:35:20 +05:30
committed by GitHub
parent 96d1ddc48c
commit 0f10908ee0
30 changed files with 749 additions and 619 deletions

View File

@@ -83,7 +83,7 @@ process.on('unhandledRejection', error => {
log.error(error);
});
const { selectPresence } = require('./utils/discord');
const DiscordUtils = require('./utils/discord');
const Cryptr = require('cryptr');
const I18n = require('@eartharoid/i18n');
const ListenerLoader = require('./modules/listeners/loader');
@@ -93,14 +93,12 @@ const TicketManager = require('./modules/tickets/manager');
const fetch = require('node-fetch');
require('./modules/structures')(); // load extended structures before creating the client
const {
Client,
Intents
} = require('discord.js');
// eslint-disable-next-line no-unused-vars
const FastifyLogger = require('leekslazylogger-fastify');
const Logger = require('leekslazylogger');
/**
* The Discord client
@@ -110,13 +108,18 @@ const FastifyLogger = require('leekslazylogger-fastify');
class Bot extends Client {
constructor() {
super({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS
],
partials: [
'CHANNEL',
'MESSAGE',
'REACTION'
],
presence: selectPresence(),
ws: { intents: Intents.NON_PRIVILEGED }
presence: DiscordUtils.selectPresence()
});
(async () => {
@@ -125,7 +128,7 @@ class Bot extends Client {
/**
* A [leekslazylogger](https://logger.eartharoid.me) instance
* @type {FastifyLogger}
* @type {Logger}
*/
this.log = log;
@@ -170,6 +173,9 @@ class Bot extends Client {
this.plugins = new PluginManager(this);
this.plugins.load(); // load plugins
/** Some utility methods */
this.utils = new DiscordUtils(this);
this.log.info('Connecting to Discord API...');
this.login();