File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
packages/jellycommands/src Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' jellycommands ' : patch
3
+ ---
4
+
5
+ add a guard to catch no guild id when dev mode enabled
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ const client = new JellyCommands({
18
18
19
19
For additional options, see [ dev options] ( /api/client#dev ) .
20
20
21
+ :::tip NOTE
22
+ If ` dev ` mode is enabled, at least one guild id must be specified within [ ` dev.guilds ` ] ( /api/client#dev )
23
+ :::
24
+
21
25
## Global Dev Mode
22
26
23
27
Adding ` dev: true ` to every command * (and remembering to remove it)* can be tedious. [ global dev mode] ( /api/client#dev-global ) makes this easier.
Original file line number Diff line number Diff line change @@ -51,6 +51,17 @@ export class JellyCommands extends Client {
51
51
if ( this . joptions . commands ) {
52
52
const commands = await resolveCommands ( this , this . joptions . commands ) ;
53
53
const commandIdMap = await getCommandIdMap ( this , commands ) ;
54
+ if ( ! this . joptions . dev ?. guilds ?. length ) {
55
+ const hasDevCommand = Array . from ( commands . commands ) . some (
56
+ ( command ) => command . options . dev ,
57
+ ) ;
58
+
59
+ // If dev is enabled in some way, make sure they have at least one guild id
60
+ if ( this . joptions . dev ?. global || hasDevCommand )
61
+ throw new Error (
62
+ 'You must provide at least one guild id in the dev guilds array to use dev commands' ,
63
+ ) ;
64
+ }
54
65
55
66
// Whenever there is a interactionCreate event respond to it
56
67
this . on ( 'interactionCreate' , ( interaction ) => {
You can’t perform that action at this time.
0 commit comments