mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
refactor(InteractionCreate): remove interaction event (#6326)
This commit is contained in:
committed by
GitHub
parent
171e917fb9
commit
ae876d9624
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
packages/discord.js/typings/index.d.ts
vendored
2
packages/discord.js/typings/index.d.ts
vendored
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user