mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b7a7eeecd3 | ||
![]() |
d66d42cb5d | ||
![]() |
5514bf0bb8 | ||
![]() |
f5d093cc45 | ||
![]() |
2c1d12e04b | ||
![]() |
110193ea15 | ||
![]() |
fafcf058b1 | ||
![]() |
c8d5eebe5d | ||
![]() |
f6263375f1 | ||
![]() |
f79581d97e | ||
![]() |
1f02c98c8f | ||
![]() |
e1e5c278b9 | ||
![]() |
104839f7ea | ||
![]() |
bb8771a5b4 | ||
![]() |
5c5105ce88 | ||
![]() |
1bf5e41bdc | ||
![]() |
cd679cc041 | ||
![]() |
eabee466bb | ||
![]() |
d3f93257ce | ||
![]() |
33f340ca81 | ||
![]() |
479e8c9d25 | ||
![]() |
30b8793ee1 | ||
![]() |
47b068737d | ||
![]() |
bfb67188ce | ||
![]() |
7ad384d407 |
@@ -23,10 +23,6 @@ TG 群:<https://t.me/+nLZEnpne-pQ1OWFl>
|
||||
|
||||
[](https://starchart.cc/LLOneBot/LLOneBot)
|
||||
|
||||
## 贡献者
|
||||
|
||||
[](https://github.com/LOneBot/LLOneBot/graphs/contributors)
|
||||
|
||||
## 鸣谢
|
||||
|
||||
- [NapCatQQ](https://github.com/NapNeko/NapCatQQ)
|
||||
|
@@ -39,6 +39,7 @@ const config: ElectronViteConfig = {
|
||||
...external.map(genCpModule),
|
||||
{ src: './manifest.json', dest: 'dist' },
|
||||
{ src: './icon.webp', dest: 'dist' },
|
||||
{ src: './src/ntqqapi/native/napcat-protocol-packet/Moehoo/*', dest: 'dist/main/Moehoo' },
|
||||
],
|
||||
}),
|
||||
],
|
||||
|
@@ -4,12 +4,16 @@
|
||||
"name": "LLOneBot",
|
||||
"slug": "LLOneBot",
|
||||
"description": "实现 OneBot 11 和 Satori 协议,用于 QQ 机器人开发",
|
||||
"version": "4.1.2",
|
||||
"version": "4.3.2",
|
||||
"icon": "./icon.webp",
|
||||
"authors": [
|
||||
{
|
||||
"name": "linyuchen",
|
||||
"link": "https://github.com/linyuchen"
|
||||
},
|
||||
{
|
||||
"name": "idranme",
|
||||
"link": "https://github.com/idranme"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
|
10
package.json
10
package.json
@@ -12,7 +12,7 @@
|
||||
"deploy-win": "cmd /c \"xcopy /C /S /Y dist\\* %LITELOADERQQNT_PROFILE%\\plugins\\LLOneBot\\\"",
|
||||
"format": "prettier -cw .",
|
||||
"check": "tsc",
|
||||
"compile:proto": "pbjs --no-create --no-convert --no-delimited --no-verify -t static-module -w es6 -p src/ntqqapi/proto -o src/ntqqapi/proto/compiled.js profileLikeTip.proto groupNotify.proto message.proto richMedia.proto && pbts -o src/ntqqapi/proto/compiled.d.ts src/ntqqapi/proto/compiled.js"
|
||||
"compile:proto": "pbjs --no-create --no-convert --no-delimited --no-verify -t static-module -w es6 -p src/ntqqapi/proto -o src/ntqqapi/proto/compiled.js profileLikeTip.proto groupNotify.proto message.proto richMedia.proto oidb.proto && pbts -o src/ntqqapi/proto/compiled.d.ts src/ntqqapi/proto/compiled.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
@@ -26,7 +26,7 @@
|
||||
"cosmokit": "^1.6.3",
|
||||
"express": "^5.0.1",
|
||||
"fluent-ffmpeg": "^2.1.3",
|
||||
"minato": "^3.6.0",
|
||||
"minato": "^3.6.1",
|
||||
"protobufjs": "^7.4.0",
|
||||
"silk-wasm": "^3.6.3",
|
||||
"ts-case-convert": "^2.1.0",
|
||||
@@ -35,14 +35,14 @@
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/fluent-ffmpeg": "^2.1.26",
|
||||
"@types/fluent-ffmpeg": "^2.1.27",
|
||||
"@types/node": "^20.14.15",
|
||||
"@types/ws": "^8.5.12",
|
||||
"@types/ws": "^8.5.13",
|
||||
"electron": "^31.4.0",
|
||||
"electron-vite": "^2.3.0",
|
||||
"protobufjs-cli": "^1.1.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.4.10 ",
|
||||
"vite": "^5.4.11",
|
||||
"vite-plugin-cp": "^4.0.8"
|
||||
},
|
||||
"packageManager": "yarn@4.5.1"
|
||||
|
@@ -13,6 +13,10 @@ const manifest = {
|
||||
{
|
||||
name: 'linyuchen',
|
||||
link: 'https://github.com/linyuchen'
|
||||
},
|
||||
{
|
||||
"name": "idranme",
|
||||
"link": "https://github.com/idranme"
|
||||
}
|
||||
],
|
||||
repository: {
|
||||
|
@@ -27,9 +27,10 @@ export function checkFileReceived(path: string, timeout: number = 3000): Promise
|
||||
|
||||
export function calculateFileMD5(filePath: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const hash = createHash('md5')
|
||||
|
||||
// 创建一个流式读取器
|
||||
const stream = fs.createReadStream(filePath)
|
||||
const hash = createHash('md5')
|
||||
|
||||
stream.on('data', (data: Buffer) => {
|
||||
// 当读取到数据时,更新哈希对象的状态
|
||||
@@ -122,8 +123,11 @@ export async function uri2local(ctx: Context, uri: string, needExt?: boolean): P
|
||||
const { type } = checkUriType(uri)
|
||||
|
||||
if (type === FileUriType.FileURL) {
|
||||
const filePath = fileURLToPath(uri)
|
||||
const fileUri = uri.replace('%', '%25').replace('#', '%23')
|
||||
const filePath = fileURLToPath(fileUri)
|
||||
const fileName = path.basename(filePath)
|
||||
// console.log('fileURLToPath', filePath)
|
||||
// console.log('fileName', fileName)
|
||||
return { success: true, errMsg: '', fileName, path: filePath, isLocal: true }
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,11 @@ export function getBuildVersion(): number {
|
||||
return +globalThis.LiteLoader.package.qqnt.buildVersion
|
||||
}
|
||||
|
||||
/** QQ Full Version */
|
||||
export function getFullVersion(): string {
|
||||
return globalThis.LiteLoader.versions.qqnt
|
||||
}
|
||||
|
||||
/** 在保证老对象已有的属性不变化的情况下将新对象的属性复制到老对象 */
|
||||
export function mergeNewProperties(newObj: Dict, oldObj: Dict) {
|
||||
Object.keys(newObj).forEach((key) => {
|
||||
|
9
src/common/utils/window.ts
Normal file
9
src/common/utils/window.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { BrowserWindow } from 'electron'
|
||||
import { log } from '@/common/utils'
|
||||
|
||||
export function getAllWindowIds(): number[] {
|
||||
const allWindows = BrowserWindow.getAllWindows();
|
||||
const ids = allWindows.map(window => window.id);
|
||||
log('getAllWindowIds', ids);
|
||||
return ids;
|
||||
}
|
@@ -35,6 +35,7 @@ import {
|
||||
NTQQWindowApi
|
||||
} from '../ntqqapi/api'
|
||||
import { existsSync, mkdirSync } from 'node:fs'
|
||||
import { NTQQSystemApi } from '@/ntqqapi/api/system'
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Events {
|
||||
@@ -74,6 +75,7 @@ function onLoad() {
|
||||
ctx.plugin(NTQQWebApi)
|
||||
ctx.plugin(NTQQWindowApi)
|
||||
ctx.plugin(Database)
|
||||
ctx.plugin(NTQQSystemApi)
|
||||
|
||||
let started = false
|
||||
|
||||
@@ -180,7 +182,6 @@ function onLoad() {
|
||||
if (self.uin) {
|
||||
clearInterval(intervalId)
|
||||
log('process pid', process.pid)
|
||||
|
||||
const config = getConfigUtil().getConfig()
|
||||
|
||||
if (config.enableLLOB && (config.satori.enable || config.ob11.enable)) {
|
||||
@@ -191,7 +192,6 @@ function onLoad() {
|
||||
log('LLOneBot 开关设置为关闭,不启动 LLOneBot')
|
||||
return
|
||||
}
|
||||
|
||||
ctx.plugin(Log, {
|
||||
enable: config.log!,
|
||||
filename: logFileName
|
||||
@@ -230,6 +230,9 @@ function onLoad() {
|
||||
|
||||
// 创建窗口时触发
|
||||
function onBrowserWindowCreated(window: BrowserWindow) {
|
||||
if (window.id === 2) {
|
||||
mainWindow = window
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@@ -107,7 +107,7 @@ export class NTQQFriendApi extends Service {
|
||||
return ret.arkMsg
|
||||
}
|
||||
|
||||
async setBuddyRemark(uid: string, remark: string) {
|
||||
async setBuddyRemark(uid: string, remark = '') {
|
||||
return await invoke('nodeIKernelBuddyService/setBuddyRemark', [{
|
||||
remarkParams: { uid, remark }
|
||||
}])
|
||||
@@ -122,4 +122,8 @@ export class NTQQFriendApi extends Service {
|
||||
}
|
||||
}])
|
||||
}
|
||||
|
||||
async setBuddyCategory(uid: string, categoryId: number) {
|
||||
return await invoke('nodeIKernelBuddyService/setBuddyCategory', [{ uid, categoryId }])
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,8 @@ import {
|
||||
PublishGroupBulletinReq,
|
||||
GroupAllInfo,
|
||||
GroupFileInfo,
|
||||
GroupBulletinListResult
|
||||
GroupBulletinListResult,
|
||||
GroupMsgMask
|
||||
} from '../types'
|
||||
import { invoke, NTClass, NTMethod } from '../ntcall'
|
||||
import { GeneralCallResult } from '../services'
|
||||
@@ -341,4 +342,12 @@ export class NTQQGroupApi extends Service {
|
||||
[{ groupId }]
|
||||
)
|
||||
}
|
||||
|
||||
async setGroupMsgMask(groupCode: string, msgMask: GroupMsgMask) {
|
||||
return await invoke('nodeIKernelGroupService/setGroupMsgMask', [{ groupCode, msgMask }])
|
||||
}
|
||||
|
||||
async setGroupRemark(groupCode: string, groupRemark = '') {
|
||||
return await invoke('nodeIKernelGroupService/modifyGroupRemark', [{ groupCode, groupRemark }])
|
||||
}
|
||||
}
|
||||
|
@@ -284,4 +284,8 @@ export class NTQQMsgApi extends Service {
|
||||
async fetchUnitedCommendConfig(groups: string[]) {
|
||||
return await invoke('nodeIKernelUnitedConfigService/fetchUnitedCommendConfig', [{ groups }])
|
||||
}
|
||||
|
||||
async sendSsoCmdReqByContend(ssoCmd: string, content: string) {
|
||||
return await invoke('nodeIKernelMsgService/sendSsoCmdReqByContend', [{ ssoCmd, content }])
|
||||
}
|
||||
}
|
||||
|
38
src/ntqqapi/api/system.ts
Normal file
38
src/ntqqapi/api/system.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Context, Service } from 'cordis'
|
||||
import { invoke, NTClass } from '@/ntqqapi/ntcall'
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Context {
|
||||
ntSystemApi: NTQQSystemApi
|
||||
}
|
||||
}
|
||||
|
||||
export class NTQQSystemApi extends Service {
|
||||
constructor(protected ctx: Context) {
|
||||
super(ctx, 'ntSystemApi', true)
|
||||
}
|
||||
|
||||
async restart() {
|
||||
// todo: 调用此接口后会将 NTQQ 设置里面的自动登录和无需手机确认打开,重启后将状态恢复到之前的状态
|
||||
|
||||
// 设置自动登录
|
||||
await this.setSettingAutoLogin(true)
|
||||
// 退出账号
|
||||
invoke('quitAccount', [], {
|
||||
className: NTClass.BUSINESS_API
|
||||
}).then()
|
||||
invoke('notifyQQClose', [{ type: 1 }], { className: NTClass.QQ_EX_API }).then()
|
||||
// 等待登录界面,模拟点击登录按钮?还是直接调用登录方法?
|
||||
}
|
||||
|
||||
async getSettingAutoLogin() {
|
||||
// 查询是否自动登录
|
||||
return invoke('nodeIKernelNodeMiscService/queryAutoRun', [])
|
||||
}
|
||||
|
||||
async setSettingAutoLogin(state: boolean) {
|
||||
await invoke('nodeIKernelSettingService/setNeedConfirmSwitch', [{ state: 1 }]) // 1:不需要手机确认,2:需要手机确认
|
||||
|
||||
await invoke('nodeIKernelSettingService/setAutoLoginSwitch', [{ state }])
|
||||
}
|
||||
}
|
@@ -19,7 +19,8 @@ import {
|
||||
import { selfInfo } from '../common/globalVars'
|
||||
import { version } from '../version'
|
||||
import { invoke } from './ntcall'
|
||||
import { Native } from './native/index'
|
||||
import { Native } from './native/crychic'
|
||||
import { initWrapperSession, NTQQPacketApi } from './native/napcat-protocol-packet'
|
||||
|
||||
declare module 'cordis' {
|
||||
interface Context {
|
||||
@@ -40,10 +41,14 @@ 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() {
|
||||
|
86
src/ntqqapi/helper/offset.json
Normal file
86
src/ntqqapi/helper/offset.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"3.2.12-28418-x64": {
|
||||
"recv": "A0723E0",
|
||||
"send": "A06EAE0"
|
||||
},
|
||||
"9.9.15-28418-x64": {
|
||||
"recv": "37A9004",
|
||||
"send": "37A4BD0"
|
||||
},
|
||||
"6.9.56-28418-x64": {
|
||||
"send": "4471360",
|
||||
"recv": "4473BCC"
|
||||
},
|
||||
"6.9.56-28418-arm64": {
|
||||
"send": "3FBDBF8",
|
||||
"recv": "3FC0410"
|
||||
},
|
||||
"9.9.15-28498-x64": {
|
||||
"recv": "37A9004",
|
||||
"send": "37A4BD0"
|
||||
},
|
||||
"9.9.16-28788-x64": {
|
||||
"send": "38076D0",
|
||||
"recv": "380BB04"
|
||||
},
|
||||
"3.2.13-28788-x64": {
|
||||
"send": "A0CEC20",
|
||||
"recv": "A0D2520"
|
||||
},
|
||||
"3.2.13-28788-arm64": {
|
||||
"send": "6E91018",
|
||||
"recv": "6E94850"
|
||||
},
|
||||
"9.9.16-28971-x64": {
|
||||
"send": "38079F0",
|
||||
"recv": "380BE24"
|
||||
},
|
||||
"3.2.13-28971-x64": {
|
||||
"send": "A0CEF60",
|
||||
"recv": "A0D2860"
|
||||
},
|
||||
"3.2.12-28971-arm64": {
|
||||
"send": "6E91318",
|
||||
"recv": "6E94B50"
|
||||
},
|
||||
"6.9.58-28971-x64": {
|
||||
"send": "449ACA0",
|
||||
"recv": "449D50C"
|
||||
},
|
||||
"6.9.58-28971-arm64": {
|
||||
"send": "3FE0DB0",
|
||||
"recv": "3FE35C8"
|
||||
},
|
||||
"9.9.16-29271-x64": {
|
||||
"send": "3833510",
|
||||
"recv": "3837944"
|
||||
},
|
||||
"3.2.13-29271-x64": {
|
||||
"send": "A11E680",
|
||||
"recv": "A121F80"
|
||||
},
|
||||
"3.2.13-29271-arm64": {
|
||||
"send": "6ECA098",
|
||||
"recv": "6ECD8D0"
|
||||
},
|
||||
"9.9.16-29456-x64": {
|
||||
"send": "3835CD0",
|
||||
"recv": "383A104"
|
||||
},
|
||||
"3.2.13-29456-x64": {
|
||||
"send": "A11E820",
|
||||
"recv": "A122120"
|
||||
},
|
||||
"3.2.13-29456-arm64": {
|
||||
"send": "6ECA130",
|
||||
"recv": "6ECD968"
|
||||
},
|
||||
"6.9.59-29456-x64": {
|
||||
"send": "44C57A0",
|
||||
"recv": "44C800C"
|
||||
},
|
||||
"6.9.59-29456-arm64": {
|
||||
"send": "4005FE8",
|
||||
"recv": "4008800"
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@ import { NTMethod } from './ntcall'
|
||||
import { log } from '@/common/utils'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { ipcMain } from 'electron'
|
||||
import { Dict } from 'cosmokit'
|
||||
|
||||
export const hookApiCallbacks: Record<string, (res: any) => void> = {}
|
||||
|
||||
@@ -40,30 +41,31 @@ const callHooks: Array<{
|
||||
}> = []
|
||||
|
||||
export function startHook() {
|
||||
log('start hook')
|
||||
|
||||
const senderExclude = Symbol()
|
||||
|
||||
ipcMain.emit = new Proxy(ipcMain.emit, {
|
||||
apply(target, thisArg, args: [eventName: string, ...args: any]) {
|
||||
if (args[2]?.eventName.startsWith('ns-LoggerApi')) {
|
||||
apply(target, thisArg, args: [channel: string, ...args: any]) {
|
||||
if (args[2]?.eventName?.startsWith('ns-LoggerApi')) {
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
if (logHook) {
|
||||
log('request', args)
|
||||
}
|
||||
|
||||
const event = args[1]
|
||||
if (event.sender && !event.sender[senderExclude]) {
|
||||
event.sender[senderExclude] = true
|
||||
event.sender.send = new Proxy(event.sender.send, {
|
||||
apply(target, thisArg, args: any[]) {
|
||||
if (args[1].eventName?.startsWith('ns-LoggerApi')) {
|
||||
apply(target, thisArg, args: [channel: string, meta: Dict, data: Dict[]]) {
|
||||
if (args[1]?.eventName?.startsWith('ns-LoggerApi')) {
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
if (logHook) {
|
||||
log('received', args)
|
||||
}
|
||||
|
||||
const callbackId = args[1].callbackId
|
||||
const callbackId = args[1]?.callbackId
|
||||
if (callbackId) {
|
||||
if (hookApiCallbacks[callbackId]) {
|
||||
Promise.resolve(hookApiCallbacks[callbackId](args[2]))
|
||||
@@ -95,7 +97,7 @@ export function startHook() {
|
||||
}
|
||||
}
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { Context } from 'cordis'
|
||||
import { Dict } from 'cosmokit'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { TEMP_DIR } from '@/common/globalVars'
|
||||
import { getBuildVersion } from '../../../common/utils/misc'
|
||||
import { TEMP_DIR } from '../../../common/globalVars'
|
||||
import { copyFile } from 'fs/promises'
|
||||
import { ChatType, Peer } from '../types'
|
||||
import { ChatType, Peer } from '../../types'
|
||||
import path from 'node:path'
|
||||
import addon from './external/crychic-win32-x64.node?asset'
|
||||
|
||||
@@ -11,7 +11,7 @@ export class Native {
|
||||
public activated = false
|
||||
private crychic?: Dict
|
||||
private seq = 0
|
||||
private cb: Map<number, Function> = new Map()
|
||||
private cb: Map<number, (res: any) => void> = new Map()
|
||||
|
||||
constructor(private ctx: Context) {
|
||||
ctx.on('ready', () => {
|
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.darwin.arm64.node
vendored
Normal file
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.darwin.arm64.node
vendored
Normal file
Binary file not shown.
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.linux.arm64.node
vendored
Normal file
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.linux.arm64.node
vendored
Normal file
Binary file not shown.
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.linux.x64.node
vendored
Normal file
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.linux.x64.node
vendored
Normal file
Binary file not shown.
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.win32.x64.node
vendored
Normal file
BIN
src/ntqqapi/native/moehoo/external/MoeHoo.win32.x64.node
vendored
Normal file
Binary file not shown.
138
src/ntqqapi/native/moehoo/index.ts
Normal file
138
src/ntqqapi/native/moehoo/index.ts
Normal file
@@ -0,0 +1,138 @@
|
||||
import { Context } from 'cordis'
|
||||
import { arch } from 'node:os'
|
||||
import { getFullVersion, getBuildVersion } from '@/common/utils/misc'
|
||||
import { selfInfo, TEMP_DIR } from '@/common/globalVars'
|
||||
import { Dict } from 'cosmokit'
|
||||
import { copyFile } from 'node:fs/promises'
|
||||
import { createHash } from 'node:crypto'
|
||||
import { Oidb } from '@/ntqqapi/proto/compiled'
|
||||
import path from 'node:path'
|
||||
import offset from '@/ntqqapi/helper/offset.json'
|
||||
|
||||
interface Offset {
|
||||
[key: string]: {
|
||||
recv: string
|
||||
send: string
|
||||
}
|
||||
}
|
||||
|
||||
export class Native {
|
||||
available = false
|
||||
moehoo?: Dict
|
||||
|
||||
constructor(private ctx: Context) {
|
||||
ctx.on('ready', async () => {
|
||||
this.init()
|
||||
})
|
||||
}
|
||||
|
||||
private async init() {
|
||||
const key = getFullVersion() + '-' + arch()
|
||||
const currOffset = (offset as Offset)[key]
|
||||
if (!currOffset) {
|
||||
return
|
||||
}
|
||||
const platform = process.platform + '.' + process.arch
|
||||
try {
|
||||
const fileName = 'MoeHoo.' + platform + '.node' // todo: 需要加入版本号或者hash,不然多开QQ时会导致copyFile失败从而无法进行在线更新
|
||||
const src = path.join(__dirname, 'Moehoo', fileName)
|
||||
const dest = path.join(TEMP_DIR, fileName)
|
||||
try {
|
||||
await copyFile(src, dest)
|
||||
} catch (e) {
|
||||
// resource busy or locked?
|
||||
this.ctx.logger.warn(e)
|
||||
}
|
||||
this.moehoo = require(dest)
|
||||
this.moehoo!.InitHook(currOffset.send, currOffset.recv, () => {
|
||||
})
|
||||
this.available = true
|
||||
} catch (e) {
|
||||
this.ctx.logger.warn('moehoo 加载失败', e)
|
||||
}
|
||||
}
|
||||
|
||||
private async sendPacket(cmd: string, data: string) {
|
||||
const traceId = `${Date.now()}${data}`.slice(0, data.length / 2)
|
||||
const traceIdMd5 = createHash('md5').update(traceId).digest('hex')
|
||||
this.moehoo!.SendPacket(cmd, data, traceIdMd5)
|
||||
const res = await this.ctx.ntMsgApi.sendSsoCmdReqByContend(cmd, traceId)
|
||||
if (res.result !== 0) {
|
||||
throw new Error(res.errMsg)
|
||||
}
|
||||
}
|
||||
|
||||
private check() {
|
||||
if (this.available) {
|
||||
return
|
||||
}
|
||||
const minVersion = 28418
|
||||
const maxVersion = 29456
|
||||
const currVersion = getBuildVersion()
|
||||
if (currVersion < minVersion || currVersion > maxVersion) {
|
||||
throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 ${minVersion}—${maxVersion}`)
|
||||
} else {
|
||||
throw new Error('packet backend 当前不可用')
|
||||
}
|
||||
}
|
||||
|
||||
async groupPoke(groupCode: number, uin: number) {
|
||||
this.check()
|
||||
const data = Oidb.Oidb_0xED3_1.encode({
|
||||
uin,
|
||||
groupCode
|
||||
}).finish()
|
||||
const req = buildOidbRequest(0xED3, 1, data)
|
||||
await this.sendPacket(req.cmd, req.data)
|
||||
}
|
||||
|
||||
async friendPoke(uin: number) {
|
||||
this.check()
|
||||
const data = Oidb.Oidb_0xED3_1.encode({
|
||||
uin,
|
||||
friendUin: uin
|
||||
}).finish()
|
||||
const req = buildOidbRequest(0xED3, 1, data)
|
||||
await this.sendPacket(req.cmd, req.data)
|
||||
}
|
||||
|
||||
async groupSign(groupCode: string) {
|
||||
this.check()
|
||||
const data = Oidb.Oidb_0xEB7_1.encode({
|
||||
body: {
|
||||
uin: selfInfo.uin,
|
||||
groupCode
|
||||
}
|
||||
}).finish()
|
||||
const req = buildOidbRequest(0xEB7, 1, data)
|
||||
await this.sendPacket(req.cmd, req.data)
|
||||
}
|
||||
|
||||
async setGroupSpecialTitle(groupCode: number, uid: string, title: string) {
|
||||
this.check()
|
||||
const data = Oidb.Oidb_0X8FC_2.encode({
|
||||
groupCode,
|
||||
body: {
|
||||
targetUid: uid,
|
||||
specialTitle: title,
|
||||
expiredTime: -1,
|
||||
uinName: title
|
||||
}
|
||||
}).finish()
|
||||
const req = buildOidbRequest(0X8FC, 2, data, false)
|
||||
await this.sendPacket(req.cmd, req.data)
|
||||
}
|
||||
}
|
||||
|
||||
function buildOidbRequest(cmd: number, subCmd: number, body: Uint8Array, reserved = true) {
|
||||
const data = Oidb.Base.encode({
|
||||
command: cmd,
|
||||
subCommand: subCmd,
|
||||
body,
|
||||
isReserved: reserved ? 1 : 0
|
||||
}).finish()
|
||||
return {
|
||||
cmd: `OidbSvcTrpcTcp.0x${cmd.toString(16).toUpperCase()}_${subCmd}`,
|
||||
data: Buffer.from(data).toString('hex')
|
||||
}
|
||||
}
|
35
src/ntqqapi/native/moehoo/version.ts
Normal file
35
src/ntqqapi/native/moehoo/version.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import os from 'os'
|
||||
import offset from '@/ntqqapi/helper/offset.json'
|
||||
import { getFullVersion } from '@/common/utils'
|
||||
|
||||
function getSupportVersions() {
|
||||
let fullVersionStart: string = ''
|
||||
switch (os.platform()) {
|
||||
case 'linux':
|
||||
fullVersionStart = '3'
|
||||
break
|
||||
case 'darwin':
|
||||
fullVersionStart = '6'
|
||||
break
|
||||
case 'win32':
|
||||
fullVersionStart = '9'
|
||||
break
|
||||
}
|
||||
const supportVersions: string[] = []
|
||||
for (const offsetKey in offset) {
|
||||
if (offsetKey.startsWith(fullVersionStart) && offsetKey.endsWith(os.arch())) {
|
||||
supportVersions.push(offsetKey)
|
||||
}
|
||||
}
|
||||
return supportVersions
|
||||
}
|
||||
|
||||
export function checkSupportVersion(){
|
||||
// 检查当前 QQ 版本是否支持,不支持则抛出异常
|
||||
const qqFullVersion = getFullVersion() // todo: 去除llqqnt依赖
|
||||
const _ = offset[qqFullVersion + '-' + os.arch()]
|
||||
if (!_) {
|
||||
const supportVersion = getSupportVersions()
|
||||
throw new Error('当前 QQ 版本不支持, 只支持: ' + supportVersion.join(', '))
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17
src/ntqqapi/native/napcat-protocol-packet/index.d.ts
vendored
Normal file
17
src/ntqqapi/native/napcat-protocol-packet/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
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>;
|
||||
}
|
3067
src/ntqqapi/native/napcat-protocol-packet/index.mjs
Normal file
3067
src/ntqqapi/native/napcat-protocol-packet/index.mjs
Normal file
File diff suppressed because one or more lines are too long
1
src/ntqqapi/native/napcat-protocol-packet/wrapper-session/index.d.ts
vendored
Normal file
1
src/ntqqapi/native/napcat-protocol-packet/wrapper-session/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function initWrapperSession(): Promise<any>;
|
6
src/ntqqapi/native/napcat-protocol-packet/wrapper-session/types.d.ts
vendored
Normal file
6
src/ntqqapi/native/napcat-protocol-packet/wrapper-session/types.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface MsgService {
|
||||
sendSsoCmdReqByContend: (cmd: string, trace_id: string) => Promise<unknown>;
|
||||
}
|
||||
export type WrapperSession = {
|
||||
getMsgService(): MsgService;
|
||||
};
|
@@ -1,6 +1,6 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { hookApiCallbacks, registerReceiveHook, removeReceiveHook } from './hook'
|
||||
import { getBuildVersion, log } from '../common/utils'
|
||||
import { log } from '../common/utils'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import {
|
||||
GeneralCallResult,
|
||||
@@ -29,7 +29,8 @@ export enum NTClass {
|
||||
SKEY_API = 'ns-SkeyApi',
|
||||
GROUP_HOME_WORK = 'ns-GroupHomeWork',
|
||||
GROUP_ESSENCE = 'ns-GroupEssence',
|
||||
NODE_STORE_API = 'ns-NodeStoreApi'
|
||||
NODE_STORE_API = 'ns-NodeStoreApi',
|
||||
QQ_EX_API = 'ns-QQEXApi',
|
||||
}
|
||||
|
||||
export enum NTMethod {
|
||||
@@ -108,13 +109,26 @@ interface InvokeOptions<ReturnType> {
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
let channel: NTChannel
|
||||
|
||||
function getChannel() {
|
||||
if (channel) {
|
||||
return channel
|
||||
}
|
||||
if (ipcMain.eventNames().includes(NTChannel.IPC_UP_2)) {
|
||||
return channel = NTChannel.IPC_UP_2
|
||||
} else {
|
||||
return channel = NTChannel.IPC_UP_3
|
||||
}
|
||||
}
|
||||
|
||||
export function invoke<
|
||||
R extends Awaited<ReturnType<Extract<NTService[S][M], (...args: any) => unknown>>>,
|
||||
S extends keyof NTService = any,
|
||||
M extends keyof NTService[S] & string = any
|
||||
>(method: Extract<unknown, `${S}/${M}`> | string, args: unknown[], options: InvokeOptions<R> = {}) {
|
||||
const className = options.className ?? NTClass.NT_API
|
||||
const channel = options.channel ?? getBuildVersion() >= 28788 ? NTChannel.IPC_UP_3 : NTChannel.IPC_UP_2
|
||||
const channel = options.channel ?? getChannel()
|
||||
const timeout = options.timeout ?? 5000
|
||||
const afterFirstCmd = options.afterFirstCmd ?? true
|
||||
let eventName = className + '-' + channel[channel.length - 1]
|
||||
|
364
src/ntqqapi/proto/compiled.d.ts
vendored
364
src/ntqqapi/proto/compiled.d.ts
vendored
@@ -2186,3 +2186,367 @@ export namespace RichMedia {
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
}
|
||||
|
||||
/** Namespace Oidb. */
|
||||
export namespace Oidb {
|
||||
|
||||
/** Properties of a Base. */
|
||||
interface IBase {
|
||||
|
||||
/** Base command */
|
||||
command?: (number|null);
|
||||
|
||||
/** Base subCommand */
|
||||
subCommand?: (number|null);
|
||||
|
||||
/** Base errorCode */
|
||||
errorCode?: (number|null);
|
||||
|
||||
/** Base body */
|
||||
body?: (Uint8Array|null);
|
||||
|
||||
/** Base errorMsg */
|
||||
errorMsg?: (string|null);
|
||||
|
||||
/** Base isReserved */
|
||||
isReserved?: (number|null);
|
||||
}
|
||||
|
||||
/** Represents a Base. */
|
||||
class Base implements IBase {
|
||||
|
||||
/**
|
||||
* Constructs a new Base.
|
||||
* @param [properties] Properties to set
|
||||
*/
|
||||
constructor(properties?: Oidb.IBase);
|
||||
|
||||
/** Base command. */
|
||||
public command: number;
|
||||
|
||||
/** Base subCommand. */
|
||||
public subCommand: number;
|
||||
|
||||
/** Base errorCode. */
|
||||
public errorCode: number;
|
||||
|
||||
/** Base body. */
|
||||
public body: Uint8Array;
|
||||
|
||||
/** Base errorMsg. */
|
||||
public errorMsg?: (string|null);
|
||||
|
||||
/** Base isReserved. */
|
||||
public isReserved: number;
|
||||
|
||||
/**
|
||||
* Encodes the specified Base message. Does not implicitly {@link Oidb.Base.verify|verify} messages.
|
||||
* @param message Base message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encode(message: Oidb.IBase, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Decodes a Base message from the specified reader or buffer.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @param [length] Message length if known beforehand
|
||||
* @returns Base
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Oidb.Base;
|
||||
|
||||
/**
|
||||
* Gets the default type url for Base
|
||||
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns The default type url
|
||||
*/
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
/** Properties of an Oidb_0xED3_1. */
|
||||
interface IOidb_0xED3_1 {
|
||||
|
||||
/** Oidb_0xED3_1 uin */
|
||||
uin?: (number|null);
|
||||
|
||||
/** Oidb_0xED3_1 groupCode */
|
||||
groupCode?: (number|null);
|
||||
|
||||
/** Oidb_0xED3_1 friendUin */
|
||||
friendUin?: (number|null);
|
||||
|
||||
/** Oidb_0xED3_1 ext */
|
||||
ext?: (number|null);
|
||||
}
|
||||
|
||||
/** Represents an Oidb_0xED3_1. */
|
||||
class Oidb_0xED3_1 implements IOidb_0xED3_1 {
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0xED3_1.
|
||||
* @param [properties] Properties to set
|
||||
*/
|
||||
constructor(properties?: Oidb.IOidb_0xED3_1);
|
||||
|
||||
/** Oidb_0xED3_1 uin. */
|
||||
public uin: number;
|
||||
|
||||
/** Oidb_0xED3_1 groupCode. */
|
||||
public groupCode: number;
|
||||
|
||||
/** Oidb_0xED3_1 friendUin. */
|
||||
public friendUin: number;
|
||||
|
||||
/** Oidb_0xED3_1 ext. */
|
||||
public ext?: (number|null);
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0xED3_1 message. Does not implicitly {@link Oidb.Oidb_0xED3_1.verify|verify} messages.
|
||||
* @param message Oidb_0xED3_1 message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encode(message: Oidb.IOidb_0xED3_1, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0xED3_1 message from the specified reader or buffer.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @param [length] Message length if known beforehand
|
||||
* @returns Oidb_0xED3_1
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Oidb.Oidb_0xED3_1;
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0xED3_1
|
||||
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns The default type url
|
||||
*/
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
/** Properties of an Oidb_0xEB7_1. */
|
||||
interface IOidb_0xEB7_1 {
|
||||
|
||||
/** Oidb_0xEB7_1 body */
|
||||
body?: (Oidb.IOidb_0xEB7_1_Body|null);
|
||||
}
|
||||
|
||||
/** Represents an Oidb_0xEB7_1. */
|
||||
class Oidb_0xEB7_1 implements IOidb_0xEB7_1 {
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0xEB7_1.
|
||||
* @param [properties] Properties to set
|
||||
*/
|
||||
constructor(properties?: Oidb.IOidb_0xEB7_1);
|
||||
|
||||
/** Oidb_0xEB7_1 body. */
|
||||
public body?: (Oidb.IOidb_0xEB7_1_Body|null);
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0xEB7_1 message. Does not implicitly {@link Oidb.Oidb_0xEB7_1.verify|verify} messages.
|
||||
* @param message Oidb_0xEB7_1 message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encode(message: Oidb.IOidb_0xEB7_1, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0xEB7_1 message from the specified reader or buffer.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @param [length] Message length if known beforehand
|
||||
* @returns Oidb_0xEB7_1
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Oidb.Oidb_0xEB7_1;
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0xEB7_1
|
||||
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns The default type url
|
||||
*/
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
/** Properties of an Oidb_0xEB7_1_Body. */
|
||||
interface IOidb_0xEB7_1_Body {
|
||||
|
||||
/** Oidb_0xEB7_1_Body uin */
|
||||
uin?: (string|null);
|
||||
|
||||
/** Oidb_0xEB7_1_Body groupCode */
|
||||
groupCode?: (string|null);
|
||||
|
||||
/** Oidb_0xEB7_1_Body version */
|
||||
version?: (string|null);
|
||||
}
|
||||
|
||||
/** Represents an Oidb_0xEB7_1_Body. */
|
||||
class Oidb_0xEB7_1_Body implements IOidb_0xEB7_1_Body {
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0xEB7_1_Body.
|
||||
* @param [properties] Properties to set
|
||||
*/
|
||||
constructor(properties?: Oidb.IOidb_0xEB7_1_Body);
|
||||
|
||||
/** Oidb_0xEB7_1_Body uin. */
|
||||
public uin: string;
|
||||
|
||||
/** Oidb_0xEB7_1_Body groupCode. */
|
||||
public groupCode: string;
|
||||
|
||||
/** Oidb_0xEB7_1_Body version. */
|
||||
public version: string;
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0xEB7_1_Body message. Does not implicitly {@link Oidb.Oidb_0xEB7_1_Body.verify|verify} messages.
|
||||
* @param message Oidb_0xEB7_1_Body message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encode(message: Oidb.IOidb_0xEB7_1_Body, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0xEB7_1_Body message from the specified reader or buffer.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @param [length] Message length if known beforehand
|
||||
* @returns Oidb_0xEB7_1_Body
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Oidb.Oidb_0xEB7_1_Body;
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0xEB7_1_Body
|
||||
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns The default type url
|
||||
*/
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
/** Properties of an Oidb_0X8FC_2. */
|
||||
interface IOidb_0X8FC_2 {
|
||||
|
||||
/** Oidb_0X8FC_2 groupCode */
|
||||
groupCode?: (number|null);
|
||||
|
||||
/** Oidb_0X8FC_2 body */
|
||||
body?: (Oidb.IOidb_0X8FC_2_Body|null);
|
||||
}
|
||||
|
||||
/** Represents an Oidb_0X8FC_2. */
|
||||
class Oidb_0X8FC_2 implements IOidb_0X8FC_2 {
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0X8FC_2.
|
||||
* @param [properties] Properties to set
|
||||
*/
|
||||
constructor(properties?: Oidb.IOidb_0X8FC_2);
|
||||
|
||||
/** Oidb_0X8FC_2 groupCode. */
|
||||
public groupCode: number;
|
||||
|
||||
/** Oidb_0X8FC_2 body. */
|
||||
public body?: (Oidb.IOidb_0X8FC_2_Body|null);
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0X8FC_2 message. Does not implicitly {@link Oidb.Oidb_0X8FC_2.verify|verify} messages.
|
||||
* @param message Oidb_0X8FC_2 message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encode(message: Oidb.IOidb_0X8FC_2, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0X8FC_2 message from the specified reader or buffer.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @param [length] Message length if known beforehand
|
||||
* @returns Oidb_0X8FC_2
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Oidb.Oidb_0X8FC_2;
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0X8FC_2
|
||||
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns The default type url
|
||||
*/
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
/** Properties of an Oidb_0X8FC_2_Body. */
|
||||
interface IOidb_0X8FC_2_Body {
|
||||
|
||||
/** Oidb_0X8FC_2_Body targetUid */
|
||||
targetUid?: (string|null);
|
||||
|
||||
/** Oidb_0X8FC_2_Body specialTitle */
|
||||
specialTitle?: (string|null);
|
||||
|
||||
/** Oidb_0X8FC_2_Body expiredTime */
|
||||
expiredTime?: (number|null);
|
||||
|
||||
/** Oidb_0X8FC_2_Body uinName */
|
||||
uinName?: (string|null);
|
||||
|
||||
/** Oidb_0X8FC_2_Body targetName */
|
||||
targetName?: (string|null);
|
||||
}
|
||||
|
||||
/** Represents an Oidb_0X8FC_2_Body. */
|
||||
class Oidb_0X8FC_2_Body implements IOidb_0X8FC_2_Body {
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0X8FC_2_Body.
|
||||
* @param [properties] Properties to set
|
||||
*/
|
||||
constructor(properties?: Oidb.IOidb_0X8FC_2_Body);
|
||||
|
||||
/** Oidb_0X8FC_2_Body targetUid. */
|
||||
public targetUid: string;
|
||||
|
||||
/** Oidb_0X8FC_2_Body specialTitle. */
|
||||
public specialTitle: string;
|
||||
|
||||
/** Oidb_0X8FC_2_Body expiredTime. */
|
||||
public expiredTime: number;
|
||||
|
||||
/** Oidb_0X8FC_2_Body uinName. */
|
||||
public uinName: string;
|
||||
|
||||
/** Oidb_0X8FC_2_Body targetName. */
|
||||
public targetName: string;
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0X8FC_2_Body message. Does not implicitly {@link Oidb.Oidb_0X8FC_2_Body.verify|verify} messages.
|
||||
* @param message Oidb_0X8FC_2_Body message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encode(message: Oidb.IOidb_0X8FC_2_Body, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0X8FC_2_Body message from the specified reader or buffer.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @param [length] Message length if known beforehand
|
||||
* @returns Oidb_0X8FC_2_Body
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Oidb.Oidb_0X8FC_2_Body;
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0X8FC_2_Body
|
||||
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns The default type url
|
||||
*/
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
}
|
||||
|
@@ -5421,4 +5421,841 @@ export const RichMedia = $root.RichMedia = (() => {
|
||||
return RichMedia;
|
||||
})();
|
||||
|
||||
export const Oidb = $root.Oidb = (() => {
|
||||
|
||||
/**
|
||||
* Namespace Oidb.
|
||||
* @exports Oidb
|
||||
* @namespace
|
||||
*/
|
||||
const Oidb = {};
|
||||
|
||||
Oidb.Base = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a Base.
|
||||
* @memberof Oidb
|
||||
* @interface IBase
|
||||
* @property {number|null} [command] Base command
|
||||
* @property {number|null} [subCommand] Base subCommand
|
||||
* @property {number|null} [errorCode] Base errorCode
|
||||
* @property {Uint8Array|null} [body] Base body
|
||||
* @property {string|null} [errorMsg] Base errorMsg
|
||||
* @property {number|null} [isReserved] Base isReserved
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Base.
|
||||
* @memberof Oidb
|
||||
* @classdesc Represents a Base.
|
||||
* @implements IBase
|
||||
* @constructor
|
||||
* @param {Oidb.IBase=} [properties] Properties to set
|
||||
*/
|
||||
function Base(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Base command.
|
||||
* @member {number} command
|
||||
* @memberof Oidb.Base
|
||||
* @instance
|
||||
*/
|
||||
Base.prototype.command = 0;
|
||||
|
||||
/**
|
||||
* Base subCommand.
|
||||
* @member {number} subCommand
|
||||
* @memberof Oidb.Base
|
||||
* @instance
|
||||
*/
|
||||
Base.prototype.subCommand = 0;
|
||||
|
||||
/**
|
||||
* Base errorCode.
|
||||
* @member {number} errorCode
|
||||
* @memberof Oidb.Base
|
||||
* @instance
|
||||
*/
|
||||
Base.prototype.errorCode = 0;
|
||||
|
||||
/**
|
||||
* Base body.
|
||||
* @member {Uint8Array} body
|
||||
* @memberof Oidb.Base
|
||||
* @instance
|
||||
*/
|
||||
Base.prototype.body = $util.newBuffer([]);
|
||||
|
||||
/**
|
||||
* Base errorMsg.
|
||||
* @member {string|null|undefined} errorMsg
|
||||
* @memberof Oidb.Base
|
||||
* @instance
|
||||
*/
|
||||
Base.prototype.errorMsg = null;
|
||||
|
||||
/**
|
||||
* Base isReserved.
|
||||
* @member {number} isReserved
|
||||
* @memberof Oidb.Base
|
||||
* @instance
|
||||
*/
|
||||
Base.prototype.isReserved = 0;
|
||||
|
||||
// OneOf field names bound to virtual getters and setters
|
||||
let $oneOfFields;
|
||||
|
||||
// Virtual OneOf for proto3 optional field
|
||||
Object.defineProperty(Base.prototype, "_errorMsg", {
|
||||
get: $util.oneOfGetter($oneOfFields = ["errorMsg"]),
|
||||
set: $util.oneOfSetter($oneOfFields)
|
||||
});
|
||||
|
||||
/**
|
||||
* Encodes the specified Base message. Does not implicitly {@link Oidb.Base.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Oidb.Base
|
||||
* @static
|
||||
* @param {Oidb.IBase} message Base message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Base.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.command != null && Object.hasOwnProperty.call(message, "command"))
|
||||
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.command);
|
||||
if (message.subCommand != null && Object.hasOwnProperty.call(message, "subCommand"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.subCommand);
|
||||
if (message.errorCode != null && Object.hasOwnProperty.call(message, "errorCode"))
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.errorCode);
|
||||
if (message.body != null && Object.hasOwnProperty.call(message, "body"))
|
||||
writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.body);
|
||||
if (message.errorMsg != null && Object.hasOwnProperty.call(message, "errorMsg"))
|
||||
writer.uint32(/* id 5, wireType 2 =*/42).string(message.errorMsg);
|
||||
if (message.isReserved != null && Object.hasOwnProperty.call(message, "isReserved"))
|
||||
writer.uint32(/* id 12, wireType 0 =*/96).uint32(message.isReserved);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Base message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Oidb.Base
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Oidb.Base} Base
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Base.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Oidb.Base();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
message.command = reader.uint32();
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
message.subCommand = reader.uint32();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
message.errorCode = reader.uint32();
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
message.body = reader.bytes();
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
message.errorMsg = reader.string();
|
||||
break;
|
||||
}
|
||||
case 12: {
|
||||
message.isReserved = reader.uint32();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the default type url for Base
|
||||
* @function getTypeUrl
|
||||
* @memberof Oidb.Base
|
||||
* @static
|
||||
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns {string} The default type url
|
||||
*/
|
||||
Base.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
||||
if (typeUrlPrefix === undefined) {
|
||||
typeUrlPrefix = "type.googleapis.com";
|
||||
}
|
||||
return typeUrlPrefix + "/Oidb.Base";
|
||||
};
|
||||
|
||||
return Base;
|
||||
})();
|
||||
|
||||
Oidb.Oidb_0xED3_1 = (function() {
|
||||
|
||||
/**
|
||||
* Properties of an Oidb_0xED3_1.
|
||||
* @memberof Oidb
|
||||
* @interface IOidb_0xED3_1
|
||||
* @property {number|null} [uin] Oidb_0xED3_1 uin
|
||||
* @property {number|null} [groupCode] Oidb_0xED3_1 groupCode
|
||||
* @property {number|null} [friendUin] Oidb_0xED3_1 friendUin
|
||||
* @property {number|null} [ext] Oidb_0xED3_1 ext
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0xED3_1.
|
||||
* @memberof Oidb
|
||||
* @classdesc Represents an Oidb_0xED3_1.
|
||||
* @implements IOidb_0xED3_1
|
||||
* @constructor
|
||||
* @param {Oidb.IOidb_0xED3_1=} [properties] Properties to set
|
||||
*/
|
||||
function Oidb_0xED3_1(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Oidb_0xED3_1 uin.
|
||||
* @member {number} uin
|
||||
* @memberof Oidb.Oidb_0xED3_1
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xED3_1.prototype.uin = 0;
|
||||
|
||||
/**
|
||||
* Oidb_0xED3_1 groupCode.
|
||||
* @member {number} groupCode
|
||||
* @memberof Oidb.Oidb_0xED3_1
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xED3_1.prototype.groupCode = 0;
|
||||
|
||||
/**
|
||||
* Oidb_0xED3_1 friendUin.
|
||||
* @member {number} friendUin
|
||||
* @memberof Oidb.Oidb_0xED3_1
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xED3_1.prototype.friendUin = 0;
|
||||
|
||||
/**
|
||||
* Oidb_0xED3_1 ext.
|
||||
* @member {number|null|undefined} ext
|
||||
* @memberof Oidb.Oidb_0xED3_1
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xED3_1.prototype.ext = null;
|
||||
|
||||
// OneOf field names bound to virtual getters and setters
|
||||
let $oneOfFields;
|
||||
|
||||
// Virtual OneOf for proto3 optional field
|
||||
Object.defineProperty(Oidb_0xED3_1.prototype, "_ext", {
|
||||
get: $util.oneOfGetter($oneOfFields = ["ext"]),
|
||||
set: $util.oneOfSetter($oneOfFields)
|
||||
});
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0xED3_1 message. Does not implicitly {@link Oidb.Oidb_0xED3_1.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Oidb.Oidb_0xED3_1
|
||||
* @static
|
||||
* @param {Oidb.IOidb_0xED3_1} message Oidb_0xED3_1 message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Oidb_0xED3_1.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.uin != null && Object.hasOwnProperty.call(message, "uin"))
|
||||
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.uin);
|
||||
if (message.groupCode != null && Object.hasOwnProperty.call(message, "groupCode"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.groupCode);
|
||||
if (message.friendUin != null && Object.hasOwnProperty.call(message, "friendUin"))
|
||||
writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.friendUin);
|
||||
if (message.ext != null && Object.hasOwnProperty.call(message, "ext"))
|
||||
writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.ext);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0xED3_1 message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Oidb.Oidb_0xED3_1
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Oidb.Oidb_0xED3_1} Oidb_0xED3_1
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Oidb_0xED3_1.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Oidb.Oidb_0xED3_1();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
message.uin = reader.uint32();
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
message.groupCode = reader.uint32();
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
message.friendUin = reader.uint32();
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
message.ext = reader.uint32();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0xED3_1
|
||||
* @function getTypeUrl
|
||||
* @memberof Oidb.Oidb_0xED3_1
|
||||
* @static
|
||||
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns {string} The default type url
|
||||
*/
|
||||
Oidb_0xED3_1.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
||||
if (typeUrlPrefix === undefined) {
|
||||
typeUrlPrefix = "type.googleapis.com";
|
||||
}
|
||||
return typeUrlPrefix + "/Oidb.Oidb_0xED3_1";
|
||||
};
|
||||
|
||||
return Oidb_0xED3_1;
|
||||
})();
|
||||
|
||||
Oidb.Oidb_0xEB7_1 = (function() {
|
||||
|
||||
/**
|
||||
* Properties of an Oidb_0xEB7_1.
|
||||
* @memberof Oidb
|
||||
* @interface IOidb_0xEB7_1
|
||||
* @property {Oidb.IOidb_0xEB7_1_Body|null} [body] Oidb_0xEB7_1 body
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0xEB7_1.
|
||||
* @memberof Oidb
|
||||
* @classdesc Represents an Oidb_0xEB7_1.
|
||||
* @implements IOidb_0xEB7_1
|
||||
* @constructor
|
||||
* @param {Oidb.IOidb_0xEB7_1=} [properties] Properties to set
|
||||
*/
|
||||
function Oidb_0xEB7_1(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Oidb_0xEB7_1 body.
|
||||
* @member {Oidb.IOidb_0xEB7_1_Body|null|undefined} body
|
||||
* @memberof Oidb.Oidb_0xEB7_1
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xEB7_1.prototype.body = null;
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0xEB7_1 message. Does not implicitly {@link Oidb.Oidb_0xEB7_1.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Oidb.Oidb_0xEB7_1
|
||||
* @static
|
||||
* @param {Oidb.IOidb_0xEB7_1} message Oidb_0xEB7_1 message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Oidb_0xEB7_1.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.body != null && Object.hasOwnProperty.call(message, "body"))
|
||||
$root.Oidb.Oidb_0xEB7_1_Body.encode(message.body, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0xEB7_1 message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Oidb.Oidb_0xEB7_1
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Oidb.Oidb_0xEB7_1} Oidb_0xEB7_1
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Oidb_0xEB7_1.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Oidb.Oidb_0xEB7_1();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
message.body = $root.Oidb.Oidb_0xEB7_1_Body.decode(reader, reader.uint32());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0xEB7_1
|
||||
* @function getTypeUrl
|
||||
* @memberof Oidb.Oidb_0xEB7_1
|
||||
* @static
|
||||
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns {string} The default type url
|
||||
*/
|
||||
Oidb_0xEB7_1.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
||||
if (typeUrlPrefix === undefined) {
|
||||
typeUrlPrefix = "type.googleapis.com";
|
||||
}
|
||||
return typeUrlPrefix + "/Oidb.Oidb_0xEB7_1";
|
||||
};
|
||||
|
||||
return Oidb_0xEB7_1;
|
||||
})();
|
||||
|
||||
Oidb.Oidb_0xEB7_1_Body = (function() {
|
||||
|
||||
/**
|
||||
* Properties of an Oidb_0xEB7_1_Body.
|
||||
* @memberof Oidb
|
||||
* @interface IOidb_0xEB7_1_Body
|
||||
* @property {string|null} [uin] Oidb_0xEB7_1_Body uin
|
||||
* @property {string|null} [groupCode] Oidb_0xEB7_1_Body groupCode
|
||||
* @property {string|null} [version] Oidb_0xEB7_1_Body version
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0xEB7_1_Body.
|
||||
* @memberof Oidb
|
||||
* @classdesc Represents an Oidb_0xEB7_1_Body.
|
||||
* @implements IOidb_0xEB7_1_Body
|
||||
* @constructor
|
||||
* @param {Oidb.IOidb_0xEB7_1_Body=} [properties] Properties to set
|
||||
*/
|
||||
function Oidb_0xEB7_1_Body(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Oidb_0xEB7_1_Body uin.
|
||||
* @member {string} uin
|
||||
* @memberof Oidb.Oidb_0xEB7_1_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xEB7_1_Body.prototype.uin = "";
|
||||
|
||||
/**
|
||||
* Oidb_0xEB7_1_Body groupCode.
|
||||
* @member {string} groupCode
|
||||
* @memberof Oidb.Oidb_0xEB7_1_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xEB7_1_Body.prototype.groupCode = "";
|
||||
|
||||
/**
|
||||
* Oidb_0xEB7_1_Body version.
|
||||
* @member {string} version
|
||||
* @memberof Oidb.Oidb_0xEB7_1_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0xEB7_1_Body.prototype.version = "";
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0xEB7_1_Body message. Does not implicitly {@link Oidb.Oidb_0xEB7_1_Body.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Oidb.Oidb_0xEB7_1_Body
|
||||
* @static
|
||||
* @param {Oidb.IOidb_0xEB7_1_Body} message Oidb_0xEB7_1_Body message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Oidb_0xEB7_1_Body.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.uin != null && Object.hasOwnProperty.call(message, "uin"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.uin);
|
||||
if (message.groupCode != null && Object.hasOwnProperty.call(message, "groupCode"))
|
||||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.groupCode);
|
||||
if (message.version != null && Object.hasOwnProperty.call(message, "version"))
|
||||
writer.uint32(/* id 3, wireType 2 =*/26).string(message.version);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0xEB7_1_Body message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Oidb.Oidb_0xEB7_1_Body
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Oidb.Oidb_0xEB7_1_Body} Oidb_0xEB7_1_Body
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Oidb_0xEB7_1_Body.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Oidb.Oidb_0xEB7_1_Body();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
message.uin = reader.string();
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
message.groupCode = reader.string();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
message.version = reader.string();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0xEB7_1_Body
|
||||
* @function getTypeUrl
|
||||
* @memberof Oidb.Oidb_0xEB7_1_Body
|
||||
* @static
|
||||
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns {string} The default type url
|
||||
*/
|
||||
Oidb_0xEB7_1_Body.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
||||
if (typeUrlPrefix === undefined) {
|
||||
typeUrlPrefix = "type.googleapis.com";
|
||||
}
|
||||
return typeUrlPrefix + "/Oidb.Oidb_0xEB7_1_Body";
|
||||
};
|
||||
|
||||
return Oidb_0xEB7_1_Body;
|
||||
})();
|
||||
|
||||
Oidb.Oidb_0X8FC_2 = (function() {
|
||||
|
||||
/**
|
||||
* Properties of an Oidb_0X8FC_2.
|
||||
* @memberof Oidb
|
||||
* @interface IOidb_0X8FC_2
|
||||
* @property {number|null} [groupCode] Oidb_0X8FC_2 groupCode
|
||||
* @property {Oidb.IOidb_0X8FC_2_Body|null} [body] Oidb_0X8FC_2 body
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0X8FC_2.
|
||||
* @memberof Oidb
|
||||
* @classdesc Represents an Oidb_0X8FC_2.
|
||||
* @implements IOidb_0X8FC_2
|
||||
* @constructor
|
||||
* @param {Oidb.IOidb_0X8FC_2=} [properties] Properties to set
|
||||
*/
|
||||
function Oidb_0X8FC_2(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Oidb_0X8FC_2 groupCode.
|
||||
* @member {number} groupCode
|
||||
* @memberof Oidb.Oidb_0X8FC_2
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0X8FC_2.prototype.groupCode = 0;
|
||||
|
||||
/**
|
||||
* Oidb_0X8FC_2 body.
|
||||
* @member {Oidb.IOidb_0X8FC_2_Body|null|undefined} body
|
||||
* @memberof Oidb.Oidb_0X8FC_2
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0X8FC_2.prototype.body = null;
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0X8FC_2 message. Does not implicitly {@link Oidb.Oidb_0X8FC_2.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Oidb.Oidb_0X8FC_2
|
||||
* @static
|
||||
* @param {Oidb.IOidb_0X8FC_2} message Oidb_0X8FC_2 message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Oidb_0X8FC_2.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.groupCode != null && Object.hasOwnProperty.call(message, "groupCode"))
|
||||
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.groupCode);
|
||||
if (message.body != null && Object.hasOwnProperty.call(message, "body"))
|
||||
$root.Oidb.Oidb_0X8FC_2_Body.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0X8FC_2 message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Oidb.Oidb_0X8FC_2
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Oidb.Oidb_0X8FC_2} Oidb_0X8FC_2
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Oidb_0X8FC_2.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Oidb.Oidb_0X8FC_2();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
message.groupCode = reader.uint32();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
message.body = $root.Oidb.Oidb_0X8FC_2_Body.decode(reader, reader.uint32());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0X8FC_2
|
||||
* @function getTypeUrl
|
||||
* @memberof Oidb.Oidb_0X8FC_2
|
||||
* @static
|
||||
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns {string} The default type url
|
||||
*/
|
||||
Oidb_0X8FC_2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
||||
if (typeUrlPrefix === undefined) {
|
||||
typeUrlPrefix = "type.googleapis.com";
|
||||
}
|
||||
return typeUrlPrefix + "/Oidb.Oidb_0X8FC_2";
|
||||
};
|
||||
|
||||
return Oidb_0X8FC_2;
|
||||
})();
|
||||
|
||||
Oidb.Oidb_0X8FC_2_Body = (function() {
|
||||
|
||||
/**
|
||||
* Properties of an Oidb_0X8FC_2_Body.
|
||||
* @memberof Oidb
|
||||
* @interface IOidb_0X8FC_2_Body
|
||||
* @property {string|null} [targetUid] Oidb_0X8FC_2_Body targetUid
|
||||
* @property {string|null} [specialTitle] Oidb_0X8FC_2_Body specialTitle
|
||||
* @property {number|null} [expiredTime] Oidb_0X8FC_2_Body expiredTime
|
||||
* @property {string|null} [uinName] Oidb_0X8FC_2_Body uinName
|
||||
* @property {string|null} [targetName] Oidb_0X8FC_2_Body targetName
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Oidb_0X8FC_2_Body.
|
||||
* @memberof Oidb
|
||||
* @classdesc Represents an Oidb_0X8FC_2_Body.
|
||||
* @implements IOidb_0X8FC_2_Body
|
||||
* @constructor
|
||||
* @param {Oidb.IOidb_0X8FC_2_Body=} [properties] Properties to set
|
||||
*/
|
||||
function Oidb_0X8FC_2_Body(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Oidb_0X8FC_2_Body targetUid.
|
||||
* @member {string} targetUid
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.prototype.targetUid = "";
|
||||
|
||||
/**
|
||||
* Oidb_0X8FC_2_Body specialTitle.
|
||||
* @member {string} specialTitle
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.prototype.specialTitle = "";
|
||||
|
||||
/**
|
||||
* Oidb_0X8FC_2_Body expiredTime.
|
||||
* @member {number} expiredTime
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.prototype.expiredTime = 0;
|
||||
|
||||
/**
|
||||
* Oidb_0X8FC_2_Body uinName.
|
||||
* @member {string} uinName
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.prototype.uinName = "";
|
||||
|
||||
/**
|
||||
* Oidb_0X8FC_2_Body targetName.
|
||||
* @member {string} targetName
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @instance
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.prototype.targetName = "";
|
||||
|
||||
/**
|
||||
* Encodes the specified Oidb_0X8FC_2_Body message. Does not implicitly {@link Oidb.Oidb_0X8FC_2_Body.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @static
|
||||
* @param {Oidb.IOidb_0X8FC_2_Body} message Oidb_0X8FC_2_Body message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.targetUid != null && Object.hasOwnProperty.call(message, "targetUid"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.targetUid);
|
||||
if (message.specialTitle != null && Object.hasOwnProperty.call(message, "specialTitle"))
|
||||
writer.uint32(/* id 5, wireType 2 =*/42).string(message.specialTitle);
|
||||
if (message.expiredTime != null && Object.hasOwnProperty.call(message, "expiredTime"))
|
||||
writer.uint32(/* id 6, wireType 0 =*/48).sint32(message.expiredTime);
|
||||
if (message.uinName != null && Object.hasOwnProperty.call(message, "uinName"))
|
||||
writer.uint32(/* id 7, wireType 2 =*/58).string(message.uinName);
|
||||
if (message.targetName != null && Object.hasOwnProperty.call(message, "targetName"))
|
||||
writer.uint32(/* id 8, wireType 2 =*/66).string(message.targetName);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes an Oidb_0X8FC_2_Body message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Oidb.Oidb_0X8FC_2_Body} Oidb_0X8FC_2_Body
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Oidb.Oidb_0X8FC_2_Body();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
message.targetUid = reader.string();
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
message.specialTitle = reader.string();
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
message.expiredTime = reader.sint32();
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
message.uinName = reader.string();
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
message.targetName = reader.string();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the default type url for Oidb_0X8FC_2_Body
|
||||
* @function getTypeUrl
|
||||
* @memberof Oidb.Oidb_0X8FC_2_Body
|
||||
* @static
|
||||
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||
* @returns {string} The default type url
|
||||
*/
|
||||
Oidb_0X8FC_2_Body.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
||||
if (typeUrlPrefix === undefined) {
|
||||
typeUrlPrefix = "type.googleapis.com";
|
||||
}
|
||||
return typeUrlPrefix + "/Oidb.Oidb_0X8FC_2_Body";
|
||||
};
|
||||
|
||||
return Oidb_0X8FC_2_Body;
|
||||
})();
|
||||
|
||||
return Oidb;
|
||||
})();
|
||||
|
||||
export { $root as default };
|
||||
|
41
src/ntqqapi/proto/oidb.proto
Normal file
41
src/ntqqapi/proto/oidb.proto
Normal file
@@ -0,0 +1,41 @@
|
||||
syntax = "proto3";
|
||||
package Oidb;
|
||||
|
||||
message Base {
|
||||
uint32 command = 1;
|
||||
uint32 subCommand = 2;
|
||||
uint32 errorCode = 3;
|
||||
bytes body = 4;
|
||||
optional string errorMsg = 5;
|
||||
uint32 isReserved = 12;
|
||||
}
|
||||
|
||||
message Oidb_0xED3_1 {
|
||||
uint32 uin = 1;
|
||||
uint32 groupCode = 2;
|
||||
uint32 friendUin = 5;
|
||||
optional uint32 ext = 6;
|
||||
}
|
||||
|
||||
message Oidb_0xEB7_1 {
|
||||
Oidb_0xEB7_1_Body body = 2;
|
||||
}
|
||||
|
||||
message Oidb_0xEB7_1_Body {
|
||||
string uin = 1;
|
||||
string groupCode = 2;
|
||||
string version = 3;
|
||||
}
|
||||
|
||||
message Oidb_0X8FC_2 {
|
||||
uint32 groupCode = 1;
|
||||
Oidb_0X8FC_2_Body body = 3;
|
||||
}
|
||||
|
||||
message Oidb_0X8FC_2_Body {
|
||||
string targetUid = 1;
|
||||
string specialTitle = 5;
|
||||
sint32 expiredTime = 6;
|
||||
string uinName = 7;
|
||||
string targetName = 8;
|
||||
}
|
@@ -13,7 +13,7 @@ export interface NodeIKernelBuddyService {
|
||||
}[]
|
||||
}>
|
||||
|
||||
setBuddyRemark(arg: unknown): void
|
||||
setBuddyRemark(arg: unknown): Promise<GeneralCallResult>
|
||||
|
||||
isBuddy(uid: string): boolean
|
||||
|
||||
|
@@ -12,4 +12,6 @@ export interface NodeIKernelNodeMiscService {
|
||||
score: ''
|
||||
}[]
|
||||
}>
|
||||
|
||||
queryAutoRun(): Promise<boolean>
|
||||
}
|
||||
|
@@ -1,10 +1,3 @@
|
||||
export enum GroupListUpdateType {
|
||||
REFRESHALL,
|
||||
GETALL,
|
||||
MODIFIED,
|
||||
REMOVE
|
||||
}
|
||||
|
||||
export interface Group {
|
||||
groupCode: string
|
||||
maxMember: number
|
||||
@@ -188,3 +181,10 @@ export interface GroupBulletinListResult {
|
||||
nextIndex: number
|
||||
jointime: string
|
||||
}
|
||||
|
||||
export enum GroupMsgMask {
|
||||
AllowNotify = 1, // 允许提醒
|
||||
AllowNotNotify = 4, // 接受消息不提醒
|
||||
BoxNotNotify = 2, // 收进群助手不提醒
|
||||
NotAllow = 3, // 屏蔽
|
||||
}
|
||||
|
@@ -442,6 +442,7 @@ export interface RawMessage {
|
||||
attrType: number
|
||||
attrId: string
|
||||
}>
|
||||
isOnlineMsg: boolean
|
||||
}
|
||||
|
||||
export interface Peer {
|
||||
|
@@ -23,8 +23,8 @@ interface FileResponse {
|
||||
export class DownloadFile extends BaseAction<Payload, FileResponse> {
|
||||
actionName = ActionName.GoCQHTTP_DownloadFile
|
||||
payloadSchema = Schema.object({
|
||||
url: String,
|
||||
base64: String,
|
||||
url: Schema.string(),
|
||||
base64: Schema.string(),
|
||||
headers: Schema.union([String, Schema.array(String)])
|
||||
})
|
||||
|
||||
|
@@ -12,6 +12,7 @@ interface Payload {
|
||||
interface Response extends OB11User {
|
||||
reg_time: number
|
||||
long_nick: string
|
||||
city: string
|
||||
}
|
||||
|
||||
export class GetStrangerInfo extends BaseAction<Payload, Response> {
|
||||
@@ -33,7 +34,8 @@ export class GetStrangerInfo extends BaseAction<Payload, Response> {
|
||||
level: data.detail.commonExt.qqLevel && calcQQLevel(data.detail.commonExt.qqLevel) || 0,
|
||||
login_days: 0,
|
||||
reg_time: data.detail.commonExt.regTime,
|
||||
long_nick: data.detail.simpleInfo.baseInfo.longNick
|
||||
long_nick: data.detail.simpleInfo.baseInfo.longNick,
|
||||
city: data.detail.commonExt.city
|
||||
}
|
||||
} else {
|
||||
const data = await this.ctx.ntUserApi.getUserDetailInfoByUin(uin)
|
||||
@@ -46,7 +48,8 @@ export class GetStrangerInfo extends BaseAction<Payload, Response> {
|
||||
level: data.info.qqLevel && calcQQLevel(data.info.qqLevel) || 0,
|
||||
login_days: 0,
|
||||
reg_time: data.info.regTime,
|
||||
long_nick: data.info.longNick
|
||||
long_nick: data.info.longNick,
|
||||
city: data.info.city
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
src/onebot11/action/go-cqhttp/SendGroupSign.ts
Normal file
19
src/onebot11/action/go-cqhttp/SendGroupSign.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { selfInfo } from '@/common/globalVars'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
}
|
||||
|
||||
export class SendGroupSign extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_SendGroupSign
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
await this.ctx.app.packet.sendGroupSignPacket(selfInfo.uin, payload.group_id.toString())
|
||||
return null
|
||||
}
|
||||
}
|
30
src/onebot11/action/go-cqhttp/SetGroupSpecialTitle.ts
Normal file
30
src/onebot11/action/go-cqhttp/SetGroupSpecialTitle.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { selfInfo } from '@/common/globalVars'
|
||||
import { GroupMemberRole } from '@/ntqqapi/types'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
user_id: number | string
|
||||
special_title?: string
|
||||
}
|
||||
|
||||
export class SetGroupSpecialTitle extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_SetGroupSpecialTitle
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
user_id: Schema.union([Number, String]).required(),
|
||||
special_title: Schema.string()
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString(), payload.group_id.toString())
|
||||
if (!uid) throw new Error(`用户${payload.user_id}的uid获取失败`)
|
||||
const self = await this.ctx.ntGroupApi.getGroupMember(payload.group_id.toString(), selfInfo.uid, false)
|
||||
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 || "")
|
||||
return null
|
||||
}
|
||||
}
|
@@ -78,6 +78,13 @@ import { GroupPoke } from './llonebot/GroupPoke'
|
||||
import { FriendPoke } from './llonebot/FriendPoke'
|
||||
import { GetGroupFileSystemInfo } from './go-cqhttp/GetGroupFileSystemInfo'
|
||||
import { GetCredentials } from './system/GetCredentials'
|
||||
import { SetGroupSpecialTitle } from '@/onebot11/action/go-cqhttp/SetGroupSpecialTitle'
|
||||
import { SendGroupSign } from '@/onebot11/action/go-cqhttp/SendGroupSign'
|
||||
import { SetRestart } from '@/onebot11/action/system/SetRestart'
|
||||
import { SetFriendCategory } from '@/onebot11/action/llonebot/SetFriendCategory'
|
||||
import { SetFriendRemark } from '@/onebot11/action/llonebot/SetFriendRemark'
|
||||
import { SetGroupMsgMask } from '@/onebot11/action/llonebot/SetGroupMsgMask'
|
||||
import { SetGroupRemark } from '@/onebot11/action/llonebot/SetGroupRemark'
|
||||
|
||||
export function initActionMap(adapter: Adapter) {
|
||||
const actionHandlers = [
|
||||
@@ -98,6 +105,10 @@ export function initActionMap(adapter: Adapter) {
|
||||
new GetRobotUinRange(adapter),
|
||||
new GroupPoke(adapter),
|
||||
new FriendPoke(adapter),
|
||||
new SetFriendCategory(adapter),
|
||||
new SetFriendRemark(adapter),
|
||||
new SetGroupMsgMask(adapter),
|
||||
new SetGroupRemark(adapter),
|
||||
// onebot11
|
||||
new SendLike(adapter),
|
||||
new GetMsg(adapter),
|
||||
@@ -131,6 +142,7 @@ export function initActionMap(adapter: Adapter) {
|
||||
new ForwardFriendSingleMsg(adapter),
|
||||
new ForwardGroupSingleMsg(adapter),
|
||||
new GetCredentials(adapter),
|
||||
new SetRestart(adapter),
|
||||
// go-cqhttp
|
||||
new GetEssenceMsgList(adapter),
|
||||
new GetGroupHonorInfo(adapter),
|
||||
@@ -161,6 +173,8 @@ export function initActionMap(adapter: Adapter) {
|
||||
new DeleteFriend(adapter),
|
||||
new OCRImage(adapter),
|
||||
new GetGroupFileSystemInfo(adapter),
|
||||
new SetGroupSpecialTitle(adapter),
|
||||
new SendGroupSign(adapter),
|
||||
]
|
||||
const actionMap = new Map()
|
||||
for (const action of actionHandlers) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { getBuildVersion } from '@/common/utils'
|
||||
|
||||
interface Payload {
|
||||
user_id: number | string
|
||||
@@ -13,13 +13,12 @@ export class FriendPoke extends BaseAction<Payload, null> {
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!this.ctx.app.native.checkPlatform()) {
|
||||
throw new Error('当前系统平台或架构不支持')
|
||||
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
|
||||
await this.ctx.app.packet.sendPokePacket(+payload.user_id)
|
||||
}
|
||||
if (!this.ctx.app.native.checkVersion()) {
|
||||
throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 27333—27597`)
|
||||
else{
|
||||
await this.ctx.app.native.sendFriendPoke(+payload.user_id)
|
||||
}
|
||||
await this.ctx.app.native.sendFriendPoke(+payload.user_id)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { getBuildVersion } from '@/common/utils/misc'
|
||||
import { getBuildVersion } from '@/common/utils'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
@@ -15,13 +15,12 @@ export class GroupPoke extends BaseAction<Payload, null> {
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!this.ctx.app.native.checkPlatform()) {
|
||||
throw new Error('当前系统平台或架构不支持')
|
||||
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
|
||||
await this.ctx.app.packet.sendPokePacket(+payload.user_id, +payload.group_id)
|
||||
}
|
||||
if (!this.ctx.app.native.checkVersion()) {
|
||||
throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 27333—27597`)
|
||||
else{
|
||||
await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
|
||||
}
|
||||
await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
21
src/onebot11/action/llonebot/SetFriendCategory.ts
Normal file
21
src/onebot11/action/llonebot/SetFriendCategory.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
user_id: number | string
|
||||
category_id: number | string
|
||||
}
|
||||
|
||||
export class SetFriendCategory extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetFriendCategory
|
||||
payloadSchema = Schema.object({
|
||||
user_id: Schema.union([Number, String]).required(),
|
||||
category_id: Schema.union([Number, String]).required()
|
||||
})
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString())
|
||||
if (!uid) throw new Error('无法获取好友信息')
|
||||
return this.ctx.ntFriendApi.setBuddyCategory(uid, +payload.category_id)
|
||||
}
|
||||
}
|
21
src/onebot11/action/llonebot/SetFriendRemark.ts
Normal file
21
src/onebot11/action/llonebot/SetFriendRemark.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
user_id: number | string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export class SetFriendRemark extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetFriendRemark
|
||||
payloadSchema = Schema.object({
|
||||
user_id: Schema.union([Number, String]).required(),
|
||||
remark: Schema.string()
|
||||
})
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString())
|
||||
if (!uid) throw new Error('无法获取好友信息')
|
||||
return this.ctx.ntFriendApi.setBuddyRemark(uid, payload.remark || '')
|
||||
}
|
||||
}
|
19
src/onebot11/action/llonebot/SetGroupMsgMask.ts
Normal file
19
src/onebot11/action/llonebot/SetGroupMsgMask.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
mask: number | string // 1, 2, 3, 4
|
||||
}
|
||||
|
||||
export class SetGroupMsgMask extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetGroupMsgMask
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
mask: Schema.union([Number, String]).required()
|
||||
})
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
return this.ctx.ntGroupApi.setGroupMsgMask(payload.group_id.toString(), +payload.mask)
|
||||
}
|
||||
}
|
15
src/onebot11/action/llonebot/SetGroupRemark.ts
Normal file
15
src/onebot11/action/llonebot/SetGroupRemark.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { BaseAction } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
|
||||
interface Payload {
|
||||
group_id: string,
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export class SetGroupRemark extends BaseAction<Payload, unknown> {
|
||||
actionName = ActionName.SetGroupRemark
|
||||
|
||||
protected async _handle(payload: Payload): Promise<unknown>{
|
||||
return this.ctx.ntGroupApi.setGroupRemark(payload.group_id.toString(), payload.remark)
|
||||
}
|
||||
}
|
@@ -7,62 +7,52 @@ import { ChatCacheListItemBasic, CacheFileType } from '@/ntqqapi/types'
|
||||
export default class CleanCache extends BaseAction<void, void> {
|
||||
actionName = ActionName.CleanCache
|
||||
|
||||
protected _handle(): Promise<void> {
|
||||
return new Promise<void>(async (res, rej) => {
|
||||
try {
|
||||
// dbUtil.clearCache()
|
||||
const cacheFilePaths: string[] = []
|
||||
protected async _handle(): Promise<void> {
|
||||
const cacheFilePaths: string[] = []
|
||||
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(false)
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(false)
|
||||
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getHotUpdateCachePath())
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getDesktopTmpPath())
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getHotUpdateCachePath())
|
||||
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getDesktopTmpPath())
|
||||
|
||||
const list = await this.ctx.ntFileCacheApi.getCacheSessionPathList()
|
||||
list.forEach((e) => cacheFilePaths.push(e.value))
|
||||
const list = await this.ctx.ntFileCacheApi.getCacheSessionPathList()
|
||||
list.forEach((e) => cacheFilePaths.push(e.value))
|
||||
|
||||
// await NTQQApi.addCacheScannedPaths(); // XXX: 调用就崩溃,原因目前还未知
|
||||
const cacheScanResult = await this.ctx.ntFileCacheApi.scanCache()
|
||||
const cacheSize = parseInt(cacheScanResult.size[6])
|
||||
// await NTQQApi.addCacheScannedPaths(); // XXX: 调用就崩溃,原因目前还未知
|
||||
const cacheScanResult = await this.ctx.ntFileCacheApi.scanCache()
|
||||
const cacheSize = parseInt(cacheScanResult.size[6])
|
||||
|
||||
if (cacheScanResult.result !== 0) {
|
||||
throw 'Something went wrong while scanning cache. Code: ' + cacheScanResult.result
|
||||
}
|
||||
if (cacheScanResult.result !== 0) {
|
||||
throw 'Something went wrong while scanning cache. Code: ' + cacheScanResult.result
|
||||
}
|
||||
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(true)
|
||||
if (cacheSize > 0 && cacheFilePaths.length > 2) {
|
||||
// 存在缓存文件且大小不为 0 时执行清理动作
|
||||
// await NTQQApi.clearCache([ 'tmp', 'hotUpdate', ...cacheScanResult ]) // XXX: 也是调用就崩溃,调用 fs 删除得了
|
||||
deleteCachePath(cacheFilePaths)
|
||||
}
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(true)
|
||||
if (cacheSize > 0 && cacheFilePaths.length > 2) {
|
||||
// 存在缓存文件且大小不为 0 时执行清理动作
|
||||
// await NTQQApi.clearCache([ 'tmp', 'hotUpdate', ...cacheScanResult ]) // XXX: 也是调用就崩溃,调用 fs 删除得了
|
||||
deleteCachePath(cacheFilePaths)
|
||||
}
|
||||
|
||||
// 获取聊天记录列表
|
||||
// NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关
|
||||
// const privateChatCache = await getCacheList(ChatType.friend); // 私聊消息
|
||||
// const groupChatCache = await getCacheList(ChatType.group); // 群聊消息
|
||||
// const chatCacheList = [ ...privateChatCache, ...groupChatCache ];
|
||||
const chatCacheList: ChatCacheListItemBasic[] = []
|
||||
// 获取聊天记录列表
|
||||
// NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关
|
||||
// const privateChatCache = await getCacheList(ChatType.friend); // 私聊消息
|
||||
// const groupChatCache = await getCacheList(ChatType.group); // 群聊消息
|
||||
// const chatCacheList = [ ...privateChatCache, ...groupChatCache ];
|
||||
const chatCacheList: ChatCacheListItemBasic[] = []
|
||||
|
||||
// 获取聊天缓存文件列表
|
||||
const cacheFileList: string[] = []
|
||||
// 获取聊天缓存文件列表
|
||||
const cacheFileList: string[] = []
|
||||
|
||||
for (const name in CacheFileType) {
|
||||
if (!isNaN(parseInt(name))) continue
|
||||
for (const name in CacheFileType) {
|
||||
if (!isNaN(parseInt(name))) continue
|
||||
|
||||
const fileTypeAny: any = CacheFileType[name]
|
||||
const fileType: CacheFileType = fileTypeAny
|
||||
const fileType = CacheFileType[name] as unknown as CacheFileType
|
||||
|
||||
cacheFileList.push(...(await this.ctx.ntFileCacheApi.getFileCacheInfo(fileType)).infos.map((file) => file.fileKey))
|
||||
}
|
||||
cacheFileList.push(...(await this.ctx.ntFileCacheApi.getFileCacheInfo(fileType)).infos.map((file) => file.fileKey))
|
||||
}
|
||||
|
||||
// 一并清除
|
||||
await this.ctx.ntFileCacheApi.clearChatCache(chatCacheList, cacheFileList)
|
||||
res()
|
||||
} catch (e) {
|
||||
console.error('清理缓存时发生了错误')
|
||||
rej(e)
|
||||
}
|
||||
})
|
||||
// 一并清除
|
||||
await this.ctx.ntFileCacheApi.clearChatCache(chatCacheList, cacheFileList)
|
||||
}
|
||||
}
|
||||
|
||||
|
10
src/onebot11/action/system/SetRestart.ts
Normal file
10
src/onebot11/action/system/SetRestart.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { BaseAction } from '@/onebot11/action/BaseAction'
|
||||
import { ActionName } from '@/onebot11/action/types'
|
||||
|
||||
export class SetRestart extends BaseAction<null, void> {
|
||||
actionName = ActionName.SetRestart
|
||||
|
||||
protected async _handle() {
|
||||
await this.ctx.ntSystemApi.restart()
|
||||
}
|
||||
}
|
@@ -29,6 +29,10 @@ export enum ActionName {
|
||||
GetRobotUinRange = 'get_robot_uin_range',
|
||||
GroupPoke = 'group_poke',
|
||||
FriendPoke = 'friend_poke',
|
||||
SetFriendRemark = 'set_friend_remark',
|
||||
SetFriendCategory = 'set_friend_category',
|
||||
SetGroupMsgMask = 'set_group_msg_mask',
|
||||
SetGroupRemark = 'set_group_remark',
|
||||
// onebot 11
|
||||
SendLike = 'send_like',
|
||||
GetLoginInfo = 'get_login_info',
|
||||
@@ -47,6 +51,7 @@ export enum ActionName {
|
||||
SetGroupLeave = 'set_group_leave',
|
||||
GetVersionInfo = 'get_version_info',
|
||||
GetStatus = 'get_status',
|
||||
SetRestart = 'set_restart',
|
||||
CanSendRecord = 'can_send_record',
|
||||
CanSendImage = 'can_send_image',
|
||||
SetGroupKick = 'set_group_kick',
|
||||
@@ -91,4 +96,6 @@ export enum ActionName {
|
||||
GoCQHTTP_DeleteFriend = 'delete_friend',
|
||||
GoCQHTTP_OCRImage = 'ocr_image',
|
||||
GoCQHTTP_GetGroupFileSystemInfo = 'get_group_file_system_info',
|
||||
GoCQHTTP_SetGroupSpecialTitle = 'set_group_special_title',
|
||||
GoCQHTTP_SendGroupSign = 'send_group_sign',
|
||||
}
|
||||
|
@@ -221,7 +221,7 @@ export class MessageEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
async generate(content: any[]) {
|
||||
async generate(content: OB11MessageData[]) {
|
||||
await this.render(content)
|
||||
return {
|
||||
multiMsgItems: [{
|
||||
|
@@ -11,6 +11,10 @@ function isEmpty(value: unknown) {
|
||||
}
|
||||
|
||||
async function onSettingWindowCreated(view: Element) {
|
||||
console.log(view)
|
||||
if (!view){
|
||||
return
|
||||
}
|
||||
const config = await window.llonebot.getConfig()
|
||||
const ob11Config = { ...config.ob11 }
|
||||
|
||||
@@ -247,7 +251,9 @@ async function onSettingWindowCreated(view: Element) {
|
||||
} else {
|
||||
errDom?.classList.add('show')
|
||||
}
|
||||
errCodeDom!.innerHTML = errMsg
|
||||
if (errCodeDom) {
|
||||
errCodeDom.innerHTML = errMsg
|
||||
}
|
||||
}
|
||||
showError().then()
|
||||
|
||||
@@ -456,8 +462,8 @@ async function onSettingWindowCreated(view: Element) {
|
||||
}
|
||||
window.llonebot.checkVersion().then(checkVersionFunc)
|
||||
window.addEventListener('beforeunload', () => {
|
||||
window.llonebot.getConfig().then(oldConfig=>{
|
||||
if(JSON.stringify(oldConfig) !== JSON.stringify(config)){
|
||||
window.llonebot.getConfig().then(oldConfig => {
|
||||
if (JSON.stringify(oldConfig) !== JSON.stringify(config)) {
|
||||
window.llonebot.setConfig(true, config)
|
||||
}
|
||||
})
|
||||
|
@@ -91,7 +91,7 @@ class SatoriAdapter extends Service {
|
||||
input.subMsgType === 12 &&
|
||||
input.elements[0]?.grayTipElement?.xmlElement?.templId === '10382'
|
||||
) {
|
||||
|
||||
// 机器人被表情回应
|
||||
}
|
||||
else {
|
||||
// 普通的消息
|
||||
|
@@ -1 +1 @@
|
||||
export const version = '4.1.2'
|
||||
export const version = '4.3.2'
|
||||
|
Reference in New Issue
Block a user