From ae876d962453ccf843f8e6f70666a98a3173bb75 Mon Sep 17 00:00:00 2001 From: "Matt (IPv4) Cowley" Date: Sat, 8 Jan 2022 13:43:30 +0000 Subject: [PATCH] refactor(InteractionCreate): remove interaction event (#6326) --- .../src/client/actions/InteractionCreate.js | 14 -------------- packages/discord.js/typings/index.d.ts | 2 -- packages/discord.js/typings/index.test-d.ts | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/packages/discord.js/src/client/actions/InteractionCreate.js b/packages/discord.js/src/client/actions/InteractionCreate.js index 762032383abb..e412f1a9a847 100644 --- a/packages/discord.js/src/client/actions/InteractionCreate.js +++ b/packages/discord.js/src/client/actions/InteractionCreate.js @@ -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'); - } } } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index ed5cad623cd1..3dbcad2e8ad5 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -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]; diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 3e6b6415f960..1347ecda699a 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -661,7 +661,7 @@ client.on('messageCreate', async message => { }); }); -client.on('interaction', async interaction => { +client.on('interactionCreate', async interaction => { expectType(interaction.guildId); expectType(interaction.channelId); expectType(interaction.member);