From f0658b45543c355692fe59239b560ac6f1bdf889 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Tue, 6 Oct 2020 20:55:00 +0800 Subject: [PATCH 01/22] feat(cqhttp): support bot.setGroupPortrait() --- packages/adapter-cqhttp/src/api.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/adapter-cqhttp/src/api.ts b/packages/adapter-cqhttp/src/api.ts index 93ecbe14a4..c0bbe56fa0 100644 --- a/packages/adapter-cqhttp/src/api.ts +++ b/packages/adapter-cqhttp/src/api.ts @@ -158,6 +158,8 @@ declare module 'koishi-core/dist/server' { setRestart(cleanLog?: boolean, cleanCache?: boolean, cleanEvent?: boolean): Promise setGroupName(groupId: number, name: string): Promise setGroupNameAsync(groupId: number, name: string): Promise + setGroupPortrait(groupId: number, file: string, cache?: boolean): Promise + setGroupPortraitAsync(groupId: number, file: string, cache?: boolean): Promise getGroupMsg(messageId: number): Promise getForwardMsg(messageId: number): Promise sendGroupForwardMsg(groupId: number, messages: readonly CQNode[]): Promise @@ -412,7 +414,8 @@ interface CQNode { } } -defineAsync('set_group_name', 'group_id', 'name') +defineAsync('set_group_name', 'group_id', 'group_name') +defineAsync('set_group_portrait', 'group_id', 'file', 'cache') export function toVersion(data: VersionInfo) { const { coolqEdition, pluginVersion, goCqhttp, version } = data From 0632f0e811de2e30031aec925882b5ee92f37e39 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 9 Oct 2020 15:13:12 +0800 Subject: [PATCH 02/22] fix(mongo): fix user/group initialization (#106) --- packages/plugin-mongo/src/index.ts | 31 ++---------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/packages/plugin-mongo/src/index.ts b/packages/plugin-mongo/src/index.ts index 6bb403afcb..7d1e8014eb 100644 --- a/packages/plugin-mongo/src/index.ts +++ b/packages/plugin-mongo/src/index.ts @@ -18,22 +18,7 @@ extendDatabase(MongoDatabase, { if (authority < 0) return null if (!data) { fallback = User.create(userId, authority) - if (authority) { - this.user.updateOne( - { _id: userId }, - { - $set: { authority }, - $setOnInsert: { - id: userId, - flag: 0, - name: `${userId}`, - usage: {}, - timers: {}, - }, - }, - { upsert: true }, - ) - } + if (authority) this.user.insertOne({ _id: userId, ...fallback }) } else { if (data.timers) { if (data.timers._date) { @@ -136,19 +121,7 @@ extendDatabase(MongoDatabase, { let fallback: Group if (!data) { fallback = Group.create(groupId, selfId) - if (selfId && groupId) { - this.group.updateOne( - { _id: groupId }, - { - $set: { assignee: selfId }, - $setOnInsert: { - id: groupId, - flag: 0, - }, - }, - { upsert: true }, - ) - } + if (selfId && groupId) this.group.insertOne({ _id: groupId, ...fallback }) } return data || fallback }, From f4cbdaec228d21cec656c3808d2bc5c0cc574fca Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Sat, 10 Oct 2020 01:40:16 +0800 Subject: [PATCH 03/22] feat(mysql): add initialization for chess/monitor/rss/schedule --- packages/plugin-chess/src/index.ts | 7 ++++++- packages/plugin-monitor/src/database.ts | 3 ++- packages/plugin-mysql/src/database.ts | 2 +- packages/plugin-rss/src/index.ts | 3 ++- packages/plugin-schedule/src/database.ts | 13 +++++++++++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/plugin-chess/src/index.ts b/packages/plugin-chess/src/index.ts index d6ed613dda..f4130f0065 100644 --- a/packages/plugin-chess/src/index.ts +++ b/packages/plugin-chess/src/index.ts @@ -1,10 +1,15 @@ -import { Context, Group } from 'koishi-core' +import { Context, extendDatabase, Group } from 'koishi-core' import { isInteger } from 'koishi-utils' import { State, MoveResult, StateData } from './state' +import MysqlDatabase from 'koishi-plugin-mysql/dist/database' import * as go from './go' import * as gomoku from './gomoku' import * as othello from './othello' +extendDatabase('koishi-plugin-mysql', ({ tables }) => { + tables.group.chess = `JSON NULL DEFAULT NULL` +}) + interface Rule { placement?: 'grid' | 'cross' create?: (this: State) => string | void diff --git a/packages/plugin-monitor/src/database.ts b/packages/plugin-monitor/src/database.ts index 9996fc749f..15fa43d785 100644 --- a/packages/plugin-monitor/src/database.ts +++ b/packages/plugin-monitor/src/database.ts @@ -75,8 +75,9 @@ extendDatabase('koishi-plugin-mysql', { }, }) -extendDatabase('koishi-plugin-mysql', ({ listFields }) => { +extendDatabase('koishi-plugin-mysql', ({ listFields, tables }) => { listFields.push('subscribe.names') + tables.group.subscribe = `JSON NULL DEFAULT NULL` }) extendDatabase('koishi-plugin-mongo', { diff --git a/packages/plugin-mysql/src/database.ts b/packages/plugin-mysql/src/database.ts index 6635953b89..3ca9af3619 100644 --- a/packages/plugin-mysql/src/database.ts +++ b/packages/plugin-mysql/src/database.ts @@ -50,7 +50,7 @@ export default class MysqlDatabase { async start() { this.pool = createPool(this.config) const tables = await this.select('information_schema.tables', ['TABLE_NAME'], 'TABLE_SCHEMA = ?', [this.config.database]) - const names = new Set(tables.map(data => data.TABLE_NAME)) + const names = new Set(tables.map(data => data.TABLE_NAME)) for (const name of Object.keys(MysqlDatabase.tables) as TableType[]) { if (names.has(name)) return const table = MysqlDatabase.tables[name] diff --git a/packages/plugin-rss/src/index.ts b/packages/plugin-rss/src/index.ts index 6b9df56090..61840c32b2 100644 --- a/packages/plugin-rss/src/index.ts +++ b/packages/plugin-rss/src/index.ts @@ -13,8 +13,9 @@ Group.extend(() => ({ rss: [], })) -extendDatabase('koishi-plugin-mysql', ({ listFields }) => { +extendDatabase('koishi-plugin-mysql', ({ listFields, tables }) => { listFields.push('group.rss') + tables.group.rss = `TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci'` }) export interface Config { diff --git a/packages/plugin-schedule/src/database.ts b/packages/plugin-schedule/src/database.ts index 69802f95d3..568dca22f9 100644 --- a/packages/plugin-schedule/src/database.ts +++ b/packages/plugin-schedule/src/database.ts @@ -24,6 +24,19 @@ export interface Schedule { session: Session } +extendDatabase(MysqlDatabase, (Database) => { + Object.assign(Database.tables.schedule = [ + 'PRIMARY KEY (`id`) USING BTREE', + ], { + id: `INT(10) UNSIGNED NOT NULL AUTO_INCREMENT`, + assignee: `BIGINT(20) NOT NULL DEFAULT '0'`, + time: `TIMESTAMP NULL DEFAULT NULL`, + interval: `BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'`, + command: `MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_general_ci'`, + session: `JSON NOT NULL`, + }) +}) + extendDatabase('koishi-plugin-mysql', { createSchedule(time, interval, command, session) { return this.create('schedule', { time, assignee: session.selfId, interval, command, session }) From 6d46eb0e36fa0f32798c1de5aaed8238fa65b9df Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Sat, 10 Oct 2020 22:25:27 +0800 Subject: [PATCH 04/22] fix(github): fix typings for new @octokit/webhooks --- packages/plugin-github/src/events.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/plugin-github/src/events.ts b/packages/plugin-github/src/events.ts index b385788a07..4cd0925cff 100644 --- a/packages/plugin-github/src/events.ts +++ b/packages/plugin-github/src/events.ts @@ -1,7 +1,8 @@ /* eslint-disable camelcase */ -import { EventNames } from '@octokit/webhooks' -import { GetWebhookPayloadTypeFromEvent } from '@octokit/webhooks/dist-types/generated/get-webhook-payload-type-from-event' +import { EventTypesPayload } from '@octokit/webhooks/dist-types/generated/get-webhook-payload-type-from-event' + +type WebhookEvent = Exclude export interface EventConfig { commitComment?: boolean | { @@ -105,10 +106,10 @@ export interface EventData { } } -type Payload = GetWebhookPayloadTypeFromEvent['payload'] -type EventHandler = (payload: Payload) => EventData +type Payload = EventTypesPayload[T]['payload'] +type EventHandler = (payload: Payload) => EventData -export function addListeners(on: (event: T, handler: EventHandler) => void) { +export function addListeners(on: (event: T, handler: EventHandler) => void) { function formatMarkdown(source: string) { return source .replace(/^```(.*)$/gm, '') From 330b0aea48dce870aca1d670337c456befb7fba1 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Sun, 11 Oct 2020 01:11:16 +0800 Subject: [PATCH 05/22] fix(rss): fix negated option.remove (#108) Co-authored-by: Shigma <1700011071@pku.edu.cn> --- packages/plugin-rss/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-rss/src/index.ts b/packages/plugin-rss/src/index.ts index 61840c32b2..02b901e797 100644 --- a/packages/plugin-rss/src/index.ts +++ b/packages/plugin-rss/src/index.ts @@ -95,7 +95,7 @@ export function apply(ctx: Context, config: Config = {}) { url = url.toLowerCase() const index = $group.rss.indexOf(url) - if (!options.remove) { + if (options.remove) { if (index < 0) return '未订阅此链接。' $group.rss.splice(index, 1) unsubscribe(url, $group.id) From 99e6655cd6d03ef6cee2c3ef6f26977900800271 Mon Sep 17 00:00:00 2001 From: undefined Date: Mon, 12 Oct 2020 02:16:18 +0800 Subject: [PATCH 06/22] feat(mongo): optimize fallback logic (#107) --- packages/plugin-mongo/src/database.ts | 10 ++--- packages/plugin-mongo/src/index.ts | 59 ++++++++++++--------------- 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/packages/plugin-mongo/src/database.ts b/packages/plugin-mongo/src/database.ts index 504e947f95..7440ff4343 100644 --- a/packages/plugin-mongo/src/database.ts +++ b/packages/plugin-mongo/src/database.ts @@ -1,5 +1,5 @@ import { MongoClient, Db, Collection } from 'mongodb' -import { App, User, Group, TableType } from 'koishi-core' +import { App, TableType } from 'koishi-core' export interface Config { username?: string @@ -11,17 +11,13 @@ export interface Config { prefix?: string } -interface Document { - _id: number -} - export default class MongoDatabase { public config: Config public client: MongoClient public db: Db - user: Collection - group: Collection + user: Collection + group: Collection constructor(public app: App, config: Config) { this.config = config diff --git a/packages/plugin-mongo/src/index.ts b/packages/plugin-mongo/src/index.ts index 7d1e8014eb..28f90c9dbc 100644 --- a/packages/plugin-mongo/src/index.ts +++ b/packages/plugin-mongo/src/index.ts @@ -13,39 +13,35 @@ extendDatabase(MongoDatabase, { const authority = typeof args[0] === 'number' ? args.shift() as number : 0 const fields = args[0] ? args[0] as any : User.fields if (fields && !fields.length) return {} as any - const data = await this.user.findOne({ _id: userId }) - let fallback: User + const data: Partial = (await this.user.findOne({ _id: userId })) || {} if (authority < 0) return null - if (!data) { - fallback = User.create(userId, authority) - if (authority) this.user.insertOne({ _id: userId, ...fallback }) - } else { - if (data.timers) { - if (data.timers._date) { - data.timers.$date = data.timers._date - delete data.timers._date - } - for (const key in data.timers) { - if (key.includes('_')) { - data.timers[key.replace(/_/gmi, '.')] = data.timers[key] - delete data.timers[key] - } - } + const fallback = User.create(userId, authority) + if (authority && [undefined, null].includes(data.authority)) await this.user.updateOne({ _id: userId }, { $set: { authority } }, { upsert: true }) + if (data.timers) { + if (data.timers._date) { + data.timers.$date = data.timers._date + delete data.timers._date } - if (data.usage) { - if (data.usage._date) { - data.usage.$date = data.usage._date - delete data.usage._date + for (const key in data.timers) { + if (key.includes('_')) { + data.timers[key.replace(/_/gmi, '.')] = data.timers[key] + delete data.timers[key] } - for (const key in data.usage) { - if (key.includes('_')) { - data.usage[key.replace(/_/gmi, '.')] = data.usage[key] - delete data.usage[key] - } + } + } + if (data.usage) { + if (data.usage._date) { + data.usage.$date = data.usage._date + delete data.usage._date + } + for (const key in data.usage) { + if (key.includes('_')) { + data.usage[key.replace(/_/gmi, '.')] = data.usage[key] + delete data.usage[key] } } } - return data || fallback + return { ...fallback, ...data } }, async getUsers(...args) { @@ -118,12 +114,9 @@ extendDatabase(MongoDatabase, { const f = {} for (const field of fields) f[field] = 1 const [data] = await this.group.find({ _id: groupId }).project(f).toArray() - let fallback: Group - if (!data) { - fallback = Group.create(groupId, selfId) - if (selfId && groupId) this.group.insertOne({ _id: groupId, ...fallback }) - } - return data || fallback + const fallback = Group.create(groupId, selfId) + if (!data && selfId && groupId) this.group.insertOne({ _id: groupId, selfId, groupId }) + return { ...fallback, ...data } }, async getAllGroups(...args) { From 9211080ddab92bbfb480af45cf4ecbd663363399 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Mon, 12 Oct 2020 02:50:01 +0800 Subject: [PATCH 07/22] feat(admin): support group.assign @id --- packages/plugin-common/src/admin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-common/src/admin.ts b/packages/plugin-common/src/admin.ts index 5d47c7bfae..384550d84a 100644 --- a/packages/plugin-common/src/admin.ts +++ b/packages/plugin-common/src/admin.ts @@ -203,7 +203,7 @@ export function apply(ctx: Context) { ctx.command('group.assign [bot]', '受理者账号', { authority: 4 }) .groupFields(['assignee']) .adminGruop(({ session, target }, value) => { - const assignee = value ? +value : session.selfId + const assignee = value ? getTargetId(value) : session.selfId if (!isInteger(assignee) || assignee < 0) return '参数错误。' target.assignee = assignee }) From 99fff9e19c535f2744ae24cedd162c61988612ad Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Wed, 14 Oct 2020 02:12:52 +0800 Subject: [PATCH 08/22] feat(status): use config.output --- packages/plugin-status/src/index.ts | 54 ++++++++++++++--------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/packages/plugin-status/src/index.ts b/packages/plugin-status/src/index.ts index adaea72b97..9ee808e6e4 100644 --- a/packages/plugin-status/src/index.ts +++ b/packages/plugin-status/src/index.ts @@ -5,12 +5,6 @@ import { ActiveData } from './database' export * from './database' -declare module 'koishi-core/dist/context' { - interface EventMap { - 'status'(status: Status, output: string[]): void - } -} - declare module 'koishi-core/dist/server' { interface BotOptions { label?: string @@ -23,6 +17,7 @@ declare module 'koishi-core/dist/server' { export interface Config { refresh?: number + output?: (status: Status) => string } let usage = getCpuUsage() @@ -93,11 +88,34 @@ export function extendStatus(callback: StatusCallback, local = false) { const startTime = Date.now() +const defaultConfig: Config = { + refresh: Time.minute, + output({ bots, cpu, memory, startTime, activeUsers, activeGroups }) { + const output = bots + .filter(bot => bot.code !== BotStatusCode.BOT_IDLE) + .map(({ label, selfId, code, rate }) => { + return `${label || selfId}:${code ? '无法连接' : `工作中(${rate}/min)`}` + }) + + output.push('==========') + + output.push( + `活跃用户数量:${activeUsers}`, + `活跃群数量:${activeGroups}`, + `启动时间:${new Date(startTime).toLocaleString('zh-CN', { hour12: false })}`, + `CPU 使用率:${(cpu.app * 100).toFixed()}% / ${(cpu.total * 100).toFixed()}%`, + `内存使用率:${(memory.app * 100).toFixed()}% / ${(memory.total * 100).toFixed()}%`, + ) + + return output.join('\n') + }, +} + export const name = 'status' export function apply(ctx: Context, config: Config = {}) { const app = ctx.app - const { refresh = Time.minute } = config + const { refresh, output } = { ...defaultConfig, ...config } app.on('before-command', ({ session }) => { session.$user['lastCall'] = new Date() @@ -148,27 +166,7 @@ export function apply(ctx: Context, config: Config = {}) { .shortcut('运行情况', { prefix: true }) .shortcut('运行状态', { prefix: true }) .action(async () => { - const status = await getStatus() - const { bots, cpu, memory, startTime, activeUsers, activeGroups } = status - - const output = bots - .filter(bot => bot.code !== BotStatusCode.BOT_IDLE) - .map(({ label, selfId, code, rate }) => { - return `${label || selfId}:${code ? '无法连接' : `工作中(${rate}/min)`}` - }) - - output.push('==========') - - output.push( - `活跃用户数量:${activeUsers}`, - `活跃群数量:${activeGroups}`, - `启动时间:${new Date(startTime).toLocaleString('zh-CN', { hour12: false })}`, - `CPU 使用率:${(cpu.app * 100).toFixed()}% / ${(cpu.total * 100).toFixed()}%`, - `内存使用率:${(memory.app * 100).toFixed()}% / ${(memory.total * 100).toFixed()}%`, - ) - - ctx.emit('status', status, output) - return output.join('\n') + return output(await getStatus()) }) async function _getStatus(extend: boolean) { From 9b7f3ebbb1bfbea4e154f408e29243f38c1b1ea3 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Wed, 14 Oct 2020 02:30:27 +0800 Subject: [PATCH 09/22] fix(teach): braces should not be stripped for regexp questions --- packages/plugin-teach/src/internal.ts | 6 ++++-- packages/plugin-teach/src/receiver.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/plugin-teach/src/internal.ts b/packages/plugin-teach/src/internal.ts index 3dabeac6bc..16710a6759 100644 --- a/packages/plugin-teach/src/internal.ts +++ b/packages/plugin-teach/src/internal.ts @@ -59,11 +59,13 @@ export default function apply(ctx: Context, config: Dialogue.Config) { return Message.Teach.ProhibitedCQCode } - const { unprefixed, prefixed, appellative } = config._stripQuestion(options.question) + const { unprefixed, prefixed, appellative } = options.regexp + ? { unprefixed: question, prefixed: question, appellative: false } + : config._stripQuestion(question) argv.appellative = appellative Object.defineProperty(options, '_original', { value: prefixed }) if (unprefixed) { - options.original = options.question + options.original = question options.question = unprefixed } else { delete options.question diff --git a/packages/plugin-teach/src/receiver.ts b/packages/plugin-teach/src/receiver.ts index 64f588c73f..5df7463f63 100644 --- a/packages/plugin-teach/src/receiver.ts +++ b/packages/plugin-teach/src/receiver.ts @@ -307,7 +307,7 @@ export default function (ctx: Context, config: Dialogue.Config) { } function prepareSource(source: string) { - return CQCode.stringifyAll(CQCode.parseAll(source || '').map((code, index, arr) => { + return CQCode.stringifyAll(CQCode.parseAll(source).map((code, index, arr) => { if (typeof code !== 'string') return code let message = simplify(CQCode.unescape('' + code)) .toLowerCase() From ed03ed13320860c7ed6433058e3862bae4063919 Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 14 Oct 2020 13:46:25 +0800 Subject: [PATCH 10/22] feat(eval): authority settings (#110) --- packages/plugin-eval/src/index.ts | 5 +++-- packages/plugin-eval/src/main.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/plugin-eval/src/index.ts b/packages/plugin-eval/src/index.ts index 885302c883..4314888d68 100644 --- a/packages/plugin-eval/src/index.ts +++ b/packages/plugin-eval/src/index.ts @@ -25,6 +25,7 @@ declare module 'koishi-core/dist/session' { const defaultConfig: EvalConfig = { prefix: '>', + authority: 2, timeout: 1000, setupFiles: {}, maxLogs: Infinity, @@ -38,7 +39,7 @@ const logger = new Logger('eval') export const name = 'eval' export function apply(ctx: Context, config: Config = {}) { - const { prefix } = config = { ...defaultConfig, ...config } + const { prefix, authority } = config = { ...defaultConfig, ...config } const { app } = ctx const worker = new EvalWorker(app, config) defineProperty(app, 'worker', worker) @@ -59,7 +60,7 @@ export function apply(ctx: Context, config: Config = {}) { .option('slient', '-s 不输出最后的结果') .option('restart', '-r 重启子线程', { authority: 3 }) .before((session) => { - if (!session['_redirected'] && session.$user?.authority < 2) return '权限不足。' + if (!session['_redirected'] && session.$user?.authority < authority) return '权限不足。' }) attachTraps(cmd, config, async ({ session, options, ctxOptions }, expr) => { diff --git a/packages/plugin-eval/src/main.ts b/packages/plugin-eval/src/main.ts index 1d7c486aa8..36076be86a 100644 --- a/packages/plugin-eval/src/main.ts +++ b/packages/plugin-eval/src/main.ts @@ -17,6 +17,7 @@ const logger = new Logger('eval') export interface MainConfig extends FieldOptions { prefix?: string + authority?: number timeout?: number maxLogs?: number resourceLimits?: ResourceLimits From 3298f4639748fa5bf35caecddfc1191c12f4bc4f Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Wed, 14 Oct 2020 16:03:09 +0800 Subject: [PATCH 11/22] fix(eval): group should not be undefined --- packages/plugin-eval/src/worker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-eval/src/worker.ts b/packages/plugin-eval/src/worker.ts index 67f9a6e610..749ab0ba70 100644 --- a/packages/plugin-eval/src/worker.ts +++ b/packages/plugin-eval/src/worker.ts @@ -140,7 +140,7 @@ export class WorkerAPI { let result: any try { result = await vm.run(`{ - const { send, exec, user } = global[Symbol.for("${key}")]; + const { send, exec, user, group } = global[Symbol.for("${key}")]; delete global[Symbol.for("${key}")]; \n${source} }`, { From 25d7ba52fdb3fc371466ef2938ec8a76ab5e4671 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Wed, 14 Oct 2020 23:26:43 +0800 Subject: [PATCH 12/22] feat(core): support notify sub events --- packages/koishi-core/src/context.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/koishi-core/src/context.ts b/packages/koishi-core/src/context.ts index 4b50aa82c7..26b3336e35 100644 --- a/packages/koishi-core/src/context.ts +++ b/packages/koishi-core/src/context.ts @@ -333,6 +333,9 @@ export interface EventMap { 'group_recall'(session: RawSession<'notice'>): void 'friend_recall'(session: RawSession<'notice'>): void 'notify'(session: RawSession<'notice'>): void + 'notify/poke'(session: RawSession<'notice'>): void + 'notify/lucky_king'(session: RawSession<'notice'>): void + 'notify/honor'(session: RawSession<'notice'>): void 'request/friend'(session: RawSession<'request'>): void 'request/group/add'(session: RawSession<'request'>): void 'request/group/invite'(session: RawSession<'request'>): void From 16cc3eed017df367183ab61169197583727bf5d6 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Wed, 14 Oct 2020 23:40:16 +0800 Subject: [PATCH 13/22] fix(teach): some hacks to remove mysql from dependency --- packages/plugin-mysql/src/database.ts | 7 +++++-- packages/plugin-teach/src/database/mysql.ts | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/plugin-mysql/src/database.ts b/packages/plugin-mysql/src/database.ts index 3ca9af3619..0fdde24cb0 100644 --- a/packages/plugin-mysql/src/database.ts +++ b/packages/plugin-mysql/src/database.ts @@ -22,8 +22,8 @@ export default class MysqlDatabase { public pool: Pool public config: Config - escape = escape - escapeId = escapeId + escape: typeof escape + escapeId: typeof escapeId constructor(public app: App, config: Config) { this.config = { @@ -158,3 +158,6 @@ export default class MysqlDatabase { this.pool.end() } } + +MysqlDatabase.prototype.escape = escape +MysqlDatabase.prototype.escapeId = escapeId diff --git a/packages/plugin-teach/src/database/mysql.ts b/packages/plugin-teach/src/database/mysql.ts index 031085910d..82329d44f7 100644 --- a/packages/plugin-teach/src/database/mysql.ts +++ b/packages/plugin-teach/src/database/mysql.ts @@ -1,8 +1,7 @@ import { Context, extendDatabase } from 'koishi-core' import { clone, defineProperty, Observed, pick } from 'koishi-utils' import { Dialogue, equal, DialogueTest } from '../utils' -import { escape } from 'mysql' -import MysqlDatabase from 'koishi-plugin-mysql/dist/database' +import type MysqlDatabase from 'koishi-plugin-mysql/dist/database' declare module 'koishi-core/dist/context' { interface EventMap { @@ -127,6 +126,8 @@ export default function apply(ctx: Context, config: Dialogue.Config) { }) ctx.on('dialogue/mysql', ({ regexp, answer, question, original }, conditionals) => { + const { escape } = require('koishi-plugin-mysql/dist/database').default.prototype as MysqlDatabase + if (regexp) { if (answer !== undefined) conditionals.push('`answer` REGEXP ' + escape(answer)) if (question !== undefined) conditionals.push('`question` REGEXP ' + escape(original)) From 953591c23bd030bd4807f4c56d032c7e63287d3f Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 15:47:12 +0800 Subject: [PATCH 14/22] feat(teach): support notify event hooks --- packages/plugin-teach/src/receiver.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/plugin-teach/src/receiver.ts b/packages/plugin-teach/src/receiver.ts index 5df7463f63..b543be0ee6 100644 --- a/packages/plugin-teach/src/receiver.ts +++ b/packages/plugin-teach/src/receiver.ts @@ -268,11 +268,17 @@ export default function (ctx: Context, config: Dialogue.Config) { } ctx.group().middleware(async (session, next) => { - return session.$execute({ - command: 'dialogue', - args: [session.message], - next, - }) + return triggerDialogue(ctx, session, next) + }) + + ctx.on('notify/poke', (session) => { + session.message = 'hook:poke' + triggerDialogue(ctx, session) + }) + + ctx.on('notify/honor', (session) => { + session.message = 'hook:' + session.honorType + triggerDialogue(ctx, session) }) ctx.on('dialogue/receive', ({ session, test }) => { From 897141737d0eb7a918fe30281ce02fc0f4903280 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 18:16:11 +0800 Subject: [PATCH 15/22] fix(rss): fix validating refresh time --- packages/plugin-rss/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-rss/src/index.ts b/packages/plugin-rss/src/index.ts index 02b901e797..b4751f18dd 100644 --- a/packages/plugin-rss/src/index.ts +++ b/packages/plugin-rss/src/index.ts @@ -77,7 +77,7 @@ export function apply(ctx: Context, config: Config = {}) { const feeder = new RssFeedEmitter({ userAgent }) return validators[url] = new Promise((resolve, reject) => { // rss-feed-emitter's typings suck - feeder.add({ url, refresh: Number.MAX_SAFE_INTEGER }) + feeder.add({ url, refresh: 1 << 30 }) feeder.on('new-item', resolve) feeder.on('error', reject) timer = setTimeout(() => reject(new Error('connect timeout')), timeout) From 3fa7815f7346900511d788090045a569857b0707 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 18:18:06 +0800 Subject: [PATCH 16/22] feat(rss): show hint for urls being validated --- packages/plugin-rss/src/index.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/plugin-rss/src/index.ts b/packages/plugin-rss/src/index.ts index b4751f18dd..6d6066ed71 100644 --- a/packages/plugin-rss/src/index.ts +++ b/packages/plugin-rss/src/index.ts @@ -1,4 +1,4 @@ -import { Context, Group, extendDatabase } from 'koishi-core' +import { Context, Group, Session, extendDatabase } from 'koishi-core' import { Logger, Time } from 'koishi-utils' import MysqlDatabase from 'koishi-plugin-mysql/dist/database' import RssFeedEmitter from 'rss-feed-emitter' @@ -71,8 +71,12 @@ export function apply(ctx: Context, config: Config = {}) { }) const validators: Record> = {} - function validate(url: string) { - if (validators[url]) return validators[url] + async function validate(url: string, session: Session) { + if (validators[url]) { + await session.$send('正在尝试连接……') + return validators[url] + } + let timer: NodeJS.Timeout const feeder = new RssFeedEmitter({ userAgent }) return validators[url] = new Promise((resolve, reject) => { @@ -91,10 +95,11 @@ export function apply(ctx: Context, config: Config = {}) { ctx.group().command('rss ', 'Subscribe a rss url') .groupFields(['rss', 'id']) .option('remove', '-r, --remove 取消订阅') - .action(async ({ session: { $group }, options }, url) => { + .action(async ({ session, options }, url) => { url = url.toLowerCase() - + const { $group } = session const index = $group.rss.indexOf(url) + if (options.remove) { if (index < 0) return '未订阅此链接。' $group.rss.splice(index, 1) @@ -103,7 +108,7 @@ export function apply(ctx: Context, config: Config = {}) { } if (index >= 0) return '已订阅此链接。' - return validate(url).then(() => { + return validate(url, session).then(() => { subscribe(url, $group.id) if (!$group.rss.includes(url)) { $group.rss.push(url) From 88a7aba9fe42d24c1c52c1662d278c664d6bd9ab Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 19:00:23 +0800 Subject: [PATCH 17/22] feat(rss): add debug logger --- packages/plugin-rss/src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugin-rss/src/index.ts b/packages/plugin-rss/src/index.ts index 6d6066ed71..7123b28b44 100644 --- a/packages/plugin-rss/src/index.ts +++ b/packages/plugin-rss/src/index.ts @@ -39,6 +39,7 @@ export function apply(ctx: Context, config: Config = {}) { } else { feedMap[url] = new Set() feeder.add({ url, refresh }) + logger.debug('subscribe', url) } } @@ -47,6 +48,7 @@ export function apply(ctx: Context, config: Config = {}) { if (!feedMap[url].size) { delete feedMap[url] feeder.remove(url) + logger.debug('unsubscribe', url) } } @@ -63,6 +65,7 @@ export function apply(ctx: Context, config: Config = {}) { } feeder.on('new-item', async (payload) => { + logger.debug('receive', payload) const source = payload.meta.link.toLowerCase() if (!feedMap[source]) return const message = `${payload.meta.title} (${payload.author})\n${payload.title}` From 864a03e37e84e81a8dfcf2f3061bf6d4d184e441 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 19:52:35 +0800 Subject: [PATCH 18/22] feat(teach): support notify event hooks --- packages/plugin-teach/src/receiver.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/plugin-teach/src/receiver.ts b/packages/plugin-teach/src/receiver.ts index b543be0ee6..2cf05b4dd1 100644 --- a/packages/plugin-teach/src/receiver.ts +++ b/packages/plugin-teach/src/receiver.ts @@ -272,11 +272,14 @@ export default function (ctx: Context, config: Dialogue.Config) { }) ctx.on('notify/poke', (session) => { + if (session.targetId !== session.selfId) return session.message = 'hook:poke' triggerDialogue(ctx, session) }) - ctx.on('notify/honor', (session) => { + ctx.on('notify/honor', async (session) => { + const { assignee } = await session.$observeGroup(['assignee']) + if (assignee !== session.selfId) return session.message = 'hook:' + session.honorType triggerDialogue(ctx, session) }) From 76690dbce35810b2ab3308e63ce8e77dfba048f9 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 19:58:38 +0800 Subject: [PATCH 19/22] fix(rss): fix no broadcast --- packages/plugin-rss/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-rss/src/index.ts b/packages/plugin-rss/src/index.ts index 7123b28b44..f4f739b63b 100644 --- a/packages/plugin-rss/src/index.ts +++ b/packages/plugin-rss/src/index.ts @@ -37,7 +37,7 @@ export function apply(ctx: Context, config: Config = {}) { if (url in feedMap) { feedMap[url].add(groupId) } else { - feedMap[url] = new Set() + feedMap[url] = new Set([groupId]) feeder.add({ url, refresh }) logger.debug('subscribe', url) } @@ -65,7 +65,7 @@ export function apply(ctx: Context, config: Config = {}) { } feeder.on('new-item', async (payload) => { - logger.debug('receive', payload) + logger.debug('receive', payload.title) const source = payload.meta.link.toLowerCase() if (!feedMap[source]) return const message = `${payload.meta.title} (${payload.author})\n${payload.title}` From 1078fcd7615976f0db2ad4f8d20046e615acd95e Mon Sep 17 00:00:00 2001 From: Il Harper Date: Thu, 15 Oct 2020 20:03:26 +0800 Subject: [PATCH 20/22] feat(rss): enhance rss description (#112) --- packages/plugin-rss/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-rss/src/index.ts b/packages/plugin-rss/src/index.ts index f4f739b63b..73108c133f 100644 --- a/packages/plugin-rss/src/index.ts +++ b/packages/plugin-rss/src/index.ts @@ -95,7 +95,7 @@ export function apply(ctx: Context, config: Config = {}) { }) } - ctx.group().command('rss ', 'Subscribe a rss url') + ctx.group().command('rss ', '订阅 RSS 链接') .groupFields(['rss', 'id']) .option('remove', '-r, --remove 取消订阅') .action(async ({ session, options }, url) => { From c11add2bdaca9831e34753954f1873e25d5ddd31 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 20:23:15 +0800 Subject: [PATCH 21/22] feat(mysql): add initialization for teach/schedule --- packages/plugin-schedule/src/database.ts | 2 +- packages/plugin-teach/src/database/mysql.ts | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/plugin-schedule/src/database.ts b/packages/plugin-schedule/src/database.ts index 568dca22f9..379d65625c 100644 --- a/packages/plugin-schedule/src/database.ts +++ b/packages/plugin-schedule/src/database.ts @@ -24,7 +24,7 @@ export interface Schedule { session: Session } -extendDatabase(MysqlDatabase, (Database) => { +extendDatabase('koishi-plugin-mysql', (Database) => { Object.assign(Database.tables.schedule = [ 'PRIMARY KEY (`id`) USING BTREE', ], { diff --git a/packages/plugin-teach/src/database/mysql.ts b/packages/plugin-teach/src/database/mysql.ts index 82329d44f7..9b8c2346f2 100644 --- a/packages/plugin-teach/src/database/mysql.ts +++ b/packages/plugin-teach/src/database/mysql.ts @@ -92,8 +92,26 @@ extendDatabase('koishi-plugin-mysql', { }, }) -extendDatabase('koishi-plugin-mysql', ({ listFields }) => { +extendDatabase('koishi-plugin-mysql', ({ listFields, tables }) => { listFields.push('dialogue.groups', 'dialogue.predecessors') + + Object.assign(tables.dialogue = [ + 'PRIMARY KEY (`id`) USING BTREE', + ], { + id: `INT(11) UNSIGNED NOT NULL AUTO_INCREMENT`, + flag: `INT(10) UNSIGNED NOT NULL DEFAULT '0'`, + probS: `DECIMAL(4,3) UNSIGNED NOT NULL DEFAULT '1.000'`, + probA: `DECIMAL(4,3) UNSIGNED NOT NULL DEFAULT '0.000'`, + startTime: `INT(10) NOT NULL DEFAULT '0'`, + endTime: `INT(10) NOT NULL DEFAULT '0'`, + groups: `TINYTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci'`, + original: `TINYTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci'`, + question: `TINYTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci'`, + answer: `TEXT(65535) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci'`, + predecessors: `TINYTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci'`, + successorTimeout: `INT(10) UNSIGNED NOT NULL DEFAULT '0'`, + writer: `BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'`, + }) }) export default function apply(ctx: Context, config: Dialogue.Config) { From d05d354a3d714a630397261b33f31a18f6b68380 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 15 Oct 2020 23:36:24 +0800 Subject: [PATCH 22/22] chore: bump versions --- packages/adapter-cqhttp/package.json | 4 ++-- packages/adapter-tomon/package.json | 2 +- packages/koishi-core/package.json | 2 +- packages/koishi-test-utils/package.json | 2 +- packages/koishi/ecosystem.json | 24 +++++++++++------------ packages/koishi/package.json | 8 ++++---- packages/plugin-chess/package.json | 4 ++-- packages/plugin-common/package.json | 4 ++-- packages/plugin-dice/package.json | 2 +- packages/plugin-eval-addons/package.json | 4 ++-- packages/plugin-eval/package.json | 4 ++-- packages/plugin-github/package.json | 4 ++-- packages/plugin-image-search/package.json | 2 +- packages/plugin-mongo/package.json | 4 ++-- packages/plugin-monitor/package.json | 4 ++-- packages/plugin-mysql/package.json | 4 ++-- packages/plugin-puppeteer/package.json | 2 +- packages/plugin-rss/package.json | 4 ++-- packages/plugin-schedule/package.json | 8 ++++---- packages/plugin-status/package.json | 8 ++++---- packages/plugin-teach/package.json | 8 ++++---- packages/plugin-tools/package.json | 2 +- 22 files changed, 55 insertions(+), 55 deletions(-) diff --git a/packages/adapter-cqhttp/package.json b/packages/adapter-cqhttp/package.json index 760f52d1cb..0444070612 100644 --- a/packages/adapter-cqhttp/package.json +++ b/packages/adapter-cqhttp/package.json @@ -1,7 +1,7 @@ { "name": "koishi-adapter-cqhttp", "description": "CQHTTP adapter for Koishi", - "version": "1.0.5", + "version": "1.0.6", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -31,7 +31,7 @@ "koishi" ], "peerDependencies": { - "koishi-core": "^2.3.1" + "koishi-core": "^2.3.2" }, "devDependencies": { "@types/ms": "^0.7.31", diff --git a/packages/adapter-tomon/package.json b/packages/adapter-tomon/package.json index 59409097c5..98e4656fe6 100644 --- a/packages/adapter-tomon/package.json +++ b/packages/adapter-tomon/package.json @@ -29,7 +29,7 @@ "koishi" ], "peerDependencies": { - "koishi-core": "^2.3.1" + "koishi-core": "^2.3.2" }, "devDependencies": { "koishi-test-utils": "^5.0.2" diff --git a/packages/koishi-core/package.json b/packages/koishi-core/package.json index d576cb95a3..292392bd4a 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": "2.3.1", + "version": "2.3.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "engines": { diff --git a/packages/koishi-test-utils/package.json b/packages/koishi-test-utils/package.json index cd3654320b..d026469c08 100644 --- a/packages/koishi-test-utils/package.json +++ b/packages/koishi-test-utils/package.json @@ -40,7 +40,7 @@ "dependencies": { "chai": "^4.2.0", "chai-as-promised": "^7.1.1", - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "devDependencies": { diff --git a/packages/koishi/ecosystem.json b/packages/koishi/ecosystem.json index 1a3e9de71d..0bd902599b 100644 --- a/packages/koishi/ecosystem.json +++ b/packages/koishi/ecosystem.json @@ -1,6 +1,6 @@ { "koishi-adapter-cqhttp": { - "version": "1.0.5", + "version": "1.0.6", "description": "CQHTTP adapter for Koishi" }, "koishi-adapter-tomon": { @@ -8,11 +8,11 @@ "description": "Tomon adapter for Koishi" }, "koishi-plugin-chess": { - "version": "2.0.0-beta.11", + "version": "2.0.0-beta.12", "description": "Chess Plugin for Koishi" }, "koishi-plugin-common": { - "version": "3.0.2", + "version": "3.0.3", "description": "Common plugins for Koishi" }, "koishi-plugin-dice": { @@ -20,7 +20,7 @@ "description": "COC / DND Tools for Koishi" }, "koishi-plugin-eval": { - "version": "2.0.2", + "version": "2.0.3", "description": "Execute JavaScript in Koishi" }, "koishi-plugin-eval-addons": { @@ -28,7 +28,7 @@ "description": "Execute JavaScript in Koishi" }, "koishi-plugin-github": { - "version": "2.1.1", + "version": "2.1.2", "description": "GitHub webhook plugin for Koishi" }, "koishi-plugin-image-search": { @@ -36,14 +36,14 @@ "description": "Image searching plugin for Koishi" }, "koishi-plugin-mongo": { - "version": "1.0.4", + "version": "1.1.0", "description": "MongoDB support for Koishi" }, "koishi-plugin-monitor": { - "version": "1.0.0-beta.15" + "version": "1.0.0-beta.16" }, "koishi-plugin-mysql": { - "version": "2.0.1", + "version": "2.0.2", "description": "MySQL support for Koishi" }, "koishi-plugin-puppeteer": { @@ -51,19 +51,19 @@ "description": "Take Screenshots in Koishi" }, "koishi-plugin-rss": { - "version": "1.0.1", + "version": "1.1.0", "description": "Subscribe RSS Url for Koishi" }, "koishi-plugin-schedule": { - "version": "2.0.3", + "version": "2.0.4", "description": "Schedule plugin for Koishi" }, "koishi-plugin-status": { - "version": "2.0.0-beta.16", + "version": "2.0.0-beta.17", "description": "Show Status of Koishi" }, "koishi-plugin-teach": { - "version": "1.1.1", + "version": "1.2.0", "description": "Teach plugin for Koishi" }, "koishi-plugin-tools": { diff --git a/packages/koishi/package.json b/packages/koishi/package.json index 50aa40ed41..b7123e2ce0 100644 --- a/packages/koishi/package.json +++ b/packages/koishi/package.json @@ -1,7 +1,7 @@ { "name": "koishi", "description": "A QQ bot framework based on CQHTTP", - "version": "2.3.1", + "version": "2.3.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "engines": { @@ -40,9 +40,9 @@ "dependencies": { "cac": "^6.6.1", "kleur": "^4.1.3", - "koishi-adapter-cqhttp": "^1.0.5", - "koishi-core": "^2.3.1", - "koishi-plugin-common": "^3.0.2", + "koishi-adapter-cqhttp": "^1.0.6", + "koishi-core": "^2.3.2", + "koishi-plugin-common": "^3.0.3", "prompts": "^2.3.2" } } diff --git a/packages/plugin-chess/package.json b/packages/plugin-chess/package.json index 69fcd95023..89c83360ef 100644 --- a/packages/plugin-chess/package.json +++ b/packages/plugin-chess/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-chess", "description": "Chess Plugin for Koishi", - "version": "2.0.0-beta.11", + "version": "2.0.0-beta.12", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -33,7 +33,7 @@ "game" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-plugin-puppeteer": "^1.0.1", "koishi-utils": "^3.1.5" } diff --git a/packages/plugin-common/package.json b/packages/plugin-common/package.json index cdd3d3b2f3..734488af41 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": "3.0.2", + "version": "3.0.3", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -31,7 +31,7 @@ "plugin" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "devDependencies": { diff --git a/packages/plugin-dice/package.json b/packages/plugin-dice/package.json index cde555ab5c..b658ae3f1e 100644 --- a/packages/plugin-dice/package.json +++ b/packages/plugin-dice/package.json @@ -35,7 +35,7 @@ "dice" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "devDependencies": { diff --git a/packages/plugin-eval-addons/package.json b/packages/plugin-eval-addons/package.json index 47b480f9b6..fa17aecbb4 100644 --- a/packages/plugin-eval-addons/package.json +++ b/packages/plugin-eval-addons/package.json @@ -36,8 +36,8 @@ "code" ], "peerDependencies": { - "koishi-core": "^2.3.1", - "koishi-plugin-eval": "^2.0.2", + "koishi-core": "^2.3.2", + "koishi-plugin-eval": "^2.0.3", "koishi-utils": "^3.1.5" }, "dependencies": { diff --git a/packages/plugin-eval/package.json b/packages/plugin-eval/package.json index 4dfe87c936..cf843248ad 100644 --- a/packages/plugin-eval/package.json +++ b/packages/plugin-eval/package.json @@ -1,6 +1,6 @@ { "name": "koishi-plugin-eval", - "version": "2.0.2", + "version": "2.0.3", "description": "Execute JavaScript in Koishi", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -37,7 +37,7 @@ "code" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "devDependencies": { diff --git a/packages/plugin-github/package.json b/packages/plugin-github/package.json index 6204c0fe36..b3a14320ca 100644 --- a/packages/plugin-github/package.json +++ b/packages/plugin-github/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-github", "description": "GitHub webhook plugin for Koishi", - "version": "2.1.1", + "version": "2.1.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -36,7 +36,7 @@ "koishi-test-utils": "^5.0.2" }, "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-plugin-puppeteer": "^1.0.1", "koishi-utils": "^3.1.5" }, diff --git a/packages/plugin-image-search/package.json b/packages/plugin-image-search/package.json index 6c648491a7..c39bc8883a 100644 --- a/packages/plugin-image-search/package.json +++ b/packages/plugin-image-search/package.json @@ -37,7 +37,7 @@ "pixiv" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "dependencies": { diff --git a/packages/plugin-mongo/package.json b/packages/plugin-mongo/package.json index ae37e1381d..859548b1fa 100644 --- a/packages/plugin-mongo/package.json +++ b/packages/plugin-mongo/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-mongo", "description": "MongoDB support for Koishi", - "version": "1.0.4", + "version": "1.1.0", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -39,7 +39,7 @@ "@types/mongodb": "^3.5.27" }, "peerDependencies": { - "koishi-core": "^2.3.1" + "koishi-core": "^2.3.2" }, "dependencies": { "mongodb": "^3.6.2" diff --git a/packages/plugin-monitor/package.json b/packages/plugin-monitor/package.json index 5881a78b5e..fa2373b9fa 100644 --- a/packages/plugin-monitor/package.json +++ b/packages/plugin-monitor/package.json @@ -1,6 +1,6 @@ { "name": "koishi-plugin-monitor", - "version": "1.0.0-beta.15", + "version": "1.0.0-beta.16", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -21,7 +21,7 @@ }, "homepage": "https://github.com/koishijs/koishi#readme", "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" } } diff --git a/packages/plugin-mysql/package.json b/packages/plugin-mysql/package.json index c2e2b606a8..fb085c94a6 100644 --- a/packages/plugin-mysql/package.json +++ b/packages/plugin-mysql/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-mysql", "description": "MySQL support for Koishi", - "version": "2.0.1", + "version": "2.0.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -36,7 +36,7 @@ "@types/mysql": "^2.15.15" }, "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "dependencies": { diff --git a/packages/plugin-puppeteer/package.json b/packages/plugin-puppeteer/package.json index 0424a53a0c..1d34f57551 100644 --- a/packages/plugin-puppeteer/package.json +++ b/packages/plugin-puppeteer/package.json @@ -39,7 +39,7 @@ "koishi-test-utils": "^5.0.2" }, "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "dependencies": { diff --git a/packages/plugin-rss/package.json b/packages/plugin-rss/package.json index f3a44b4823..3c8143485e 100644 --- a/packages/plugin-rss/package.json +++ b/packages/plugin-rss/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-rss", "description": "Subscribe RSS Url for Koishi", - "version": "1.0.1", + "version": "1.1.0", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -36,7 +36,7 @@ "rss" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "devDependencies": { diff --git a/packages/plugin-schedule/package.json b/packages/plugin-schedule/package.json index 920384bc95..c367e82eb2 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": "2.0.3", + "version": "2.0.4", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -34,12 +34,12 @@ "task" ], "devDependencies": { - "koishi-plugin-mongo": "^1.0.4", - "koishi-plugin-mysql": "^2.0.1", + "koishi-plugin-mongo": "^1.1.0", + "koishi-plugin-mysql": "^2.0.2", "koishi-test-utils": "^5.0.2" }, "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" } } diff --git a/packages/plugin-status/package.json b/packages/plugin-status/package.json index ab76e4c5a5..9d38649118 100644 --- a/packages/plugin-status/package.json +++ b/packages/plugin-status/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-status", "description": "Show Status of Koishi", - "version": "2.0.0-beta.16", + "version": "2.0.0-beta.17", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -32,12 +32,12 @@ "status" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "devDependencies": { - "koishi-plugin-mongo": "^1.0.4", - "koishi-plugin-mysql": "^2.0.1", + "koishi-plugin-mongo": "^1.1.0", + "koishi-plugin-mysql": "^2.0.2", "koishi-test-utils": "^5.0.2" } } diff --git a/packages/plugin-teach/package.json b/packages/plugin-teach/package.json index b5714a6c24..6b85da3fb4 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": "1.1.1", + "version": "1.2.0", "main": "dist/index.js", "typings": "dist/index.d.ts", "engines": { @@ -38,12 +38,12 @@ "conversation" ], "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "devDependencies": { - "koishi-plugin-mongo": "^1.0.4", - "koishi-plugin-mysql": "^2.0.1", + "koishi-plugin-mongo": "^1.1.0", + "koishi-plugin-mysql": "^2.0.2", "koishi-test-utils": "^5.0.2" }, "dependencies": { diff --git a/packages/plugin-tools/package.json b/packages/plugin-tools/package.json index 43027c0fa2..9ab5279477 100644 --- a/packages/plugin-tools/package.json +++ b/packages/plugin-tools/package.json @@ -25,7 +25,7 @@ "@types/qrcode": "^1.3.5" }, "peerDependencies": { - "koishi-core": "^2.3.1", + "koishi-core": "^2.3.2", "koishi-utils": "^3.1.5" }, "dependencies": {