mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
refactor: remove nc packet api
This commit is contained in:
parent
0fb30df1bc
commit
9453b71943
@ -20,7 +20,6 @@ import { selfInfo } from '../common/globalVars'
|
||||
import { version } from '../version'
|
||||
import { invoke } from './ntcall'
|
||||
import { Native } from './native/crychic'
|
||||
import { initWrapperSession, NTQQPacketApi } from './native/napcat-protocol-packet'
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Context {
|
||||
@ -41,14 +40,10 @@ class Core extends Service {
|
||||
static inject = ['ntMsgApi', 'ntFriendApi', 'ntGroupApi', 'store']
|
||||
public startTime = 0
|
||||
public native
|
||||
public packet!: NTQQPacketApi
|
||||
|
||||
constructor(protected ctx: Context, public config: Core.Config) {
|
||||
super(ctx, 'app', true)
|
||||
this.native = new Native(ctx)
|
||||
initWrapperSession().then(session => {
|
||||
this.packet = new NTQQPacketApi(session)
|
||||
})
|
||||
}
|
||||
|
||||
public start() {
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,17 +0,0 @@
|
||||
import { WrapperSession } from './wrapper-session/types';
|
||||
export { initWrapperSession } from './wrapper-session';
|
||||
export declare function checkSupportVersion(): void;
|
||||
export declare class NTQQPacketApi {
|
||||
private qqVersion;
|
||||
private readonly packetClient;
|
||||
private readonly packer;
|
||||
private logger;
|
||||
private readonly wrapperSession;
|
||||
constructor(wrapperSession: WrapperSession);
|
||||
private InitSendPacket;
|
||||
private sendPacket;
|
||||
private sendOidbPacket;
|
||||
sendPokePacket(peer: number, group?: number): Promise<void>;
|
||||
sendGroupSignPacket(selfUin: string, groupCode: string): Promise<void>;
|
||||
sendSetSpecialTittlePacket(groupCode: string, uid: string, tittle: string): Promise<void>;
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
export declare function initWrapperSession(): Promise<any>;
|
@ -1,6 +0,0 @@
|
||||
export interface MsgService {
|
||||
sendSsoCmdReqByContend: (cmd: string, trace_id: string) => Promise<unknown>;
|
||||
}
|
||||
export type WrapperSession = {
|
||||
getMsgService(): MsgService;
|
||||
};
|
@ -13,7 +13,7 @@ export class SendGroupSign extends BaseAction<Payload, null> {
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
await this.ctx.app.packet.sendGroupSignPacket(selfInfo.uin, payload.group_id.toString())
|
||||
throw new Error('暂未实现群签到功能')
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ export class SetGroupSpecialTitle extends BaseAction<Payload, null> {
|
||||
if (self.role !== GroupMemberRole.Owner){
|
||||
throw new Error(`不是群${payload.group_id}的群主,无法设置群头衔`)
|
||||
}
|
||||
await this.ctx.app.packet.sendSetSpecialTittlePacket(payload.group_id.toString(), uid, payload.special_title || "")
|
||||
throw new Error('暂未实现设置群头衔功能')
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ export class FriendPoke extends BaseAction<Payload, null> {
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
|
||||
await this.ctx.app.packet.sendPokePacket(+payload.user_id)
|
||||
// await this.ctx.app.packet.sendPokePacket(+payload.user_id)
|
||||
throw new Error('戳一戳暂时只支持Windows QQ 27333 ~ 275970版本')
|
||||
}
|
||||
else{
|
||||
await this.ctx.app.native.sendFriendPoke(+payload.user_id)
|
||||
|
@ -16,7 +16,7 @@ export class GroupPoke extends BaseAction<Payload, null> {
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
|
||||
await this.ctx.app.packet.sendPokePacket(+payload.user_id, +payload.group_id)
|
||||
throw new Error('戳一戳暂时只支持Windows QQ 27333 ~ 275970版本')
|
||||
}
|
||||
else{
|
||||
await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user