fix(onebot): identify QQ automatic replies in private messages
Refs #663
This commit is contained in:
17 files changed
+128
-6
No files matched your search
@@ -73,6 +73,8 @@ Old `SnowLumaEventContext` objects and explicitly typed handlers remain valid. S
|
||||
|
||||
## Wait for a future event
|
||||
|
||||
Private messages marked by QQ as automatic replies carry `auto_reply: true` in live events and friend history. Check `event.auto_reply === true` to filter them. SnowLuma preserves the reply text, including any literal `[自动回复]` the sender typed. Older locally stored messages may lack the flag.
|
||||
|
||||
`waitForEvent(predicate?, options?)` and `waitForMessage(predicate?, options?)` are available on the WebSocket client. Both also accept just the options object. Synchronous type-guard predicates narrow the resolved type; boolean predicates filter without claiming a narrower type.
|
||||
|
||||
```ts
|
||||
|
||||
@@ -18,6 +18,8 @@ export interface OneBotSender extends JsonObject {
|
||||
export interface OneBotPrivateMessageEvent extends OneBotBaseEvent {
|
||||
post_type: 'message' | 'message_sent';
|
||||
message_type: 'private';
|
||||
/** Present only when QQ marks this message as an automatic reply. */
|
||||
auto_reply?: true;
|
||||
sub_type: string;
|
||||
message_id: number;
|
||||
message_seq?: number;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { OneBotPrivateMessageEvent } from './events.js';
|
||||
import type { JsonArray, JsonObject, JsonValue } from './json.js';
|
||||
|
||||
export interface QzoneCommentReply {
|
||||
@@ -85,7 +86,7 @@ export interface GroupMessageHistory {
|
||||
}
|
||||
|
||||
export interface FriendMessageHistory {
|
||||
messages: JsonObject[];
|
||||
messages: Array<JsonObject & Pick<OneBotPrivateMessageEvent, 'auto_reply'>>;
|
||||
}
|
||||
|
||||
export interface GroupNoticeInfo {
|
||||
|
||||
Reference in new issue
Block a user