diff --git a/packages/koishi-core/src/context.ts b/packages/koishi-core/src/context.ts index 11c1229f68..599b5c6090 100644 --- a/packages/koishi-core/src/context.ts +++ b/packages/koishi-core/src/context.ts @@ -291,6 +291,7 @@ export interface EventMap { 'lifecycle' (meta: Meta<'meta_event'>): any 'lifecycle/enable' (meta: Meta<'meta_event'>): any 'lifecycle/disable' (meta: Meta<'meta_event'>): any + 'lifecycle/connect' (meta: Meta<'meta_event'>): any 'before-user' (fields: Set, argv: ParsedCommandLine): any 'before-group' (fields: Set, argv: ParsedCommandLine): any 'attach' (meta: Meta<'message'>): any diff --git a/packages/koishi-core/src/meta.ts b/packages/koishi-core/src/meta.ts index f3bbca3c44..09b02aa74e 100644 --- a/packages/koishi-core/src/meta.ts +++ b/packages/koishi-core/src/meta.ts @@ -17,7 +17,7 @@ export interface SubTypeMap { notice: 'set' | 'unset' | 'approve' | 'invite' | 'leave' | 'kick' | 'kick_me' | 'ban' | 'lift_ban' request: 'add' | 'invite' // eslint-disable-next-line camelcase - meta_event: 'enable' | 'disable' + meta_event: 'enable' | 'disable' | 'connect' send: never } diff --git a/packages/plugin-common/src/help.ts b/packages/plugin-common/src/help.ts index 81d1a0a650..6ac09ea7aa 100644 --- a/packages/plugin-common/src/help.ts +++ b/packages/plugin-common/src/help.ts @@ -94,18 +94,18 @@ async function showCommandHelp (command: Command, meta: Meta<'message'>, options const maxUsage = command.getConfig('maxUsage', meta) const minInterval = command.getConfig('minInterval', meta) if (meta.$user) { - const { authority, maxUsageText } = command.config const usage = getUsage(command.usageName, meta.$user) if (maxUsage !== Infinity) { - output.push(`已调用次数:${Math.min(usage.count, maxUsage)}/${maxUsageText || maxUsage}。`) + output.push(`已调用次数:${Math.min(usage.count || 0, maxUsage)}/${maxUsage}。`) } + if (minInterval > 0) { const nextUsage = usage.last ? (Math.max(0, minInterval + usage.last - Date.now()) / 1000).toFixed() : 0 output.push(`距离下次调用还需:${nextUsage}/${minInterval / 1000} 秒。`) } - if (authority > 1) { - output.push(`最低权限:${authority} 级。`) + if (command.config.authority > 1) { + output.push(`最低权限:${command.config.authority} 级。`) } }