mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
feat: #1179
This commit is contained in:
@@ -123,10 +123,12 @@ import SetGroupKickMembers from './extends/SetGroupKickMembers';
|
||||
import { GetGroupDetailInfo } from './group/GetGroupDetailInfo';
|
||||
import GetGroupAddRequest from './extends/GetGroupAddRequest';
|
||||
import { GetCollectionList } from './extends/GetCollectionList';
|
||||
import { SetGroupTodo } from './packet/SetGroupTodo';
|
||||
|
||||
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
||||
|
||||
const actionHandlers = [
|
||||
new SetGroupTodo(obContext, core),
|
||||
new GetGroupDetailInfo(obContext, core),
|
||||
new SetGroupKickMembers(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 = {
|
||||
SetGroupTodo: 'set_group_todo',
|
||||
SetGroupKickMembers: 'set_group_kick_members',
|
||||
SetGroupRobotAddOption: 'set_group_robot_add_option',
|
||||
SetGroupAddOption: 'set_group_add_option',
|
||||
|
||||
Reference in New Issue
Block a user