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 {
832
832
833
833
// Apply the specified logic for name and description
834
834
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
+ }
837
843
838
844
// Update the command data with resolved name and description
839
845
const updatedCommandData = {
Original file line number Diff line number Diff line change @@ -70,22 +70,6 @@ export interface CommandMetadata {
70
70
nameAliases ?: Record < 'user' | 'message' , string > ;
71
71
}
72
72
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
-
89
73
/**
90
74
* Represents a command that can be executed by CommandKit.
91
75
*/
@@ -95,7 +79,7 @@ export type CommandData = Prettify<
95
79
* The description of the command.
96
80
*/
97
81
description ?: string ;
98
- } & LegacyCommandMetadata
82
+ }
99
83
> ;
100
84
101
85
/**
You can’t perform that action at this time.
0 commit comments