From 70f86ee58c957693527735add43080ed3cc229f3 Mon Sep 17 00:00:00 2001 From: Shigma Date: Sun, 12 Jan 2025 23:09:08 +0800 Subject: [PATCH] chore: bump versions --- package.json | 12 ++++++------ src/bot/message.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7588dd0..6a6b238 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "koishi-plugin-adapter-onebot", - "version": "6.7.2", + "version": "6.8.0", "description": "OneBot Adapter for Koishi", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -46,18 +46,18 @@ }, "devDependencies": { "@cordisjs/eslint-config": "^1.1.1", - "@koishijs/plugin-server": "^3.2.3", - "@types/node": "^22.1.0", + "@koishijs/plugin-server": "^3.2.4", + "@types/node": "^22.7.5", "atsc": "^2.1.0", "esbuild": "^0.23.1", "esbuild-register": "^3.5.0", "eslint": "^8.57.0", - "koishi": "^4.17.12", - "typescript": "^5.5.3", + "koishi": "^4.18.6", + "typescript": "^5.6.2", "yml-register": "^1.2.5" }, "peerDependencies": { - "koishi": "^4.17.12" + "koishi": "^4.18.6" }, "dependencies": { "qface": "^1.4.1" diff --git a/src/bot/message.ts b/src/bot/message.ts index 30906ab..0561d68 100644 --- a/src/bot/message.ts +++ b/src/bot/message.ts @@ -29,12 +29,15 @@ export class OneBotMessageEncoder extends MessageEn ? Universal.Channel.Type.DIRECT : Universal.Channel.Type.TEXT } - if (!this.guildId && !this.session.isDirect) this.guildId = this.channelId + if (!this.session.isDirect) { + this.session.guildId ??= this.channelId + } } async forward() { if (!this.stack[0].children.length) return const session = this.bot.session() + session.content = '' session.messageId = this.session.event.channel.type === Universal.Channel.Type.DIRECT ? '' + await this.bot.internal.sendPrivateForwardMsg(this.channelId.slice(PRIVATE_PFX.length), this.stack[0].children) : '' + await this.bot.internal.sendGroupForwardMsg(this.channelId, this.stack[0].children) @@ -93,8 +96,9 @@ export class OneBotMessageEncoder extends MessageEn } const session = this.bot.session() + session.content = '' session.messageId = this.bot.parent - ? '' + await this.bot.internal.sendGuildChannelMsg(this.guildId, this.channelId, this.children) + ? '' + await this.bot.internal.sendGuildChannelMsg(this.session.guildId, this.channelId, this.children) : this.session.event.channel.type === Universal.Channel.Type.DIRECT ? '' + await this.bot.internal.sendPrivateMsg(this.channelId.slice(PRIVATE_PFX.length), this.children) : '' + await this.bot.internal.sendGroupMsg(this.channelId, this.children) @@ -128,6 +132,7 @@ export class OneBotMessageEncoder extends MessageEn const session = this.bot.session() // 相关 API 没有返回 message_id session.messageId = '' + session.content = '' session.userId = this.bot.selfId session.channelId = this.session.channelId session.guildId = this.session.guildId