Skip to content

Commit 04bc519

Browse files
kyranetfavna
authored andcommittedNov 18, 2023
fix(Command): parentCategory failing with fullCategory.length === 1
1 parent 95ccc5d commit 04bc519

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/lib/structures/Command.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export class Command<PreParseReturn = Args, Options extends Command.Options = Co
154154
* @note You can set {@link Command.Options.fullCategory} to override the built-in category resolution.
155155
*/
156156
public get category(): string | null {
157-
return this.fullCategory.length > 0 ? this.fullCategory[0] : null;
157+
return this.fullCategory.at(0) ?? null;
158158
}
159159

160160
/**
@@ -166,7 +166,7 @@ export class Command<PreParseReturn = Args, Options extends Command.Options = Co
166166
* @note You can set {@link Command.Options.fullCategory} to override the built-in category resolution.
167167
*/
168168
public get subCategory(): string | null {
169-
return this.fullCategory.length > 1 ? this.fullCategory[1] : null;
169+
return this.fullCategory.at(1) ?? null;
170170
}
171171

172172
/**
@@ -178,7 +178,7 @@ export class Command<PreParseReturn = Args, Options extends Command.Options = Co
178178
* @note You can set {@link Command.Options.fullCategory} to override the built-in category resolution.
179179
*/
180180
public get parentCategory(): string | null {
181-
return this.fullCategory.length > 1 ? this.fullCategory[this.fullCategory.length - 1] : null;
181+
return this.fullCategory.at(-1) ?? null;
182182
}
183183

184184
/**

0 commit comments

Comments
 (0)
Please sign in to comment.