1.3.4
Get interaction commands using gateway
This commit is contained in:
@@ -60,7 +60,7 @@ class InteractionCreateAction extends Action {
|
||||
InteractionType = AutocompleteInteraction;
|
||||
break;
|
||||
default:
|
||||
client.emit(Events.DEBUG, `[INTERACTION] Received interaction with unknown type: ${data.type}`);
|
||||
client.emit(Events.DEBUG, `[INTERACTION] Received [BOT] / Send (Selfbot) interactionID ${data.id} with unknown type: ${data.type}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
if (!data.application_commands[0]) return;
|
||||
for (const command of data.application_commands) {
|
||||
const user = client.users.cache.get(command.application_id);
|
||||
if (!user) continue;
|
||||
user.applications._add(command, true);
|
||||
};
|
||||
};
|
@@ -9,6 +9,7 @@ module.exports = (client, { d: data }) => {
|
||||
const guild = client.guilds.cache.get(data.guild_id);
|
||||
if (!guild) return;
|
||||
const members = new Collection();
|
||||
// Get Member from side Discord Channel (online counting if large server)
|
||||
for (const object of data.ops) {
|
||||
if (object.op == 'SYNC') {
|
||||
for (const member_ of object.items) {
|
||||
|
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
const { Events } = require('../../../util/Constants');
|
||||
|
||||
module.exports = (client, packet) => {
|
||||
client.actions.InteractionCreate.handle(packet.d);
|
||||
if (client.user.bot) client.actions.InteractionCreate.handle(packet.d);
|
||||
else client.emit(Events.INTERACTION_CREATE, packet.d);
|
||||
};
|
||||
|
6
src/client/websocket/handlers/INTERACTION_FAILED.js
Normal file
6
src/client/websocket/handlers/INTERACTION_FAILED.js
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
const { Events } = require('../../../util/Constants');
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
client.emit(Events.INTERACTION_FAILED, data);
|
||||
};
|
6
src/client/websocket/handlers/INTERACTION_SUCCESS.js
Normal file
6
src/client/websocket/handlers/INTERACTION_SUCCESS.js
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
const { Events } = require('../../../util/Constants');
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
client.emit(Events.INTERACTION_SUCCESS, data);
|
||||
};
|
@@ -18,6 +18,10 @@ const handlers = Object.fromEntries([
|
||||
['GUILD_MEMBER_UPDATE', require('./GUILD_MEMBER_UPDATE')],
|
||||
['GUILD_MEMBERS_CHUNK', require('./GUILD_MEMBERS_CHUNK')],
|
||||
['GUILD_MEMBER_LIST_UPDATE', require('./GUILD_MEMBER_LIST_UPDATE.js')],
|
||||
[
|
||||
'GUILD_APPLICATION_COMMANDS_UPDATE',
|
||||
require('./GUILD_APPLICATION_COMMANDS_UPDATE.js'),
|
||||
],
|
||||
['GUILD_INTEGRATIONS_UPDATE', require('./GUILD_INTEGRATIONS_UPDATE')],
|
||||
['GUILD_ROLE_CREATE', require('./GUILD_ROLE_CREATE')],
|
||||
['GUILD_ROLE_DELETE', require('./GUILD_ROLE_DELETE')],
|
||||
@@ -50,6 +54,8 @@ const handlers = Object.fromEntries([
|
||||
['VOICE_SERVER_UPDATE', require('./VOICE_SERVER_UPDATE')],
|
||||
['WEBHOOKS_UPDATE', require('./WEBHOOKS_UPDATE')],
|
||||
['INTERACTION_CREATE', require('./INTERACTION_CREATE')],
|
||||
['INTERACTION_SUCCESS', require('./INTERACTION_SUCCESS')],
|
||||
['INTERACTION_FAILED', require('./INTERACTION_FAILED')],
|
||||
['STAGE_INSTANCE_CREATE', require('./STAGE_INSTANCE_CREATE')],
|
||||
['STAGE_INSTANCE_UPDATE', require('./STAGE_INSTANCE_UPDATE')],
|
||||
['STAGE_INSTANCE_DELETE', require('./STAGE_INSTANCE_DELETE')],
|
||||
|
Reference in New Issue
Block a user