Skip to content

Commit

Permalink
fix(core): fix shouldFetchUsage
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Mar 26, 2020
1 parent 88beade commit 6abdef1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/koishi-core/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ export class Command {

const { maxUsage, minInterval, authority } = command.config
let shouldFetchAuthority = !userFields.has('authority') && authority > 0
let shouldFetchUsage = !userFields.has('usage') && (
typeof maxUsage === 'number' && maxUsage < Infinity ||
typeof minInterval === 'number' && minInterval > 0)
let shouldFetchUsage = !(userFields.has('usage') || !maxUsage && !minInterval)
for (const option of command._options) {
if (option.camels[0] in options) {
if (option.authority > 0) shouldFetchAuthority = true
Expand Down

0 comments on commit 6abdef1

Please sign in to comment.