diff --git a/build/publish.ts b/build/publish.ts index aae7969361..9b22dc8cfb 100644 --- a/build/publish.ts +++ b/build/publish.ts @@ -1,8 +1,8 @@ import { PackageJson, getWorkspaces, spawnAsync, spawnSync } from './utils' import { gt, prerelease } from 'semver' -import ora from 'ora' +import { Octokit } from '@octokit/rest' import latest from 'latest-version' -import Octokit from '@octokit/rest' +import ora from 'ora' const { CI, GITHUB_EVENT_NAME, GITHUB_REF, GITHUB_TOKEN } = process.env diff --git a/package.json b/package.json index c338818aee..b7e2e5eba2 100644 --- a/package.json +++ b/package.json @@ -23,21 +23,21 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@octokit/rest": "^16.40.1", + "@octokit/rest": "^16.43.1", "@types/cross-spawn": "^6.0.1", "@types/fs-extra": "^8.0.1", - "@types/jest": "^25.1.1", - "@types/node": "^13.5.2", + "@types/jest": "^25.1.2", + "@types/node": "^13.7.0", "@types/semver": "^7.1.0", - "@typescript-eslint/eslint-plugin": "^2.18.0", - "@typescript-eslint/parser": "^2.18.0", + "@typescript-eslint/eslint-plugin": "^2.19.0", + "@typescript-eslint/parser": "^2.19.0", "cac": "^6.5.6", "cross-spawn": "^7.0.1", "del": "^5.1.0", "eslint": "^6.8.0", "eslint-config-standard": "^14.1.0", - "eslint-plugin-import": "^2.20.0", - "eslint-plugin-jest": "^23.6.0", + "eslint-plugin-import": "^2.20.1", + "eslint-plugin-jest": "^23.7.0", "eslint-plugin-node": "^11.0.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.1", @@ -47,12 +47,12 @@ "jest": "^25.1.0", "kleur": "^3.0.3", "latest-version": "^5.1.0", - "open": "^7.0.1", + "open": "^7.0.2", "ora": "^4.0.3", "p-map": "^3.0.0", "prompts": "^2.3.0", - "semver": "^7.1.1", - "ts-jest": "^25.1.0", + "semver": "^7.1.2", + "ts-jest": "^25.2.0", "ts-node": "^8.6.2", "typescript": "^3.7.5" } diff --git a/packages/database-level/package.json b/packages/database-level/package.json index 3f58bfbf3e..e9fed21094 100644 --- a/packages/database-level/package.json +++ b/packages/database-level/package.json @@ -1,7 +1,7 @@ { "name": "koishi-database-level", "description": "Leveldb support for Koishi", - "version": "1.1.0", + "version": "1.1.1", "main": "dist/index.js", "files": [ "dist" @@ -33,15 +33,15 @@ "leveldb" ], "devDependencies": { - "koishi-test-utils": "^3.0.1" + "koishi-test-utils": "^3.1.0" }, "peerDependencies": { - "koishi-core": "^1.8.0" + "koishi-core": "^1.8.1" }, "dependencies": { "@types/leveldown": "^4.0.2", "@types/levelup": "^4.3.0", - "koishi-utils": "^1.0.2", + "koishi-utils": "^1.0.3", "leveldown": "^5.4.1", "levelup": "^4.3.2", "subleveldown": "^4.1.4" diff --git a/packages/database-memory/package.json b/packages/database-memory/package.json index eb7c3cf4ff..33177ee9bb 100644 --- a/packages/database-memory/package.json +++ b/packages/database-memory/package.json @@ -1,7 +1,7 @@ { "name": "koishi-database-memory", "description": "An in-memory database implementation for Koishi", - "version": "1.1.0", + "version": "1.1.1", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -22,9 +22,9 @@ }, "homepage": "https://github.com/koishijs/koishi/tree/master/packages/database-memory#readme", "peerDependencies": { - "koishi-core": "^1.8.0" + "koishi-core": "^1.8.1" }, "dependencies": { - "koishi-utils": "^1.0.2" + "koishi-utils": "^1.0.3" } } diff --git a/packages/database-mysql/package.json b/packages/database-mysql/package.json index 9d3119f968..742800a245 100644 --- a/packages/database-mysql/package.json +++ b/packages/database-mysql/package.json @@ -1,7 +1,7 @@ { "name": "koishi-database-mysql", "description": "MySQL support for Koishi", - "version": "1.1.0", + "version": "1.1.1", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -35,10 +35,10 @@ "@types/mysql": "^2.15.8" }, "peerDependencies": { - "koishi-core": "^1.8.0" + "koishi-core": "^1.8.1" }, "dependencies": { - "koishi-utils": "^1.0.2", + "koishi-utils": "^1.0.3", "mysql": "^2.18.1" } } diff --git a/packages/database-sqlite/package.json b/packages/database-sqlite/package.json index 4a20d1d5a5..b5de209301 100644 --- a/packages/database-sqlite/package.json +++ b/packages/database-sqlite/package.json @@ -1,6 +1,6 @@ { "name": "koishi-database-sqlite", - "version": "1.0.0-alpha.6", + "version": "1.0.0-alpha.7", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -22,13 +22,13 @@ "homepage": "https://github.com/koishijs/koishi/tree/master/packages/database-sqlite#readme", "devDependencies": { "@types/sqlite3": "^3.1.6", - "koishi-test-utils": "^3.0.1" + "koishi-test-utils": "^3.1.0" }, "peerDependencies": { - "koishi-core": "^1.8.0" + "koishi-core": "^1.8.1" }, "dependencies": { - "koishi-utils": "^1.0.2", + "koishi-utils": "^1.0.3", "sqlite3": "^4.1.1" } } diff --git a/packages/koishi-cli/package.json b/packages/koishi-cli/package.json index e12ba09461..3ae53cde63 100644 --- a/packages/koishi-cli/package.json +++ b/packages/koishi-cli/package.json @@ -1,7 +1,7 @@ { "name": "koishi", "description": "A QQ bot framework based on CQHTTP", - "version": "1.8.0", + "version": "1.8.1", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -38,10 +38,10 @@ "cac": "^6.5.6", "js-yaml": "^3.13.1", "kleur": "^3.0.3", - "koishi-core": "^1.8.0", - "koishi-plugin-common": "^2.1.1", - "koishi-plugin-schedule": "^1.0.6", - "koishi-utils": "^1.0.2", + "koishi-core": "^1.8.1", + "koishi-plugin-common": "^2.1.2", + "koishi-plugin-schedule": "^1.0.7", + "koishi-utils": "^1.0.3", "prompts": "^2.3.0" } } diff --git a/packages/koishi-core/package.json b/packages/koishi-core/package.json index 37326bc324..022c5a6537 100644 --- a/packages/koishi-core/package.json +++ b/packages/koishi-core/package.json @@ -1,7 +1,7 @@ { "name": "koishi-core", "description": "Core features for Koishi", - "version": "1.8.0", + "version": "1.8.1", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -35,14 +35,14 @@ "@types/debug": "^4.1.5", "@types/ws": "^7.2.1", "get-port": "^5.1.1", - "koishi-database-memory": "^1.1.0", - "koishi-test-utils": "^3.0.1" + "koishi-database-memory": "^1.1.1", + "koishi-test-utils": "^3.1.0" }, "dependencies": { "axios": "^0.19.2", "debug": "^4.1.1", "escape-string-regexp": "^2.0.0", - "koishi-utils": "^1.0.2", + "koishi-utils": "^1.0.3", "leven": "^3.1.0", "ws": "^7.2.1" } diff --git a/packages/koishi-core/src/command.ts b/packages/koishi-core/src/command.ts index 2337afb470..3db2f98e87 100644 --- a/packages/koishi-core/src/command.ts +++ b/packages/koishi-core/src/command.ts @@ -41,7 +41,7 @@ export interface CommandConfig { maxUsage?: UserType maxUsageText?: string minInterval?: UserType - showWarning?: boolean + showWarning?: boolean | number noHelpOption?: boolean } @@ -64,6 +64,16 @@ export interface ShortcutConfig { options?: Record } +export enum CommandHint { + USAGE_EXHAUSTED = 1, + TOO_FREQUENT = 2, + LOW_AUTHORITY = 4, + INSUFFICIENT_ARGUMENTS = 8, + REDUNANT_ARGUMENTS = 16, + UNKNOWN_OPTIONS = 32, + REQUIRED_OPTIONS = 64, +} + export class Command { config: CommandConfig children: Command[] = [] @@ -247,17 +257,17 @@ export class Command { if (this.config.checkArgCount) { const nextArg = this._argsDef[args.length] if (nextArg?.required) { - return meta.$send(messages.INSUFFICIENT_ARGUMENTS) + return this._sendHint(CommandHint.INSUFFICIENT_ARGUMENTS, meta) } const finalArg = this._argsDef[this._argsDef.length - 1] if (args.length > this._argsDef.length && !finalArg.noSegment && !finalArg.variadic) { - return meta.$send(messages.REDUNANT_ARGUMENTS) + return this._sendHint(CommandHint.REDUNANT_ARGUMENTS, meta) } } // check unknown options if (this.config.checkUnknown && unknown.length) { - return meta.$send(format(messages.UNKNOWN_OPTIONS, unknown.join(', '))) + return this._sendHint(CommandHint.UNKNOWN_OPTIONS, meta, unknown.join(', ')) } // check required options @@ -266,12 +276,13 @@ export class Command { return option.required && !(option.longest in options) }) if (absent) { - return meta.$send(format(messages.REQUIRED_OPTIONS, absent.rawName)) + return this._sendHint(CommandHint.REQUIRED_OPTIONS, meta, absent.rawName) } } // check authority and usage - if (!await this._checkUser(meta, options)) return + const code = this._checkUser(meta, options) + if (code) return this._sendHint(code, meta) // execute command this.context.logger('command').debug('execute %s', this.name) @@ -292,23 +303,30 @@ export class Command { } } + private _sendHint (code: CommandHint, meta: Meta<'message'>, ...param: any[]) { + let { showWarning } = this.config + if (typeof showWarning === 'boolean') { + showWarning = -showWarning + } + if (showWarning & code) { + return meta.$send(format(messages[CommandHint[code]], ...param)) + } + } + /** check authority and usage */ - private async _checkUser (meta: Meta<'message'>, options: Record) { + private _checkUser (meta: Meta<'message'>, options: Record) { const user = meta.$user - if (!user) return true + if (!user) return let isUsage = true // check authority if (this.config.authority > user.authority) { - return meta.$send(messages.LOW_AUTHORITY) + return CommandHint.LOW_AUTHORITY } for (const option of this._options) { if (option.camels[0] in options) { if (option.authority > user.authority) { - if (this.config.showWarning) { - await meta.$send(messages.LOW_AUTHORITY) - } - return + return CommandHint.LOW_AUTHORITY } if (option.notUsage) isUsage = false } @@ -320,17 +338,9 @@ export class Command { const maxUsage = this.getConfig('maxUsage', meta) if (maxUsage < Infinity || minInterval > 0) { - const message = updateUsage(this.usageName, user, maxUsage, minInterval) - if (message) { - if (this.config.showWarning) { - await meta.$send(message) - } - return - } + return updateUsage(this.usageName, user, { maxUsage, minInterval }) } } - - return true } end () { diff --git a/packages/koishi-core/src/database.ts b/packages/koishi-core/src/database.ts index 0247a99dbb..06647bdcf2 100644 --- a/packages/koishi-core/src/database.ts +++ b/packages/koishi-core/src/database.ts @@ -15,7 +15,7 @@ export interface UserData { id: number flag: number authority: number - usage: Record & { _date?: number } + usage: Record & { $date?: number } } export type User = Observed> diff --git a/packages/koishi-core/src/utils.ts b/packages/koishi-core/src/utils.ts index 7e4446b4d6..15da247c95 100644 --- a/packages/koishi-core/src/utils.ts +++ b/packages/koishi-core/src/utils.ts @@ -1,7 +1,7 @@ import { isInteger, getDateNumber } from 'koishi-utils' import { UserField, GroupField, UserData } from './database' import { NextFunction } from './context' -import { Command } from './command' +import { Command, CommandHint } from './command' import { Meta } from './meta' import { messages } from './messages' import { format } from 'util' @@ -18,31 +18,47 @@ export function getTargetId (target: string | number) { return qq } -export function getUsage (name: string, user: Pick, time = new Date()) { - const _date = getDateNumber(time) - if (user.usage._date !== _date) { - user.usage = { _date } as any +const ONE_DAY = 86400000 + +export function getUsage (name: string, user: Pick, time = Date.now()) { + const $date = getDateNumber(time) + if (user.usage.$date !== $date) { + const oldUsage = user.usage + const newUsage = { $date } as any + for (const key in oldUsage) { + if (key === '$date') continue + const { last } = oldUsage[key] + if (time.valueOf() - last < ONE_DAY) { + newUsage[key] = { last, count: 0 } + } + } + user.usage = newUsage } + if (!user.usage[name]) { user.usage[name] = { count: 0 } } return user.usage[name] } -export function updateUsage (name: string, user: Pick, maxUsage: number, minInterval?: number) { - const date = new Date() - const usage = getUsage(name, user, date) +interface UsageOptions { + maxUsage?: number + minInterval?: number + timestamp?: number +} - if (minInterval > 0) { - const now = date.valueOf() - if (now - usage.last <= minInterval) { - return messages.TOO_FREQUENT - } - usage.last = now +export function updateUsage (name: string, user: Pick, options: UsageOptions = {}) { + const now = Date.now() + const { maxUsage = Infinity, minInterval = 0, timestamp = now } = options + const usage = getUsage(name, user, now) + + if (now - usage.last <= minInterval) { + return CommandHint.TOO_FREQUENT } + usage.last = timestamp if (usage.count >= maxUsage) { - return messages.USAGE_EXHAUSTED + return CommandHint.USAGE_EXHAUSTED } else { usage.count++ } diff --git a/packages/koishi-core/tests/utils.spec.ts b/packages/koishi-core/tests/utils.spec.ts index 21a4ae80d1..1531d9fdb8 100644 --- a/packages/koishi-core/tests/utils.spec.ts +++ b/packages/koishi-core/tests/utils.spec.ts @@ -1,4 +1,5 @@ -import { getTargetId } from 'koishi-core' +import { utils } from 'koishi-test-utils' +import { getTargetId, getUsage, updateUsage, createUser } from 'koishi-core' describe('getTargetId', () => { test('with id', () => { @@ -16,3 +17,39 @@ describe('getTargetId', () => { expect(getTargetId('foo123')).toBeFalsy() }) }) + +const user = createUser(123, 1) +const realDateNow = Date.now +const timestamp = 123456789 +const mockedDateNow = Date.now = jest.fn().mockReturnValue(timestamp) + +describe('getUsage', () => { + test('empty usage', () => { + utils.getDateNumber.mockReturnValue(10000) + const usage = getUsage('foo', user) + expect(usage.count).toBe(0) + expect(usage.last).toBeUndefined() + }) + + test('update usage', () => { + expect(updateUsage('foo', user)).toBeFalsy() + const usage = getUsage('foo', user) + expect(usage.count).toBe(1) + expect(usage.last).toBe(timestamp) + }) + + test('another day', () => { + utils.getDateNumber.mockReturnValue(10001) + const usage = getUsage('foo', user) + expect(usage.count).toBe(0) + expect(usage.last).toBe(timestamp) + }) + + test('10 days later', () => { + utils.getDateNumber.mockReturnValue(10010) + mockedDateNow.mockReturnValue(864000000 + timestamp) + const usage = getUsage('foo', user) + expect(usage.count).toBe(0) + expect(usage.last).toBeUndefined() + }) +}) diff --git a/packages/koishi-core/tests/validation.spec.ts b/packages/koishi-core/tests/validation.spec.ts index 4d868a5874..3838596d72 100644 --- a/packages/koishi-core/tests/validation.spec.ts +++ b/packages/koishi-core/tests/validation.spec.ts @@ -70,28 +70,28 @@ describe('middleware validation', () => { describe('command validation', () => { test('check authority', async () => { - app.command('cmd1', { showWarning: true }) + app.command('cmd1', { showWarning: -1 }) await session2.shouldHaveReply('cmd1', messages.LOW_AUTHORITY) await session1.shouldHaveReply('cmd1 --bar', messages.LOW_AUTHORITY) - app.command('cmd1', { showWarning: false }) + app.command('cmd1', { showWarning: 0 }) await session1.shouldHaveNoReply('cmd1 --bar') }) test('check usage', async () => { - app.command('cmd1', { showWarning: true }) + app.command('cmd1', { showWarning: -1 }) await session1.shouldHaveReply('cmd1', 'cmd1:123') await session1.shouldHaveReply('cmd1 --baz', 'cmd1:123') await session1.shouldHaveReply('cmd1', messages.USAGE_EXHAUSTED) await session1.shouldHaveReply('cmd1 --baz', 'cmd1:123') - app.command('cmd1', { showWarning: false }) + app.command('cmd1', { showWarning: 0 }) await session1.shouldHaveNoReply('cmd1') }) test('check frequency', async () => { - app.command('cmd2', { showWarning: true }) + app.command('cmd2', { showWarning: -1 }) await session2.shouldHaveReply('cmd2', 'cmd2:456') await session2.shouldHaveReply('cmd2', messages.TOO_FREQUENT) - app.command('cmd2', { showWarning: false }) + app.command('cmd2', { showWarning: 0 }) await session2.shouldHaveNoReply('cmd2') }) }) diff --git a/packages/koishi-utils/package.json b/packages/koishi-utils/package.json index 1a2b5dee95..85491dc8ff 100644 --- a/packages/koishi-utils/package.json +++ b/packages/koishi-utils/package.json @@ -1,7 +1,7 @@ { "name": "koishi-utils", "description": "Utilities for Koishi", - "version": "1.0.2", + "version": "1.0.3", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ diff --git a/packages/koishi-utils/src/date.ts b/packages/koishi-utils/src/date.ts index 21077075e4..8131415c28 100644 --- a/packages/koishi-utils/src/date.ts +++ b/packages/koishi-utils/src/date.ts @@ -1,4 +1,5 @@ -export function getDateNumber (date = new Date()) { +export function getDateNumber (date: number | Date = new Date()) { + if (typeof date === 'number') date = new Date(date) return Math.floor(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) / 86400000) } diff --git a/packages/koishi-utils/tests/date.spec.ts b/packages/koishi-utils/tests/date.spec.ts index d4d522d825..0df05f29cb 100644 --- a/packages/koishi-utils/tests/date.spec.ts +++ b/packages/koishi-utils/tests/date.spec.ts @@ -4,6 +4,7 @@ describe('Date Manipulations', () => { test('getDateNumber', () => { getDateNumber() /* make coverage happy */ expect(getDateNumber(new Date(2020, 0))).toBe(18262) + expect(getDateNumber(1577808000000)).toBe(18262) }) test('fromDateNumber', () => { diff --git a/packages/plugin-common/package.json b/packages/plugin-common/package.json index 18d735ed83..0816ee3998 100644 --- a/packages/plugin-common/package.json +++ b/packages/plugin-common/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-common", "description": "Common plugins for Koishi", - "version": "2.1.1", + "version": "2.1.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -28,11 +28,11 @@ "plugin" ], "devDependencies": { - "koishi-database-memory": "^1.1.0", - "koishi-test-utils": "^3.0.1" + "koishi-database-memory": "^1.1.1", + "koishi-test-utils": "^3.1.0" }, "dependencies": { - "koishi-core": "^1.8.0", - "koishi-utils": "^1.0.2" + "koishi-core": "^1.8.1", + "koishi-utils": "^1.0.3" } } diff --git a/packages/plugin-common/src/admin.ts b/packages/plugin-common/src/admin.ts index d0eea66141..28e3a741ef 100644 --- a/packages/plugin-common/src/admin.ts +++ b/packages/plugin-common/src/admin.ts @@ -78,7 +78,7 @@ registerUserAction('clearUsage', async (meta, user, ...commands) => { registerUserAction('showUsage', async (meta, user, ...commands) => { const { usage } = user - if (!commands.length) commands = Object.keys(usage).filter(k => !k.startsWith('_')) + if (!commands.length) commands = Object.keys(usage).filter(k => !k.startsWith('$')) if (!commands.length) return meta.$send('用户今日没有调用过指令。') return meta.$send([ '用户今日各指令的调用次数为:', diff --git a/packages/plugin-common/tests/help.spec.ts b/packages/plugin-common/tests/help.spec.ts index 225260860c..4bc6b36ffb 100644 --- a/packages/plugin-common/tests/help.spec.ts +++ b/packages/plugin-common/tests/help.spec.ts @@ -1,4 +1,4 @@ -import { Session, MockedApp } from 'koishi-test-utils' +import { Session, MockedApp, utils } from 'koishi-test-utils' import { noop } from 'koishi-utils' import { help } from '../src' import 'koishi-database-memory' @@ -21,6 +21,8 @@ function prepare (app: MockedApp) { .shortcut('baz-shortcut') } +utils.getDateNumber.mockReturnValue(10000) + describe('help command', () => { let app: MockedApp, session1: Session, session2: Session diff --git a/packages/plugin-nlp/package.json b/packages/plugin-nlp/package.json index f93d38d400..85d38efc93 100644 --- a/packages/plugin-nlp/package.json +++ b/packages/plugin-nlp/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-nlp", "description": "Natural Language Processor for Koishi", - "version": "1.0.1", + "version": "1.0.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -30,11 +30,11 @@ "jieba" ], "devDependencies": { - "koishi-test-utils": "^3.0.1" + "koishi-test-utils": "^3.1.0" }, "dependencies": { - "koishi-core": "^1.8.0", - "koishi-utils": "^1.0.2", + "koishi-core": "^1.8.1", + "koishi-utils": "^1.0.3", "nodejieba": "^2.4.0" } } diff --git a/packages/plugin-recorder/package.json b/packages/plugin-recorder/package.json index 1000eb5597..ec2e84fed9 100644 --- a/packages/plugin-recorder/package.json +++ b/packages/plugin-recorder/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-recorder", "description": "Save Chat Records for Koishi", - "version": "1.0.0-alpha.4", + "version": "1.0.0-alpha.5", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -31,10 +31,10 @@ ], "devDependencies": { "del": "^5.1.0", - "koishi-test-utils": "^3.0.1" + "koishi-test-utils": "^3.1.0" }, "dependencies": { - "koishi-core": "^1.8.0", - "koishi-utils": "^1.0.2" + "koishi-core": "^1.8.1", + "koishi-utils": "^1.0.3" } } diff --git a/packages/plugin-schedule/package.json b/packages/plugin-schedule/package.json index 05da03ba1d..093fe6e878 100644 --- a/packages/plugin-schedule/package.json +++ b/packages/plugin-schedule/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-schedule", "description": "Schedule plugin for Koishi", - "version": "1.0.6", + "version": "1.0.7", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -31,13 +31,13 @@ ], "devDependencies": { "@types/ms": "^0.7.31", - "koishi-database-level": "^1.1.0", - "koishi-database-mysql": "^1.1.0", - "koishi-test-utils": "^3.0.1" + "koishi-database-level": "^1.1.1", + "koishi-database-mysql": "^1.1.1", + "koishi-test-utils": "^3.1.0" }, "dependencies": { - "koishi-core": "^1.8.0", - "koishi-utils": "^1.0.2", + "koishi-core": "^1.8.1", + "koishi-utils": "^1.0.3", "ms": "^2.1.2" } } diff --git a/packages/plugin-teach/package.json b/packages/plugin-teach/package.json index 7ff24bb6ef..e0873d7919 100644 --- a/packages/plugin-teach/package.json +++ b/packages/plugin-teach/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-teach", "description": "Teach plugin for Koishi", - "version": "0.1.15", + "version": "0.1.16", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -31,12 +31,12 @@ "conversation" ], "devDependencies": { - "koishi-database-level": "^1.1.0", - "koishi-database-mysql": "^1.1.0", - "koishi-test-utils": "^3.0.1" + "koishi-database-level": "^1.1.1", + "koishi-database-mysql": "^1.1.1", + "koishi-test-utils": "^3.1.0" }, "dependencies": { - "koishi-core": "^1.8.0", - "koishi-utils": "^1.0.2" + "koishi-core": "^1.8.1", + "koishi-utils": "^1.0.3" } } diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 1e3d302357..296be20442 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -1,7 +1,7 @@ { "name": "koishi-test-utils", "description": "Test utilities for Koishi", - "version": "3.0.1", + "version": "3.1.0", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -37,13 +37,13 @@ }, "devDependencies": { "@types/debug": "^4.1.5", - "@types/jest": "^25.1.1" + "@types/jest": "^25.1.2" }, "dependencies": { "axios": "^0.19.2", "debug": "^4.1.1", "get-port": "^5.1.1", - "koishi-core": "^1.8.0", - "koishi-utils": "^1.0.2" + "koishi-core": "^1.8.1", + "koishi-utils": "^1.0.3" } } diff --git a/packages/test-utils/src/koishi.ts b/packages/test-utils/src/koishi.ts index 05f2a668ac..d9794f308d 100644 --- a/packages/test-utils/src/koishi.ts +++ b/packages/test-utils/src/koishi.ts @@ -21,6 +21,8 @@ interface MockedRandomMultiPick extends RealRandomMultiPick, jest.Mock