mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
fix
This commit is contained in:
parent
eba5900ba8
commit
968bd7a437
@ -56,8 +56,8 @@ export class NTQQGroupApi {
|
||||
async sendPacketPoke(group: string, peer: string) {
|
||||
let data = encodeGroupPoke(group, peer);
|
||||
let hex = Buffer.from(data).toString('hex');
|
||||
let retdata = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0xed3_1', hex, true);
|
||||
console.log('sendPacketPoke', retdata);
|
||||
let retdata = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0xed3_1', hex, false);
|
||||
//console.log('sendPacketPoke', retdata);
|
||||
}
|
||||
async fetchGroupEssenceList(groupCode: string) {
|
||||
const pskey = (await this.core.apis.UserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!;
|
||||
|
@ -51,7 +51,22 @@ export class NTQQPacketApi {
|
||||
return text;
|
||||
}
|
||||
async sendPacket(cmd: string, data: string, rsp = false) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// wtfk tx
|
||||
// 校验失败和异常 可能返回undefined
|
||||
return new Promise<undefined | {
|
||||
type: string,//仅recv含有data
|
||||
trace_id: string,
|
||||
data: {
|
||||
trace_id: string,
|
||||
seq: number,
|
||||
hex_data: string,
|
||||
cmd: string
|
||||
}
|
||||
}>((resolve, reject) => {
|
||||
if (!this.isInit || !this.PacketClient?.isConnected) {
|
||||
this.core.context.logger.logError('PacketClient is not init');
|
||||
return undefined;
|
||||
}
|
||||
let md5 = crypto.createHash('md5').update(data).digest('hex');
|
||||
let trace_id = (this.randText(4) + md5 + data).slice(0, data.length / 2);
|
||||
this.PacketClient?.sendCommand(cmd, data, trace_id, rsp, 5000, async () => {
|
||||
|
@ -4,7 +4,7 @@ import WebSocket from "ws";
|
||||
|
||||
export class PacketClient {
|
||||
private websocket: WebSocket | undefined;
|
||||
private isConnected: boolean = false;
|
||||
public isConnected: boolean = false;
|
||||
private reconnectAttempts: number = 0;
|
||||
private maxReconnectAttempts: number = 5;
|
||||
private cb = new LRUCache<string, { type: string, callback: any }>(500);
|
||||
|
@ -540,10 +540,10 @@ export class NapCatOneBot11Adapter {
|
||||
if (isSelfMsg) {
|
||||
ob11Msg.target_id = parseInt(message.peerUin);
|
||||
}
|
||||
if(ob11Msg.raw_message.startsWith('!poke')){
|
||||
console.log('poke',message.peerUin, message.senderUin);
|
||||
this.core.apis.GroupApi.sendPacketPoke(message.peerUin, message.senderUin);
|
||||
}
|
||||
// if(ob11Msg.raw_message.startsWith('!poke')){
|
||||
// console.log('poke',message.peerUin, message.senderUin);
|
||||
// this.core.apis.GroupApi.sendPacketPoke(message.peerUin, message.senderUin);
|
||||
// }
|
||||
this.networkManager.emitEvent(ob11Msg);
|
||||
}).catch(e => this.context.logger.logError.bind(this.context.logger)('constructMessage error: ', e));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user