Skip to content

Commit

Permalink
chore: bump versions
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 12, 2025
1 parent 94fb904 commit 70f86ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions src/bot/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ export class OneBotMessageEncoder<C extends Context = Context> 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)
Expand Down Expand Up @@ -93,8 +96,9 @@ export class OneBotMessageEncoder<C extends Context = Context> 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)
Expand Down Expand Up @@ -128,6 +132,7 @@ export class OneBotMessageEncoder<C extends Context = Context> 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
Expand Down

0 comments on commit 70f86ee

Please sign in to comment.