-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The quick and easy Discord.js upgrade #350
base: master
Are you sure you want to change the base?
The quick and easy Discord.js upgrade #350
Conversation
requires version change still |
fix for discord-server-status.js, the activity type field wasn't changed to the proper input. set to custom activity so that it's easy to see the entire status text from the sidebar. |
Have you got plugins to log to threads within channels? |
yup, just tested it. threads are pretty much treated like channels from an API perspective from discord. so you just throw the thread ID in for where the channel ID is. |
Adding flags, will need some QA on this so I can make sure its stable enough to make ready for public use. |
yup, currently running on all unnamed servers flawlessly so far. |
potential changes to make so that plugins have a better chance of not needing changes.
|
side note that this PR fixes a known bug that causes squadjs/discord.js to crash when sending text in voice channels. |
@steelskillet So before in v12 you could await the login function which then resolves the whole Client class. In v14 it is slightly different, after In order to fix this we would need to wait until the Client is "ready" before returning the connector.
await new Promise((resolve, reject) => {
connector.once(Events.ClientReady, (readyClient) => {
Logger.verbose('SquadServerFactory', 1, `Ready! Logged in as ${readyClient.user.tag}`);
resolve();
});
connector.once(Events.Error, reject);
connector.login(connectorConfig);
}).catch((ex) => {
throw ex
}); The downside is the startup process takes slightly longer due to waiting for the client to fully be ready. In addition to v14 , channels are cached in a Map so there is no need to await and fetch them.
/** @type { import('discord.js').Client<true> } */
this.discordClient = this.options.discordClient;
this.channel = this.discordClient.channels.cache.get(this.options.channelID); |
updated discord.js to v14.14.1 (latest) and fixed any issues present with the plugins.
you will note few changes with plugins. this is because the major change that had to be done was making the embed part of a list which is handled in the base-plugin.
server-status had changes that needed to be made because it relied on the embedBuilder/Embed object, which has changed drastically, it now utilizes the json format which has had 0 changes from v12->v14.
Was quickly tested on Unnamed servers and all was working well.