File tree Expand file tree Collapse file tree 4 files changed +40
-21
lines changed
packages/commandkit/src/app Expand file tree Collapse file tree 4 files changed +40
-21
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { tasks } from '@commandkit/tasks';
99export default defineConfig ( {
1010 plugins : [
1111 i18n ( ) ,
12- legacy ( { skipBuiltInValidations : true } ) ,
12+ // legacy({ skipBuiltInValidations: true }),
1313 devtools ( ) ,
1414 cache ( ) ,
1515 ai ( ) ,
Original file line number Diff line number Diff line change 1- import { MessageContextMenuCommand } from 'commandkit' ;
1+ import {
2+ ChatInputCommand ,
3+ MessageCommand ,
4+ MessageContextMenuCommand ,
5+ UserContextMenuCommand ,
6+ } from 'commandkit' ;
27import { ApplicationCommandType , ContextMenuCommandBuilder } from 'discord.js' ;
38
49export const command = new ContextMenuCommandBuilder ( )
510 . setName ( 'translate' )
6- . setType ( ApplicationCommandType . Message ) ;
11+ . setType ( ApplicationCommandType . User ) ;
12+
13+ // export const command: CommandData = {
14+ // name: 'translate',
15+ // };
16+
17+ export const userContextMenu : UserContextMenuCommand = async ( {
18+ interaction,
19+ } ) => {
20+ interaction . reply ( 'test' ) ;
21+ } ;
722
823export const messageContextMenu : MessageContextMenuCommand = async ( {
924 interaction,
1025} ) => {
1126 interaction . reply ( 'test' ) ;
1227} ;
28+
29+ export const chatInput : ChatInputCommand = async ( { interaction } ) => {
30+ interaction . reply ( 'test' ) ;
31+ } ;
32+
33+ export const message : MessageCommand = async ( { message } ) => {
34+ message . reply ( 'test' ) ;
35+ } ;
Original file line number Diff line number Diff line change 11import {
2+ ApplicationCommandType ,
23 AutocompleteInteraction ,
34 Awaitable ,
45 Collection ,
@@ -796,8 +797,8 @@ export class AppCommandHandler {
796797 data : {
797798 command : {
798799 name : command . name ,
799- description : ` ${ command . name } command` ,
800- type : 1 ,
800+ description : 'No command description set.' ,
801+ type : ApplicationCommandType . ChatInput ,
801802 } ,
802803 } ,
803804 } ) ;
@@ -836,7 +837,7 @@ export class AppCommandHandler {
836837 | string
837838 | undefined ;
838839
839- // since `description` is optional in `CommandData` type , set a fallback description if none is provided
840+ // since `CommandData. description` is optional, set a fallback description if none provided
840841 if ( ! commandDescription && commandFileData . chatInput ) {
841842 commandDescription = 'No command description set.' ;
842843 }
Original file line number Diff line number Diff line change @@ -50,41 +50,36 @@ export class CommandRegistrar {
5050
5151 const __metadata = cmd . metadata ?? cmd . data . metadata ;
5252
53- const collections : ( CommandData & { __metadata ?: CommandMetadata } ) [ ] = [
54- {
53+ const collections : ( CommandData & { __metadata ?: CommandMetadata } ) [ ] =
54+ [ ] ;
55+
56+ if ( cmd . data . chatInput ) {
57+ collections . push ( {
5558 ...json ,
59+ type : ApplicationCommandType . ChatInput ,
5660 __metadata,
57- } ,
58- ] ;
61+ } ) ;
62+ }
5963
6064 // Handle context menu commands
61- if (
62- cmd . data . userContextMenu &&
63- json . type !== ApplicationCommandType . User
64- ) {
65+ if ( cmd . data . userContextMenu ) {
6566 collections . push ( {
6667 ...json ,
6768 name : __metadata ?. nameAliases ?. user ?? json . name ,
6869 type : ApplicationCommandType . User ,
6970 options : undefined ,
7071 description_localizations : undefined ,
71- // @ts -ignore
7272 description : undefined ,
73- // @ts -ignore
7473 __metadata,
7574 } ) ;
7675 }
7776
78- if (
79- cmd . data . messageContextMenu &&
80- json . type !== ApplicationCommandType . Message
81- ) {
77+ if ( cmd . data . messageContextMenu ) {
8278 collections . push ( {
8379 ...json ,
8480 name : __metadata ?. nameAliases ?. message ?? json . name ,
8581 type : ApplicationCommandType . Message ,
8682 description_localizations : undefined ,
87- // @ts -ignore
8883 description : undefined ,
8984 options : undefined ,
9085 __metadata,
You can’t perform that action at this time.
0 commit comments