mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: #1018
This commit is contained in:
@@ -31,12 +31,12 @@ export class PacketOperationContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async GroupPoke(groupUin: number, uin: number) {
|
async GroupPoke(groupUin: number, uin: number) {
|
||||||
const req = trans.SendPoke.build(uin, groupUin);
|
const req = trans.SendPoke.build(true, uin, groupUin);
|
||||||
await this.context.client.sendOidbPacket(req);
|
await this.context.client.sendOidbPacket(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
async FriendPoke(uin: number) {
|
async FriendPoke(uin: number, target?: number) {
|
||||||
const req = trans.SendPoke.build(uin);
|
const req = trans.SendPoke.build(false, uin, target ?? uin);
|
||||||
await this.context.client.sendOidbPacket(req);
|
await this.context.client.sendOidbPacket(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ class SendPoke extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
build(peer: number, group?: number): OidbPacket {
|
build(is_group: boolean, peer: number, group?: number): OidbPacket {
|
||||||
const data = new NapProtoMsg(proto.OidbSvcTrpcTcp0XED3_1).encode({
|
const data = new NapProtoMsg(proto.OidbSvcTrpcTcp0XED3_1).encode({
|
||||||
uin: peer,
|
uin: peer,
|
||||||
groupUin: group,
|
groupUin: group,
|
||||||
|
@@ -7,7 +7,7 @@ class OidbBase extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
build(cmd: number, subCmd: number, body: Uint8Array, isUid: boolean = true, isLafter: boolean = false): OidbPacket {
|
build(cmd: number, subCmd: number, body: Uint8Array, isUid: boolean = true, _isLafter: boolean = false): OidbPacket {
|
||||||
const data = new NapProtoMsg(proto.OidbSvcTrpcTcpBase).encode({
|
const data = new NapProtoMsg(proto.OidbSvcTrpcTcpBase).encode({
|
||||||
command: cmd,
|
command: cmd,
|
||||||
subCommand: subCmd,
|
subCommand: subCmd,
|
||||||
|
@@ -5,6 +5,7 @@ import { Static, Type } from '@sinclair/typebox';
|
|||||||
const SchemaData = Type.Object({
|
const SchemaData = Type.Object({
|
||||||
group_id: Type.Optional(Type.Union([Type.Number(), Type.String()])),
|
group_id: Type.Optional(Type.Union([Type.Number(), Type.String()])),
|
||||||
user_id: Type.Union([Type.Number(), Type.String()]),
|
user_id: Type.Union([Type.Number(), Type.String()]),
|
||||||
|
target_id: Type.Union([Type.Number(), Type.String()]),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = Static<typeof SchemaData>;
|
type Payload = Static<typeof SchemaData>;
|
||||||
@@ -17,7 +18,7 @@ export class SendPoke extends GetPacketStatusDepends<Payload, void> {
|
|||||||
if (payload.group_id) {
|
if (payload.group_id) {
|
||||||
await this.core.apis.PacketApi.pkt.operation.GroupPoke(+payload.group_id, +payload.user_id);
|
await this.core.apis.PacketApi.pkt.operation.GroupPoke(+payload.group_id, +payload.user_id);
|
||||||
} else {
|
} else {
|
||||||
await this.core.apis.PacketApi.pkt.operation.FriendPoke(+payload.user_id);
|
await this.core.apis.PacketApi.pkt.operation.FriendPoke(+payload.user_id, payload.target_id ? +payload.target_id : undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,8 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
|||||||
import { Static, Type } from '@sinclair/typebox';
|
import { Static, Type } from '@sinclair/typebox';
|
||||||
|
|
||||||
const SchemaData = Type.Object({
|
const SchemaData = Type.Object({
|
||||||
user_id: Type.Union([Type.Number(), Type.String()])
|
user_id: Type.Number(),
|
||||||
|
target_id: Type.Union([Type.Number(), Type.String()]),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = Static<typeof SchemaData>;
|
type Payload = Static<typeof SchemaData>;
|
||||||
@@ -13,6 +14,6 @@ export class FriendPoke extends GetPacketStatusDepends<Payload, void> {
|
|||||||
override payloadSchema = SchemaData;
|
override payloadSchema = SchemaData;
|
||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
await this.core.apis.PacketApi.pkt.operation.FriendPoke(+payload.user_id);
|
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