March 7th 1a6b3addfe refactor(Interaction): See description
- Change the data returned when interacting, from `nonce: Snowflake` to `data: InteractionResponseBody` (use try catch to detect command errors)
- Full support for Autocomplete (Automatically selects the first option)
2022-07-12 19:30:18 +07:00

17 lines
454 B
JavaScript

'use strict';
const { Events } = require('../../../util/Constants');
/**
* @typedef {Object} InteractionResponseBody
* @property {Snowflake} id maybe id of this event (???) (documentation needed)
* @property {Snowflake} nonce nonce in POST /interactions
*/
module.exports = (client, packet) => {
if (client.user.bot) {
client.actions.InteractionCreate.handle(packet.d);
} else {
client.emit(Events.INTERACTION_CREATE, packet.d);
}
};