feat(onebot): report group name change as notify/group_name
Dispatch the 0x2DC subType-16 push by NotifyMessageBody.field13 (was
emoji-react only); field13==12 decodes eventParam as GroupNameChange and
emits notify/group_name {group_id, user_id=operator, name_new}, matching
NapCat. Emoji-react (field13==35) path unchanged.
This commit is contained in:
7 files changed
+128
-3
No files matched your search
@@ -17,6 +17,7 @@ import {
|
||||
convertGroupMemberLeave,
|
||||
convertGroupMsgEmojiLike,
|
||||
convertGroupMute,
|
||||
convertGroupNameChange,
|
||||
convertGroupPoke,
|
||||
convertGroupRecall,
|
||||
} from './to-notice';
|
||||
@@ -80,6 +81,7 @@ const CONVERTERS: ConverterRegistry = {
|
||||
group_file_upload: convertGroupFileUpload,
|
||||
friend_add: convertFriendAdd,
|
||||
friend_input_status: convertFriendInputStatus,
|
||||
group_name_change: convertGroupNameChange,
|
||||
group_msg_emoji_like: convertGroupMsgEmojiLike,
|
||||
// Requests.
|
||||
friend_request: convertFriendRequest,
|
||||
|
||||
@@ -18,6 +18,7 @@ type GroupFileUpload = Extract<QQEventVariant, { kind: 'group_file_upload' }>;
|
||||
type FriendAdd = Extract<QQEventVariant, { kind: 'friend_add' }>;
|
||||
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' }>;
|
||||
|
||||
export function convertGroupMemberJoin(ctx: ConverterContext, event: GroupMemberJoin): JsonObject {
|
||||
return notice(ctx, event, {
|
||||
@@ -157,6 +158,18 @@ export function convertFriendAdd(ctx: ConverterContext, event: FriendAdd): JsonO
|
||||
});
|
||||
}
|
||||
|
||||
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`.
|
||||
return notice(ctx, event, {
|
||||
notice_type: 'notify',
|
||||
sub_type: 'group_name',
|
||||
group_id: event.groupId,
|
||||
user_id: event.operatorUin,
|
||||
name_new: event.name,
|
||||
});
|
||||
}
|
||||
|
||||
export function convertFriendInputStatus(ctx: ConverterContext, event: FriendInputStatus): JsonObject {
|
||||
// Mirrors NapCat's OB11InputStatusEvent: notify/input_status with the peer's
|
||||
// uin, the raw event_type (1 = typing, 3 = recording voice) and status_text.
|
||||
|
||||
@@ -71,6 +71,7 @@ const NOTICE_KINDS = [
|
||||
'group_file_upload',
|
||||
'friend_add',
|
||||
'friend_input_status',
|
||||
'group_name_change',
|
||||
'group_msg_emoji_like',
|
||||
] as const satisfies readonly QQEventVariant['kind'][];
|
||||
|
||||
|
||||
Reference in new issue
Block a user