koishi-plugin-common
Advanced tools
Comparing version 2.0.0 to 2.0.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const koishi_core_1 = require("koishi-core"); | ||
function apply(ctx) { | ||
@@ -95,3 +96,3 @@ ctx.command('help [command]', '显示帮助信息', { authority: 0 }) | ||
const { authority, maxUsageText } = command.config; | ||
const usage = command.updateUsage(meta.$user); | ||
const usage = koishi_core_1.getUsage(command.usageName, meta.$user); | ||
if (maxUsage !== Infinity) { | ||
@@ -98,0 +99,0 @@ output.push(`已调用次数:${Math.min(usage.count, maxUsage)}/${maxUsageText || maxUsage}。`); |
{ | ||
"name": "koishi-plugin-common", | ||
"description": "Common plugins for Koishi", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "dist/index.js", | ||
@@ -31,9 +31,9 @@ "typings": "dist/index.d.ts", | ||
"devDependencies": { | ||
"koishi-database-memory": "^1.0.0", | ||
"koishi-test-utils": "^2.0.0" | ||
"koishi-database-memory": "^1.0.1", | ||
"koishi-test-utils": "^2.1.0" | ||
}, | ||
"dependencies": { | ||
"koishi-core": "^1.5.0", | ||
"koishi-core": "^1.6.0", | ||
"koishi-utils": "^1.0.2" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Context, Command, UserData, MessageMeta } from 'koishi-core' | ||
import { Context, Command, UserData, Meta, getUsage } from 'koishi-core' | ||
@@ -30,3 +30,3 @@ export default function apply (ctx: Context) { | ||
function getCommands (context: Context, meta: MessageMeta, parent?: Command) { | ||
function getCommands (context: Context, meta: Meta<'message'>, parent?: Command) { | ||
const commands = parent | ||
@@ -40,3 +40,3 @@ ? parent.children | ||
function showGlobalShortcut (context: Context, meta: MessageMeta) { | ||
function showGlobalShortcut (context: Context, meta: Meta<'message'>) { | ||
const commands = getCommands(context, meta) | ||
@@ -47,3 +47,3 @@ const shortcuts = [].concat(...commands.map(command => getShortcuts(command, meta.$user))) | ||
function getCommandList (context: Context, meta: MessageMeta, parent: Command, expand: boolean) { | ||
function getCommandList (context: Context, meta: Meta<'message'>, parent: Command, expand: boolean) { | ||
let commands = getCommands(context, meta, parent) | ||
@@ -75,3 +75,3 @@ if (!expand) { | ||
function showGlobalHelp (context: Context, meta: MessageMeta, options: any) { | ||
function showGlobalHelp (context: Context, meta: Meta<'message'>, options: any) { | ||
return meta.$send([ | ||
@@ -84,3 +84,3 @@ GLOBAL_HELP_PROLOGUE, | ||
async function showCommandHelp (command: Command, meta: MessageMeta, options: any) { | ||
async function showCommandHelp (command: Command, meta: Meta<'message'>, options: any) { | ||
const output = [command.name + command.declaration, command.config.description] | ||
@@ -103,3 +103,3 @@ if (command.context.database) { | ||
const { authority, maxUsageText } = command.config | ||
const usage = command.updateUsage(meta.$user) | ||
const usage = getUsage(command.usageName, meta.$user) | ||
if (maxUsage !== Infinity) { | ||
@@ -106,0 +106,0 @@ output.push(`已调用次数:${Math.min(usage.count, maxUsage)}/${maxUsageText || maxUsage}。`) |
import { MockedApp } from 'koishi-test-utils' | ||
import { apply, repeater, RepeaterOptions } from '../src' | ||
import { repeater, RepeaterOptions } from '../src' | ||
import 'koishi-database-memory' | ||
@@ -4,0 +4,0 @@ |
Sorry, the diff of this file is not supported yet
248209
2361
Updatedkoishi-core@^1.6.0