Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-cn committed Sep 27, 2024
2 parents deb57d1 + a48d544 commit 4b64997
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [1.0.2](https://github.com/zhinjs/qq-official-bot/compare/v1.0.1...v1.0.2) (2024-08-26)


### Bug Fixes

* 接收频道消息表态后无法响应消息 ([9ed7cb9](https://github.com/zhinjs/qq-official-bot/commit/9ed7cb942c6cafc745807ebce579d080ca298648))

## [1.0.1](https://github.com/zhinjs/qq-official-bot/compare/v1.0.0...v1.0.1) (2024-08-09)


### Bug Fixes

* event_id不能发送media富媒体 ([1d45ae3](https://github.com/zhinjs/qq-official-bot/commit/1d45ae31817b89813c98f7574be446a837cac927))

## 1.0.0 (2024-07-05)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qq-official-bot",
"version": "1.0.0",
"version": "1.0.2",
"description": "qq机器人开发SDK",
"main": "lib/index.js",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/entries/sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class Sender {
case 'image':
case 'audio':
case 'video':
if (this.messagePayload.msg_id) {
if (this.messagePayload.msg_id || this.messagePayload.event_id) {
if (!this.baseUrl.startsWith('/v2')) {
const fileData = await this.fixGuildMediaData(elem)
if (typeof fileData !== 'string') {
Expand Down
2 changes: 1 addition & 1 deletion src/event/notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export class MessageReactionNoticeEvent extends NoticeEvent{
this.guild_id = payload.guild_id
this.channel_id = payload.channel_id
this.user_id = payload.user_id
if(payload.target.type!==ReactionTargetType.Message) throw new Error(`unsupported reaction target type: ${payload.target.type}`)
if(![ReactionTargetType.Message, ReactionTargetType.ReactionTargetType_MSG].includes(payload.target.type)) throw new Error(`unsupported reaction target type: ${payload.target.type}`)
this.message_id = payload.target.id
this.emoji = payload.emoji
}
Expand Down
11 changes: 8 additions & 3 deletions src/qqBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ export class QQBot extends EventEmitter {
const event_id = wsRes.id || '';
if (!payload || !event) return;
const transformEvent = QQEvent[event] || 'system'
const result=this.processPayload(event_id,transformEvent,payload)
if(!result) return this.logger.debug('解析事件失败',wsRes)
this.em(transformEvent, result);

try {
const result=this.processPayload(event_id,transformEvent,payload)
if(!result) return this.logger.debug('解析事件失败',wsRes)
this.em(transformEvent, result);
} catch (error) {
return this.logger.debug('解析事件失败',wsRes)
}
}
/**
* 上传多媒体文件
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export enum ReactionTargetType{
Message,
Thread,
Comment,
Reply
Reply,
ReactionTargetType_MSG = 'ReactionTargetType_MSG'
}

0 comments on commit 4b64997

Please sign in to comment.