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';
9
9
export default defineConfig ( {
10
10
plugins : [
11
11
i18n ( ) ,
12
- legacy ( { skipBuiltInValidations : true } ) ,
12
+ // legacy({ skipBuiltInValidations: true }),
13
13
devtools ( ) ,
14
14
cache ( ) ,
15
15
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' ;
2
7
import { ApplicationCommandType , ContextMenuCommandBuilder } from 'discord.js' ;
3
8
4
9
export const command = new ContextMenuCommandBuilder ( )
5
10
. 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
+ } ;
7
22
8
23
export const messageContextMenu : MessageContextMenuCommand = async ( {
9
24
interaction,
10
25
} ) => {
11
26
interaction . reply ( 'test' ) ;
12
27
} ;
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 1
1
import {
2
+ ApplicationCommandType ,
2
3
AutocompleteInteraction ,
3
4
Awaitable ,
4
5
Collection ,
@@ -796,8 +797,8 @@ export class AppCommandHandler {
796
797
data : {
797
798
command : {
798
799
name : command . name ,
799
- description : ` ${ command . name } command` ,
800
- type : 1 ,
800
+ description : 'No command description set.' ,
801
+ type : ApplicationCommandType . ChatInput ,
801
802
} ,
802
803
} ,
803
804
} ) ;
@@ -836,7 +837,7 @@ export class AppCommandHandler {
836
837
| string
837
838
| undefined ;
838
839
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
840
841
if ( ! commandDescription && commandFileData . chatInput ) {
841
842
commandDescription = 'No command description set.' ;
842
843
}
Original file line number Diff line number Diff line change @@ -50,41 +50,36 @@ export class CommandRegistrar {
50
50
51
51
const __metadata = cmd . metadata ?? cmd . data . metadata ;
52
52
53
- const collections : ( CommandData & { __metadata ?: CommandMetadata } ) [ ] = [
54
- {
53
+ const collections : ( CommandData & { __metadata ?: CommandMetadata } ) [ ] =
54
+ [ ] ;
55
+
56
+ if ( cmd . data . chatInput ) {
57
+ collections . push ( {
55
58
...json ,
59
+ type : ApplicationCommandType . ChatInput ,
56
60
__metadata,
57
- } ,
58
- ] ;
61
+ } ) ;
62
+ }
59
63
60
64
// Handle context menu commands
61
- if (
62
- cmd . data . userContextMenu &&
63
- json . type !== ApplicationCommandType . User
64
- ) {
65
+ if ( cmd . data . userContextMenu ) {
65
66
collections . push ( {
66
67
...json ,
67
68
name : __metadata ?. nameAliases ?. user ?? json . name ,
68
69
type : ApplicationCommandType . User ,
69
70
options : undefined ,
70
71
description_localizations : undefined ,
71
- // @ts -ignore
72
72
description : undefined ,
73
- // @ts -ignore
74
73
__metadata,
75
74
} ) ;
76
75
}
77
76
78
- if (
79
- cmd . data . messageContextMenu &&
80
- json . type !== ApplicationCommandType . Message
81
- ) {
77
+ if ( cmd . data . messageContextMenu ) {
82
78
collections . push ( {
83
79
...json ,
84
80
name : __metadata ?. nameAliases ?. message ?? json . name ,
85
81
type : ApplicationCommandType . Message ,
86
82
description_localizations : undefined ,
87
- // @ts -ignore
88
83
description : undefined ,
89
84
options : undefined ,
90
85
__metadata,
You can’t perform that action at this time.
0 commit comments