mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix
This commit is contained in:
@@ -30,13 +30,18 @@ export class PacketOperationContext {
|
||||
return await this.context.client.sendOidbPacket(pkt, rsp);
|
||||
}
|
||||
|
||||
async GroupPoke(groupUin: number, uin: number) {
|
||||
const req = trans.SendPoke.build(true, groupUin, uin);
|
||||
async GroupPoke(peer: number, uin: number) {
|
||||
const req = trans.SendPoke.build(true, peer, uin);
|
||||
await this.context.client.sendOidbPacket(req);
|
||||
}
|
||||
|
||||
async FriendPoke(uin: number, target?: number) {
|
||||
const req = trans.SendPoke.build(false, uin, target ?? uin);
|
||||
async FriendPoke(peer: number, target?: number) {
|
||||
const req = trans.SendPoke.build(false, peer, target ?? peer);
|
||||
await this.context.client.sendOidbPacket(req);
|
||||
}
|
||||
|
||||
async SendPoke(is_group: boolean, peer: number, target?: number) {
|
||||
const req = trans.SendPoke.build(is_group, peer, target ?? peer);
|
||||
await this.context.client.sendOidbPacket(req);
|
||||
}
|
||||
|
||||
|
@@ -1,19 +0,0 @@
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
const SchemaData = Type.Object({
|
||||
group_id: Type.Union([Type.Number(), Type.String()]),
|
||||
user_id: Type.Union([Type.Number(), Type.String()]),
|
||||
});
|
||||
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
|
||||
export class GroupPoke extends GetPacketStatusDepends<Payload, void> {
|
||||
override actionName = ActionName.GroupPoke;
|
||||
override payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
await this.core.apis.PacketApi.pkt.operation.GroupPoke(+payload.group_id, +payload.user_id);
|
||||
}
|
||||
}
|
@@ -78,7 +78,6 @@ import { GetGroupFileSystemInfo } from '@/onebot/action/go-cqhttp/GetGroupFileSy
|
||||
import { GetGroupRootFiles } from '@/onebot/action/go-cqhttp/GetGroupRootFiles';
|
||||
import { GetGroupFilesByFolder } from '@/onebot/action/go-cqhttp/GetGroupFilesByFolder';
|
||||
import { GetGroupSystemMsg } from './system/GetSystemMsg';
|
||||
import { GroupPoke } from './group/GroupPoke';
|
||||
import { GetUserStatus } from './extends/GetUserStatus';
|
||||
import { GetRkey } from './extends/GetRkey';
|
||||
import { SetSpecialTitle } from './extends/SetSpecialTitle';
|
||||
@@ -86,7 +85,6 @@ import { GetGroupShutList } from './group/GetGroupShutList';
|
||||
import { GetGroupMemberList } from './group/GetGroupMemberList';
|
||||
import { GetGroupFileUrl } from '@/onebot/action/file/GetGroupFileUrl';
|
||||
import { GetPacketStatus } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { FriendPoke } from '@/onebot/action/user/FriendPoke';
|
||||
import { GetCredentials } from './system/GetCredentials';
|
||||
import { SendGroupSign, SetGroupSign } from './extends/SetGroupSign';
|
||||
import { GoCQHTTPGetGroupAtAllRemain } from './go-cqhttp/GetGroupAtAllRemain';
|
||||
@@ -102,7 +100,7 @@ import { GetGuildList } from './guild/GetGuildList';
|
||||
import { GetGuildProfile } from './guild/GetGuildProfile';
|
||||
import { GetClientkey } from './extends/GetClientkey';
|
||||
import { SendPacket } from './extends/SendPacket';
|
||||
import { SendPoke } from '@/onebot/action/packet/SendPoke';
|
||||
import { FriendPoke, GroupPoke, SendPoke } from '@/onebot/action/packet/SendPoke';
|
||||
import { SetDiyOnlineStatus } from './extends/SetDiyOnlineStatus';
|
||||
import { BotExit } from './extends/BotExit';
|
||||
import { ClickInlineKeyboardButton } from './extends/ClickInlineKeyboardButton';
|
||||
|
@@ -4,21 +4,32 @@ import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
const SchemaData = Type.Object({
|
||||
group_id: Type.Optional(Type.String()),
|
||||
user_id: Type.String(),
|
||||
user_id: Type.Optional(Type.String()),
|
||||
target_id: Type.Optional(Type.String()),
|
||||
});
|
||||
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
|
||||
export class SendPoke extends GetPacketStatusDepends<Payload, void> {
|
||||
override actionName = ActionName.SendPoke;
|
||||
export class SendPokeBase extends GetPacketStatusDepends<Payload, void> {
|
||||
override payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (payload.group_id) {
|
||||
await this.core.apis.PacketApi.pkt.operation.GroupPoke(+payload.group_id, +payload.user_id);
|
||||
} else {
|
||||
await this.core.apis.PacketApi.pkt.operation.FriendPoke(+payload.user_id, payload.target_id ? +payload.target_id : undefined);
|
||||
const target_id = payload.target_id ?? payload.user_id;
|
||||
const peer_id = payload.group_id ?? payload.user_id;
|
||||
const is_group = !!payload.group_id;
|
||||
if (!target_id || !peer_id) {
|
||||
throw new Error('请检查参数,缺少 user_id 或 group_id');
|
||||
}
|
||||
await this.core.apis.PacketApi.pkt.operation.SendPoke(is_group, +peer_id, +target_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class SendPoke extends SendPokeBase {
|
||||
override actionName = ActionName.SendPoke;
|
||||
}
|
||||
export class GroupPoke extends SendPokeBase {
|
||||
override actionName = ActionName.GroupPoke;
|
||||
}
|
||||
export class FriendPoke extends SendPokeBase {
|
||||
override actionName = ActionName.FriendPoke;
|
||||
}
|
||||
|
@@ -1,19 +0,0 @@
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
const SchemaData = Type.Object({
|
||||
user_id: Type.Number(),
|
||||
target_id: Type.Optional(Type.String()),
|
||||
});
|
||||
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
|
||||
export class FriendPoke extends GetPacketStatusDepends<Payload, void> {
|
||||
override actionName = ActionName.FriendPoke;
|
||||
override payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
await this.core.apis.PacketApi.pkt.operation.FriendPoke(payload.user_id, payload.target_id ? +payload.target_id : undefined);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user