Skip to content

Commit

Permalink
refactor(InteractionCreate): remove interaction event (#6326)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Jan 8, 2022
1 parent 171e917 commit ae876d9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
14 changes: 0 additions & 14 deletions packages/discord.js/src/client/actions/InteractionCreate.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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;
Expand Down Expand Up @@ -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');
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/typings/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ae876d9

Please sign in to comment.