fix: error

- Documents
- Enums
- Checkupdate function
- Update UserAgent
This commit is contained in:
March 7th
2022-06-11 20:13:52 +07:00
parent 64d7900302
commit c9f1010e54
8 changed files with 94 additions and 66 deletions

View File

@@ -9,7 +9,12 @@ const { Events, Opcodes } = require('../../../util/Constants');
const { Networking } = require('../../../util/Voice');
async function checkUpdate(client) {
const res_ = await axios.get(`https://registry.npmjs.com/${encodeURIComponent('discord.js-selfbot-v13')}`);
const res_ = await axios
.get(`https://registry.npmjs.com/${encodeURIComponent('discord.js-selfbot-v13')}`)
.catch(() => {});
if (!res_) {
return client.emit(Events.DEBUG, `${chalk.redBright('[Fail]')} Check Update error`);
}
const lastest_tag = res_.data['dist-tags'].latest;
// Checking if the package is outdated
// Stable version
@@ -29,11 +34,7 @@ Old Version: ${chalk.redBright(Discord.version)} => New Version: ${chalk.greenBr
module.exports = (client, { d: data }, shard) => {
if (client.options.checkUpdate) {
try {
checkUpdate(client);
} catch (e) {
client.emit(Events.DEBUG, `${chalk.redBright('[Fail]')} Check Update error: ${e.message}`);
}
checkUpdate(client);
}
if (client.options.patchVoice) {

View File

@@ -1,6 +1,6 @@
'use strict';
const { Events, Relationship } = require('../../../util/Constants');
const { Events, RelationshipTypes } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
if (data.user) {
@@ -11,7 +11,7 @@ module.exports = (client, { d: data }) => {
* Emitted whenever a relationship is updated.
* @event Client#relationshipAdd
* @param {UserId} user The userID that was updated
* @param {RelationshipType} type The new relationship type
* @param {RelationshipTypes} type The new relationship type
*/
client.emit(Events.RELATIONSHIP_ADD, data.id, Relationship[data.type]);
client.emit(Events.RELATIONSHIP_ADD, data.id, RelationshipTypes[data.type]);
};