bug fixes

This commit is contained in:
2024-05-16 09:52:25 -07:00
parent e2d34a63ad
commit eff76b3960
2 changed files with 29 additions and 26 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "iondiscordjs",
"version": "1.0.2",
"description": "because discord.js is annoying",
"main": "tests\\test.js",
"main": "tests/test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
+7 -4
View File
@@ -69,8 +69,7 @@ export class Client extends EventEmitter {
/**
* @param {Number} hbint
*/
async #startHeartBeat(hbint)
{
async #startHeartBeat(hbint) {
this.heartBeatInterval = hbint;
console.log("INTERVAL SET TO: " + this.heartBeatInterval);
this.#heartbeat(hbint);
@@ -87,8 +86,11 @@ export class Client extends EventEmitter {
this.user_settings = response.config;
this.id = response.profile.id;
if (!this.isUser) {
const commandsRaw = (await this.axiosCustom.get(`applications/${this.id}/commands`)).data;
this.commands = new InteractionManager(commandsRaw, this);
}
this.emit('ready');
}
@@ -166,12 +168,13 @@ export class Client extends EventEmitter {
return response;
}, function (err) {
console.log(err.response.data);
throw `REQUEST FAILED WITH STATUS CODE ${err.response.status} AND REASON "${JSON.stringify(err.response.data)}"`;
// throw `REQUEST FAILED WITH STATUS CODE ${err.response.status} AND REASON "${JSON.stringify(err.response.data)}"`;
});
return new Promise((resolve, reject) => {
this.ws = new WebSocket("wss://gateway.discord.gg/?v=10&encoding=json");
this.ws = new WebSocket("wss://gateway.discord.gg/?v=9&encoding=json");
this.#token = token;
this.isUser = isUser;
this.ws.on('open', () => {
//Get the user intents