File tree Expand file tree Collapse file tree 3 files changed +21
-19
lines changed
apps/test-bot/src/app/commands Expand file tree Collapse file tree 3 files changed +21
-19
lines changed Original file line number Diff line number Diff line change 1+ import { MessageContextMenuCommand } from 'commandkit' ;
2+ import { ApplicationCommandType , ContextMenuCommandBuilder } from 'discord.js' ;
3+
4+ export const command = new ContextMenuCommandBuilder ( )
5+ . setName ( 'translate' )
6+ . setType ( ApplicationCommandType . Message ) ;
7+
8+ export const messageContextMenu : MessageContextMenuCommand = async ( {
9+ interaction,
10+ } ) => {
11+ interaction . reply ( 'test' ) ;
12+ } ;
Original file line number Diff line number Diff line change @@ -832,8 +832,14 @@ export class AppCommandHandler {
832832
833833 // Apply the specified logic for name and description
834834 const commandName = commandFileData . command . name || command . name ;
835- const commandDescription =
836- commandFileData . command . description || `${ commandName } command` ;
835+ let commandDescription = commandFileData . command . description as
836+ | string
837+ | undefined ;
838+
839+ // since `description` is optional in `CommandData` type, set a fallback description if none is provided
840+ if ( ! commandDescription && commandFileData . chatInput ) {
841+ commandDescription = 'No command description set.' ;
842+ }
837843
838844 // Update the command data with resolved name and description
839845 const updatedCommandData = {
Original file line number Diff line number Diff line change @@ -70,22 +70,6 @@ export interface CommandMetadata {
7070 nameAliases ?: Record < 'user' | 'message' , string > ;
7171}
7272
73- /**
74- * @deprecated Use `CommandMetadata` instead.
75- */
76- export interface LegacyCommandMetadata {
77- /**
78- * The aliases of the command.
79- * @deprecated Use `metadata.aliases` or `generateMetadata` instead.
80- */
81- aliases ?: string [ ] ;
82- /**
83- * The guilds that the command is available in.
84- * @deprecated Use `metadata.guilds` or `generateMetadata` instead.
85- */
86- guilds ?: string [ ] ;
87- }
88-
8973/**
9074 * Represents a command that can be executed by CommandKit.
9175 */
@@ -95,7 +79,7 @@ export type CommandData = Prettify<
9579 * The description of the command.
9680 */
9781 description ?: string ;
98- } & LegacyCommandMetadata
82+ }
9983> ;
10084
10185/**
You can’t perform that action at this time.
0 commit comments