feat(onebot): report group special title grant as notify/title
Decode the 0x2DC subType-16 field13==6 push: eventParam carries the member
uin (f5) and a gray-tip template (f2) whose last rich token holds the title
text. Emit notify/title {group_id, user_id, title}, matching NapCat. Field
layout taken from a real on-wire sample, not ported blindly.
This commit is contained in:
7 files changed
+133
-2
No files matched your search
@@ -19,6 +19,7 @@ import {
|
||||
convertGroupMsgEmojiLike,
|
||||
convertGroupMute,
|
||||
convertGroupNameChange,
|
||||
convertGroupTitleChange,
|
||||
convertGroupPoke,
|
||||
convertGroupRecall,
|
||||
} from './to-notice';
|
||||
@@ -83,6 +84,7 @@ const CONVERTERS: ConverterRegistry = {
|
||||
friend_add: convertFriendAdd,
|
||||
friend_input_status: convertFriendInputStatus,
|
||||
group_name_change: convertGroupNameChange,
|
||||
group_title_change: convertGroupTitleChange,
|
||||
group_card_change: convertGroupCardChange,
|
||||
group_msg_emoji_like: convertGroupMsgEmojiLike,
|
||||
// Requests.
|
||||
|
||||
@@ -20,6 +20,7 @@ type GroupMsgEmojiLike = Extract<QQEventVariant, { kind: 'group_msg_emoji_like'
|
||||
type FriendInputStatus = Extract<QQEventVariant, { kind: 'friend_input_status' }>;
|
||||
type GroupNameChange = Extract<QQEventVariant, { kind: 'group_name_change' }>;
|
||||
type GroupCardChange = Extract<QQEventVariant, { kind: 'group_card_change' }>;
|
||||
type GroupTitleChange = Extract<QQEventVariant, { kind: 'group_title_change' }>;
|
||||
|
||||
export function convertGroupMemberJoin(ctx: ConverterContext, event: GroupMemberJoin): JsonObject {
|
||||
return notice(ctx, event, {
|
||||
@@ -171,6 +172,18 @@ export function convertGroupCardChange(ctx: ConverterContext, event: GroupCardCh
|
||||
});
|
||||
}
|
||||
|
||||
export function convertGroupTitleChange(ctx: ConverterContext, event: GroupTitleChange): JsonObject {
|
||||
// Mirrors NapCat's OB11GroupTitleEvent: notify/title with the recipient's uin
|
||||
// and the granted title text.
|
||||
return notice(ctx, event, {
|
||||
notice_type: 'notify',
|
||||
sub_type: 'title',
|
||||
group_id: event.groupId,
|
||||
user_id: event.userUin,
|
||||
title: event.title,
|
||||
});
|
||||
}
|
||||
|
||||
export function convertGroupNameChange(ctx: ConverterContext, event: GroupNameChange): JsonObject {
|
||||
// Mirrors NapCat's OB11GroupNameEvent: notify/group_name with the operator's
|
||||
// uin as user_id and the new name in `name_new`.
|
||||
|
||||
@@ -72,6 +72,7 @@ const NOTICE_KINDS = [
|
||||
'friend_add',
|
||||
'friend_input_status',
|
||||
'group_name_change',
|
||||
'group_title_change',
|
||||
'group_card_change',
|
||||
'group_msg_emoji_like',
|
||||
] as const satisfies readonly QQEventVariant['kind'][];
|
||||
|
||||
Reference in new issue
Block a user