mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
Merge pull request #448 from pk5ls20/feat/friend-poke
feat: add `friend_poke` OneBot11 API
This commit is contained in:
commit
0e8b416f6d
@ -73,8 +73,8 @@ export class NTQQPacketApi {
|
|||||||
return this.packetSession!.client.sendPacket(cmd, data, rsp);
|
return this.packetSession!.client.sendPacket(cmd, data, rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendPokePacket(group: number, peer: number) {
|
async sendPokePacket(peer: number, group?: number) {
|
||||||
const data = this.packetSession?.packer.packPokePacket(group, peer);
|
const data = this.packetSession?.packer.packPokePacket(peer, group);
|
||||||
await this.sendPacket('OidbSvcTrpcTcp.0xed3_1', data!, false);
|
await this.sendPacket('OidbSvcTrpcTcp.0xed3_1', data!, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,11 @@ export class PacketPacker {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
packPokePacket(group: number, peer: number): PacketHexStr {
|
packPokePacket(peer: number, group?: number): PacketHexStr {
|
||||||
const oidb_0xed3 = new NapProtoMsg(OidbSvcTrpcTcp0XED3_1).encode({
|
const oidb_0xed3 = new NapProtoMsg(OidbSvcTrpcTcp0XED3_1).encode({
|
||||||
uin: peer,
|
uin: peer,
|
||||||
groupUin: group,
|
groupUin: group,
|
||||||
friendUin: group,
|
friendUin: group ?? peer,
|
||||||
ext: 0
|
ext: 0
|
||||||
});
|
});
|
||||||
return this.toHexStr(this.packOidbPacket(0xed3, 1, oidb_0xed3));
|
return this.toHexStr(this.packOidbPacket(0xed3, 1, oidb_0xed3));
|
||||||
|
@ -18,6 +18,6 @@ export class GroupPoke extends GetPacketStatusDepends<Payload, any> {
|
|||||||
payloadSchema = SchemaData;
|
payloadSchema = SchemaData;
|
||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
await this.core.apis.PacketApi.sendPokePacket(+payload.group_id, +payload.user_id);
|
await this.core.apis.PacketApi.sendPokePacket(+payload.user_id, +payload.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,7 @@ import { GetGroupShutList } from './group/GetGroupShutList';
|
|||||||
import { GetGroupMemberList } from './group/GetGroupMemberList';
|
import { GetGroupMemberList } from './group/GetGroupMemberList';
|
||||||
import { GetGroupFileUrl } from "@/onebot/action/file/GetGroupFileUrl";
|
import { GetGroupFileUrl } from "@/onebot/action/file/GetGroupFileUrl";
|
||||||
import {GetPacketStatus} from "@/onebot/action/packet/GetPacketStatus";
|
import {GetPacketStatus} from "@/onebot/action/packet/GetPacketStatus";
|
||||||
|
import {FriendPoke} from "@/onebot/action/user/FriendPoke";
|
||||||
|
|
||||||
|
|
||||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||||
@ -189,6 +190,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
|
|||||||
new FetchUserProfileLike(obContext, core),
|
new FetchUserProfileLike(obContext, core),
|
||||||
new GetPacketStatus(obContext, core),
|
new GetPacketStatus(obContext, core),
|
||||||
new GroupPoke(obContext, core),
|
new GroupPoke(obContext, core),
|
||||||
|
new FriendPoke(obContext, core),
|
||||||
new GetUserStatus(obContext, core),
|
new GetUserStatus(obContext, core),
|
||||||
new GetRkey(obContext, core),
|
new GetRkey(obContext, core),
|
||||||
new SetSpecialTittle(obContext, core),
|
new SetSpecialTittle(obContext, core),
|
||||||
|
@ -17,6 +17,7 @@ export enum ActionName {
|
|||||||
// 以下为扩展napcat扩展
|
// 以下为扩展napcat扩展
|
||||||
Unknown = 'unknown',
|
Unknown = 'unknown',
|
||||||
GroupPoke = 'group_poke',
|
GroupPoke = 'group_poke',
|
||||||
|
FriendPoke = 'friend_poke',
|
||||||
SharePeer = 'ArkSharePeer',
|
SharePeer = 'ArkSharePeer',
|
||||||
ShareGroupEx = 'ArkShareGroup',
|
ShareGroupEx = 'ArkShareGroup',
|
||||||
RebootNormal = 'reboot_normal',//无快速登录重新启动
|
RebootNormal = 'reboot_normal',//无快速登录重新启动
|
||||||
|
22
src/onebot/action/user/FriendPoke.ts
Normal file
22
src/onebot/action/user/FriendPoke.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { ActionName } from '../types';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
import {GetPacketStatusDepends} from "@/onebot/action/packet/GetPacketStatus";
|
||||||
|
|
||||||
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
user_id: { type: ['number', 'string'] },
|
||||||
|
},
|
||||||
|
required: ['user_id'],
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
|
export class FriendPoke extends GetPacketStatusDepends<Payload, any> {
|
||||||
|
actionName = ActionName.FriendPoke;
|
||||||
|
payloadSchema = SchemaData;
|
||||||
|
|
||||||
|
async _handle(payload: Payload) {
|
||||||
|
await this.core.apis.PacketApi.sendPokePacket(+payload.user_id);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user