mirror of
https://github.com/ION606/custom_discordjs.git
synced 2026-05-14 22:26:54 +00:00
bug fixes
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"name": "iondiscordjs",
|
"name": "iondiscordjs",
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"description": "because discord.js is annoying",
|
"description": "because discord.js is annoying",
|
||||||
"main": "tests\\test.js",
|
"main": "tests/test.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ export class Client extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* @param {Number} hbint
|
* @param {Number} hbint
|
||||||
*/
|
*/
|
||||||
async #startHeartBeat(hbint)
|
async #startHeartBeat(hbint) {
|
||||||
{
|
|
||||||
this.heartBeatInterval = hbint;
|
this.heartBeatInterval = hbint;
|
||||||
console.log("INTERVAL SET TO: " + this.heartBeatInterval);
|
console.log("INTERVAL SET TO: " + this.heartBeatInterval);
|
||||||
this.#heartbeat(hbint);
|
this.#heartbeat(hbint);
|
||||||
@@ -87,8 +86,11 @@ export class Client extends EventEmitter {
|
|||||||
this.user_settings = response.config;
|
this.user_settings = response.config;
|
||||||
this.id = response.profile.id;
|
this.id = response.profile.id;
|
||||||
|
|
||||||
|
if (!this.isUser) {
|
||||||
const commandsRaw = (await this.axiosCustom.get(`applications/${this.id}/commands`)).data;
|
const commandsRaw = (await this.axiosCustom.get(`applications/${this.id}/commands`)).data;
|
||||||
this.commands = new InteractionManager(commandsRaw, this);
|
this.commands = new InteractionManager(commandsRaw, this);
|
||||||
|
}
|
||||||
|
|
||||||
this.emit('ready');
|
this.emit('ready');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,12 +168,13 @@ export class Client extends EventEmitter {
|
|||||||
return response;
|
return response;
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
console.log(err.response.data);
|
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) => {
|
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.#token = token;
|
||||||
|
this.isUser = isUser;
|
||||||
|
|
||||||
this.ws.on('open', () => {
|
this.ws.on('open', () => {
|
||||||
//Get the user intents
|
//Get the user intents
|
||||||
@@ -203,12 +206,12 @@ export class Client extends EventEmitter {
|
|||||||
if (response.op == 10) { return this.#startHeartBeat(response.heartBeat, token); }
|
if (response.op == 10) { return this.#startHeartBeat(response.heartBeat, token); }
|
||||||
|
|
||||||
else if (response.op == 0) {
|
else if (response.op == 0) {
|
||||||
switch(response.t) {
|
switch (response.t) {
|
||||||
case gateWayEvents.Ready: this.ready(response);
|
case gateWayEvents.Ready: this.ready(response);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case gateWayEvents.MessageCreate:
|
case gateWayEvents.MessageCreate:
|
||||||
if (data["d"]["author"]["id"] != this.user_profile.id){
|
if (data["d"]["author"]["id"] != this.user_profile.id) {
|
||||||
response.message.guild = this.guilds.get(response.message.guild_id);
|
response.message.guild = this.guilds.get(response.message.guild_id);
|
||||||
this.messageRecieved(response.message);
|
this.messageRecieved(response.message);
|
||||||
}
|
}
|
||||||
@@ -259,4 +262,4 @@ export class Client extends EventEmitter {
|
|||||||
|
|
||||||
|
|
||||||
//All client properties will be re-routed through this export
|
//All client properties will be re-routed through this export
|
||||||
export {gateWayIntents} from '../gateway/intents.js';
|
export { gateWayIntents } from '../gateway/intents.js';
|
||||||
Reference in New Issue
Block a user