Changed class format to BaseClass

This commit is contained in:
ION606
2023-04-07 20:12:16 -04:00
parent e6b32cc115
commit b6d35c8e55
11 changed files with 97 additions and 227 deletions
+2 -2
View File
@@ -148,7 +148,7 @@ export class Client extends EventEmitter {
if (!isUser) token = "Bot " + token;
this.axiosCustom = axios.create({
baseURL: "https://discord.com/api/",
headers: { Authorization: this.#token }
headers: { Authorization: token }
});
return new Promise((resolve, reject) => {
@@ -180,7 +180,7 @@ export class Client extends EventEmitter {
this.ws.on('message', async (msg) => {
const data = JSON.parse(msg.toString());
const response = await handleResponses(data, token, this.id);
const response = await handleResponses(data, token, this);
if (response.op == 10) { return this.#startHeartBeat(response.heartBeat, token); }
+4 -4
View File
@@ -9,7 +9,7 @@ import Guild from '../guilds/Guild.js';
* @param {Object} msg
* @returns {Promise<Boolean>}
*/
export default async function handleEvents(msgObj, token, id) {
export default async function handleEvents(msgObj, token, client) {
return new Promise((resolve, reject) => {
const op = msgObj["op"];
const t = msgObj["t"];
@@ -23,16 +23,16 @@ export default async function handleEvents(msgObj, token, id) {
break;
case gateWayEvents.MessageCreate:
const msg = new message(msgObj["d"], token);
const msg = new message(msgObj["d"], client);
resolve({op: op, t: t, message: msg});
break;
case gateWayEvents.InteractionCreate:
resolve({op: op, t: t, interaction: new Interaction(msgObj["d"], token, id)});
resolve({op: op, t: t, interaction: new Interaction(msgObj["d"], client)});
break;
case gateWayEvents.GuildCreate:
resolve({op: op, t: t, guild: new Guild(msgObj["d"], token)});
resolve({op: op, t: t, guild: new Guild(msgObj["d"], client)});
break;
case gateWayEvents.ThreadCreate: