mirror of
https://github.com/ION606/custom_discordjs.git
synced 2026-06-06 00:07:01 +00:00
Added Interaction integration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const { exit } = require('process');
|
||||
const gateWayEvents = require('../gateway/dispatch.js');
|
||||
const { message } = require('../messages/message.js');
|
||||
const Interaction = require('../interactions/interaction.js');
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ const { message } = require('../messages/message.js');
|
||||
* @param {Object} msg
|
||||
* @returns {Promise<Boolean>}
|
||||
*/
|
||||
module.exports = async function handleEvents(msgObj, token) {
|
||||
module.exports = async function handleEvents(msgObj, token, id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const op = msgObj["op"];
|
||||
const t = msgObj["t"];
|
||||
@@ -17,10 +18,14 @@ module.exports = async function handleEvents(msgObj, token) {
|
||||
|
||||
if (op == 0 && t == gateWayEvents.Ready) {
|
||||
resolve({op: op, t: t, config: msgObj["d"]["user_settings"], profile: msgObj["d"]["user"] });
|
||||
} else if (t == gateWayEvents.MessageCreate) {
|
||||
}
|
||||
else if (t == gateWayEvents.MessageCreate) {
|
||||
const msg = new message(msgObj["d"], token);
|
||||
resolve({op: op, t: t, message: msg});
|
||||
}
|
||||
else if (t == gateWayEvents.InteractionCreate) {
|
||||
resolve({op: op, t: t, interaction: new Interaction(msgObj["d"], token, id)});
|
||||
}
|
||||
|
||||
else {
|
||||
// console.log(t);
|
||||
|
||||
Reference in New Issue
Block a user