refactor(InteractionCreate): remove interaction event (#6326)

This commit is contained in:
Matt (IPv4) Cowley
2022-01-08 13:43:30 +00:00
committed by GitHub
parent 171e917fb9
commit ae876d9624
3 changed files with 1 additions and 17 deletions

View File

@@ -1,6 +1,5 @@
'use strict';
const process = require('node:process');
const Action = require('./Action');
const AutocompleteInteraction = require('../../structures/AutocompleteInteraction');
const ButtonInteraction = require('../../structures/ButtonInteraction');
@@ -10,8 +9,6 @@ const SelectMenuInteraction = require('../../structures/SelectMenuInteraction');
const UserContextMenuCommandInteraction = require('../../structures/UserContextMenuCommandInteraction');
const { Events, InteractionTypes, MessageComponentTypes, ApplicationCommandTypes } = require('../../util/Constants');
let deprecationEmitted = false;
class InteractionCreateAction extends Action {
handle(data) {
const client = this.client;
@@ -72,17 +69,6 @@ class InteractionCreateAction extends Action {
* @param {Interaction} interaction The interaction which was created
*/
client.emit(Events.INTERACTION_CREATE, interaction);
/**
* Emitted when an interaction is created.
* @event Client#interaction
* @param {Interaction} interaction The interaction which was created
* @deprecated Use {@link Client#event:interactionCreate} instead
*/
if (client.emit('interaction', interaction) && !deprecationEmitted) {
deprecationEmitted = true;
process.emitWarning('The interaction event is deprecated. Use interactionCreate instead', 'DeprecationWarning');
}
}
}

View File

@@ -3929,8 +3929,6 @@ export interface ClientEvents extends BaseClientEvents {
userUpdate: [oldUser: User | PartialUser, newUser: User];
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
webhookUpdate: [channel: TextChannel | NewsChannel];
/** @deprecated Use interactionCreate instead */
interaction: [interaction: Interaction];
interactionCreate: [interaction: Interaction];
shardDisconnect: [closeEvent: CloseEvent, shardId: number];
shardError: [error: Error, shardId: number];

View File

@@ -661,7 +661,7 @@ client.on('messageCreate', async message => {
});
});
client.on('interaction', async interaction => {
client.on('interactionCreate', async interaction => {
expectType<Snowflake | null>(interaction.guildId);
expectType<Snowflake | null>(interaction.channelId);
expectType<GuildMember | APIInteractionGuildMember | null>(interaction.member);