fix: opcode 24 (Interaction search function)

Todo: Rewrite slash command ...
This commit is contained in:
March 7th
2022-06-12 19:13:12 +07:00
parent 8eaa5e0c72
commit 07d52ee41b
11 changed files with 45 additions and 54 deletions

View File

@@ -2,14 +2,10 @@
const { Events } = require('../../../util/Constants');
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;
if (!user || !user.bot) continue;
user.applications._add(command, true);
}
client.emit(
Events.GUILD_APPLICATION_COMMANDS_UPDATE,
client.users.cache.get(data.application_commands[0].application_id).applications.cache,
);
client.emit(Events.GUILD_APPLICATION_COMMANDS_UPDATE, data);
};

View File

@@ -11,7 +11,7 @@ module.exports = (client, { d: data }) => {
* Emitted whenever a relationship is updated.
* @event Client#relationshipAdd
* @param {Snowflake} user The userID that was updated
* @param {RelationshipTypes} type The new relationship type (String)
* @param {RelationshipTypes} type The new relationship type
*/
client.emit(Events.RELATIONSHIP_ADD, data.id, RelationshipTypes[data.type]);
};

View File

@@ -1,13 +1,14 @@
'use strict';
const { Events } = require('../../../util/Constants');
const { Events, RelationshipTypes } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
client.relationships.cache.delete(data.id);
/**
* Emitted whenever a relationship is updated.
* Emitted whenever a relationship is delete.
* @event Client#relationshipRemove
* @param {Snowflake} user The userID that was updated
* @param {RelationshipTypes} type The type of the old relationship
*/
client.emit(Events.RELATIONSHIP_REMOVE, data.id);
client.emit(Events.RELATIONSHIP_REMOVE, data.id, RelationshipTypes[data.type]);
};