mirror of
https://github.com/ION606/custom_discordjs.git
synced 2026-05-14 22:26:54 +00:00
Changed class format to BaseClass
This commit is contained in:
@@ -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); }
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user