Skip to content

Commit

Permalink
fix: option can be camel case (#27)
Browse files Browse the repository at this point in the history
Koishi would automatically convert them to kebab case in command help
  • Loading branch information
MaikoTan authored Feb 17, 2024
1 parent 7bbbf40 commit d109f37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export async function apply(ctx: Context, config: Config = {}): Promise<void> {
.command('hitokoto')
.alias('一言')
.option('type', `-t <type:string>`)
.option('min-length', `-l <length:int>`)
.option('max-length', `-L <length:int>`)
.option('minLength', `-l <length:int>`)
.option('maxLength', `-L <length:int>`)
.before(async ({ options, session }) => {
if (options?.['min-length'] && options?.['max-length']) {
if (options['min-length'] > options['max-length']) {
if (options?.minLength && options?.maxLength) {
if (options.minLength > options.maxLength) {
return session?.text('.min_length_gt_max_length')
}
}
Expand All @@ -36,8 +36,8 @@ export async function apply(ctx: Context, config: Config = {}): Promise<void> {
.action(async ({ options, session }) => {
const params = {
c: options?.type?.split(',') ?? config.defaultTypes,
min_length: options?.['min-length'] ?? config.minLength,
max_length: options?.['max-length'] ?? config.maxLength,
min_length: options?.minLength ?? config.minLength,
max_length: options?.maxLength ?? config.maxLength,
}

try {
Expand Down

0 comments on commit d109f37

Please sign in to comment.