fix: replace deprecated ephemeral option with MessageFlags.Ephemeral#203
fix: replace deprecated ephemeral option with MessageFlags.Ephemeral#203NICK-FURY-6023 merged 1 commit intomainfrom
Conversation
- Fixed deprecation warning for ephemeral interaction responses - Replaced ephemeral: true with flags: MessageFlags.Ephemeral - Replaced CommandInteraction with ChatInputCommandInteraction for proper typing - Removed unnecessary ephemeral: false (default value)
There was a problem hiding this comment.
Pull request overview
This pull request modernizes the Discord.js implementation by replacing deprecated ephemeral options with the newer MessageFlags.Ephemeral flag, aligning with Discord.js v14+ best practices. The PR also improves type safety by replacing generic CommandInteraction types with more specific ChatInputCommandInteraction types.
Key Changes:
- Replaced deprecated
ephemeral: truewithflags: MessageFlags.Ephemeralacross 6 files - Updated type annotations from
CommandInteractiontoChatInputCommandInteractionin 4 autocomplete functions - Removed unnecessary default
ephemeral: falseoption
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/structures/PageQueue.ts | Updated buttonPage method to use MessageFlags.Ephemeral |
| src/structures/CommandHandler.ts | Removed redundant ephemeral: false default parameter |
| src/services/ReplyInteractionService.ts | Removed redundant ephemeral: false and added defensive semicolon |
| src/events/track/trackStart.ts | Updated two message.reply calls to use MessageFlags.Ephemeral |
| src/events/guild/messageCreate.ts | Reformatted regex declaration for better readability |
| src/commands/Playlist/Editor.ts | Updated type from CommandInteraction to ChatInputCommandInteraction |
| src/commands/Playlist/Add.ts | Updated autocomplete function to use ChatInputCommandInteraction |
| src/commands/Music/Radio.ts | Updated message.reply to use MessageFlags.Ephemeral |
| src/commands/Music/Play.ts | Updated autocomplete function to use ChatInputCommandInteraction |
| src/commands/Music/Insert.ts | Updated autocomplete function to use ChatInputCommandInteraction |
| src/buttons/Shuffle.ts | Updated message.reply to use MessageFlags.Ephemeral |
| src/buttons/Queue.ts | Updated message.reply to use MessageFlags.Ephemeral |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
|
|
||
| const value = (interaction.options as CommandInteractionOptionResolver).getString('id') | ||
| const value = (interaction as ChatInputCommandInteraction).options.getString('id') |
There was a problem hiding this comment.
The type cast on this line is redundant since the interaction parameter is already typed as ChatInputCommandInteraction in the function signature. You can simplify this to: const value = interaction.options.getString('id')
| const value = (interaction as ChatInputCommandInteraction).options.getString('id') | |
| const value = interaction.options.getString('id') |
|
|
||
| setTimeout(() => { | ||
| (!setup || setup == null || setup.channel !== this.message.channelId) && msg | ||
| ;(!setup || setup == null || setup.channel !== this.message.channelId) && msg |
There was a problem hiding this comment.
Variable 'setup' cannot be of type null, but it is compared to an expression of type null.
| ;(!setup || setup == null || setup.channel !== this.message.channelId) && msg | |
| ;(!setup || setup.channel !== this.message.channelId) && msg |
Changes
ephemeral: truewithflags: MessageFlags.EphemeralCommandInteractionwithChatInputCommandInteractionfor proper typingephemeral: false(default value)Files Changed
Testing