mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-16 13:20:33 +00:00
feat: #1179
This commit is contained in:
parent
fb50ae7544
commit
1d08966571
@ -34,7 +34,10 @@ export class PacketOperationContext {
|
|||||||
const req = trans.SendPoke.build(is_group, peer, target ?? peer);
|
const req = trans.SendPoke.build(is_group, peer, target ?? peer);
|
||||||
await this.context.client.sendOidbPacket(req);
|
await this.context.client.sendOidbPacket(req);
|
||||||
}
|
}
|
||||||
|
async SetGroupTodo(groupUin: number, msgSeq: string) {
|
||||||
|
const req = trans.SetGroupTodo.build(groupUin, msgSeq);
|
||||||
|
await this.context.client.sendOidbPacket(req, true);
|
||||||
|
}
|
||||||
async FetchRkey() {
|
async FetchRkey() {
|
||||||
const req = trans.FetchRkey.build();
|
const req = trans.FetchRkey.build();
|
||||||
const resp = await this.context.client.sendOidbPacket(req, true);
|
const resp = await this.context.client.sendOidbPacket(req, true);
|
||||||
|
|||||||
24
src/core/packet/transformer/action/SetGroupTodo.ts
Normal file
24
src/core/packet/transformer/action/SetGroupTodo.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
class SetGroupTodo extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
build(peer: number, msgSeq: string): OidbPacket {
|
||||||
|
const data = new NapProtoMsg(proto.OidbSvcTrpcTcp0XF90_1).encode({
|
||||||
|
groupUin: peer,
|
||||||
|
msgSeq: BigInt(msgSeq)
|
||||||
|
});
|
||||||
|
return OidbBase.build(0xF90, 1, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
parse(data: Buffer) {
|
||||||
|
return OidbBase.parse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new SetGroupTodo();
|
||||||
@ -8,3 +8,4 @@ export { default as SetSpecialTitle } from './SetSpecialTitle';
|
|||||||
export { default as ImageOCR } from './ImageOCR';
|
export { default as ImageOCR } from './ImageOCR';
|
||||||
export { default as MoveGroupFile } from './MoveGroupFile';
|
export { default as MoveGroupFile } from './MoveGroupFile';
|
||||||
export { default as RenameGroupFile } from './RenameGroupFile';
|
export { default as RenameGroupFile } from './RenameGroupFile';
|
||||||
|
export { default as SetGroupTodo } from './SetGroupTodo';
|
||||||
@ -30,3 +30,4 @@ export * from './oidb/Oidb.0xED3_1';
|
|||||||
export * from './oidb/Oidb.0XFE1_2';
|
export * from './oidb/Oidb.0XFE1_2';
|
||||||
export * from './oidb/OidbBase';
|
export * from './oidb/OidbBase';
|
||||||
export * from './oidb/Oidb.0xE07';
|
export * from './oidb/Oidb.0xE07';
|
||||||
|
export * from './oidb/Oidb.0xf90_1';
|
||||||
|
|||||||
6
src/core/packet/transformer/proto/oidb/Oidb.0xf90_1.ts
Normal file
6
src/core/packet/transformer/proto/oidb/Oidb.0xf90_1.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
||||||
|
|
||||||
|
export const OidbSvcTrpcTcp0XF90_1 = {
|
||||||
|
groupUin: ProtoField(1, ScalarType.UINT32),
|
||||||
|
msgSeq: ProtoField(2, ScalarType.UINT64),
|
||||||
|
};
|
||||||
@ -123,10 +123,12 @@ import SetGroupKickMembers from './extends/SetGroupKickMembers';
|
|||||||
import { GetGroupDetailInfo } from './group/GetGroupDetailInfo';
|
import { GetGroupDetailInfo } from './group/GetGroupDetailInfo';
|
||||||
import GetGroupAddRequest from './extends/GetGroupAddRequest';
|
import GetGroupAddRequest from './extends/GetGroupAddRequest';
|
||||||
import { GetCollectionList } from './extends/GetCollectionList';
|
import { GetCollectionList } from './extends/GetCollectionList';
|
||||||
|
import { SetGroupTodo } from './packet/SetGroupTodo';
|
||||||
|
|
||||||
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
||||||
|
|
||||||
const actionHandlers = [
|
const actionHandlers = [
|
||||||
|
new SetGroupTodo(obContext, core),
|
||||||
new GetGroupDetailInfo(obContext, core),
|
new GetGroupDetailInfo(obContext, core),
|
||||||
new SetGroupKickMembers(obContext, core),
|
new SetGroupKickMembers(obContext, core),
|
||||||
new SetGroupAddOption(obContext, core),
|
new SetGroupAddOption(obContext, core),
|
||||||
|
|||||||
31
src/onebot/action/packet/SetGroupTodo.ts
Normal file
31
src/onebot/action/packet/SetGroupTodo.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
|
import { ChatType, Peer } from '@/core';
|
||||||
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
|
import { Static, Type } from '@sinclair/typebox';
|
||||||
|
import { ActionName } from '../router';
|
||||||
|
|
||||||
|
const SchemaData = Type.Object({
|
||||||
|
group_id: Type.String(),
|
||||||
|
message_id: Type.String(),
|
||||||
|
message_seq: Type.Optional(Type.String())
|
||||||
|
});
|
||||||
|
|
||||||
|
type Payload = Static<typeof SchemaData>;
|
||||||
|
export class SetGroupTodo extends GetPacketStatusDepends<Payload, void> {
|
||||||
|
override payloadSchema = SchemaData;
|
||||||
|
override actionName = ActionName.SetGroupTodo;
|
||||||
|
async _handle(payload: Payload) {
|
||||||
|
if (payload.message_seq) {
|
||||||
|
return await this.core.apis.PacketApi.pkt.operation.SetGroupTodo(+payload.group_id, payload.message_seq);
|
||||||
|
}
|
||||||
|
const peer: Peer = {
|
||||||
|
chatType: ChatType.KCHATTYPEGROUP,
|
||||||
|
peerUid: payload.group_id
|
||||||
|
};
|
||||||
|
const { MsgId, Peer } = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id) ?? { Peer: peer, MsgId: payload.message_id };
|
||||||
|
let msg = (await this.core.apis.MsgApi.getMsgsByMsgId(Peer, [MsgId])).msgList[0];
|
||||||
|
if (!msg) throw new Error('消息不存在');
|
||||||
|
await this.core.apis.PacketApi.pkt.operation.SetGroupTodo(+payload.group_id, msg.msgSeq);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ export interface InvalidCheckResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ActionName = {
|
export const ActionName = {
|
||||||
|
SetGroupTodo: 'set_group_todo',
|
||||||
SetGroupKickMembers: 'set_group_kick_members',
|
SetGroupKickMembers: 'set_group_kick_members',
|
||||||
SetGroupRobotAddOption: 'set_group_robot_add_option',
|
SetGroupRobotAddOption: 'set_group_robot_add_option',
|
||||||
SetGroupAddOption: 'set_group_add_option',
|
SetGroupAddOption: 'set_group_add_option',
|
||||||
|
|||||||
@ -40,7 +40,6 @@ import { OB11FriendRequestEvent } from '@/onebot/event/request/OB11FriendRequest
|
|||||||
import { OB11GroupRequestEvent } from '@/onebot/event/request/OB11GroupRequest';
|
import { OB11GroupRequestEvent } from '@/onebot/event/request/OB11GroupRequest';
|
||||||
import { OB11FriendRecallNoticeEvent } from '@/onebot/event/notice/OB11FriendRecallNoticeEvent';
|
import { OB11FriendRecallNoticeEvent } from '@/onebot/event/notice/OB11FriendRecallNoticeEvent';
|
||||||
import { OB11GroupRecallNoticeEvent } from '@/onebot/event/notice/OB11GroupRecallNoticeEvent';
|
import { OB11GroupRecallNoticeEvent } from '@/onebot/event/notice/OB11GroupRecallNoticeEvent';
|
||||||
import { LRUCache } from '@/common/lru-cache';
|
|
||||||
import { BotOfflineEvent } from './event/notice/BotOfflineEvent';
|
import { BotOfflineEvent } from './event/notice/BotOfflineEvent';
|
||||||
import {
|
import {
|
||||||
NetworkAdapterConfig,
|
NetworkAdapterConfig,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user