mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
refactor
This commit is contained in:
parent
5c5105ce88
commit
bb8771a5b4
@ -36,9 +36,6 @@ import {
|
||||
} from '../ntqqapi/api'
|
||||
import { existsSync, mkdirSync } from 'node:fs'
|
||||
|
||||
import { initWrapperSession} from '@/ntqqapi/native/napcat-protocol-packet'
|
||||
initWrapperSession().then()
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Events {
|
||||
'llob/config-updated': (input: LLOBConfig) => void
|
||||
|
@ -41,12 +41,14 @@ class Core extends Service {
|
||||
static inject = ['ntMsgApi', 'ntFriendApi', 'ntGroupApi', 'store']
|
||||
public startTime = 0
|
||||
public native
|
||||
public ntqqPacketApi: NTQQPacketApi
|
||||
public packet!: NTQQPacketApi
|
||||
|
||||
constructor(protected ctx: Context, public config: Core.Config) {
|
||||
super(ctx, 'app', true)
|
||||
this.native = new Native(ctx)
|
||||
initWrapperSession().then(session=>{this.ntqqPacketApi = new NTQQPacketApi(session)})
|
||||
initWrapperSession().then(session => {
|
||||
this.packet = new NTQQPacketApi(session)
|
||||
})
|
||||
}
|
||||
|
||||
public start() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { selfInfo } from '@/common/globalVars'
|
||||
|
||||
interface Payload {
|
||||
@ -14,7 +13,7 @@ export class SendGroupSign extends BaseAction<Payload, null> {
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
await this.ctx.app.ntqqPacketApi.sendGroupSignPacket(selfInfo.uin, payload.group_id.toString())
|
||||
await this.ctx.app.packet.sendGroupSignPacket(selfInfo.uin, payload.group_id.toString())
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { selfInfo } from '@/common/globalVars'
|
||||
import { GroupMemberRole } from '@/ntqqapi/types'
|
||||
|
||||
@ -25,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.ntqqPacketApi.sendSetSpecialTittlePacket(payload.group_id.toString(), uid, payload.special_title || "")
|
||||
await this.ctx.app.packet.sendSetSpecialTittlePacket(payload.group_id.toString(), uid, payload.special_title || "")
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
|
||||
interface Payload {
|
||||
user_id: number | string
|
||||
@ -21,7 +20,7 @@ export class FriendPoke extends BaseAction<Payload, null> {
|
||||
// }
|
||||
// await this.ctx.app.native.sendFriendPoke(+payload.user_id)
|
||||
|
||||
await this.ctx.app.ntqqPacketApi.sendPokePacket(+payload.user_id)
|
||||
await this.ctx.app.packet.sendPokePacket(+payload.user_id)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import {NTQQPacketApi} from '@/ntqqapi/native/napcat-protocol-packet'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
@ -23,7 +21,7 @@ export class GroupPoke extends BaseAction<Payload, null> {
|
||||
// throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 27333—27597`)
|
||||
// }
|
||||
// await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
|
||||
await this.ctx.app.ntqqPacketApi.sendPokePacket(+payload.user_id, +payload.group_id)
|
||||
await this.ctx.app.packet.sendPokePacket(+payload.user_id, +payload.group_id)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user