diff --git a/manifest.json b/manifest.json index 7ae2ecd..d7b4d39 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "manifest_version": 4, "type": "extension", - "name": "LLOneBot v3.24.3", + "name": "LLOneBot v3.24.4", "slug": "LLOneBot", "description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发, 不支持商店在线更新", - "version": "3.24.3", + "version": "3.24.4", "icon": "./icon.jpg", "authors": [ { diff --git a/src/common/utils/QQBasicInfo.ts b/src/common/utils/QQBasicInfo.ts index f5da846..9f49536 100644 --- a/src/common/utils/QQBasicInfo.ts +++ b/src/common/utils/QQBasicInfo.ts @@ -8,6 +8,8 @@ export const exePath = process.execPath; export const pkgInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'package.json'); let configVersionInfoPath; + + if (os.platform() !== 'linux') { configVersionInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'versions', 'config.json'); } else { diff --git a/src/common/utils/system.ts b/src/common/utils/system.ts index 77b5ea6..18e5d43 100644 --- a/src/common/utils/system.ts +++ b/src/common/utils/system.ts @@ -4,7 +4,7 @@ import path from 'node:path'; export const systemPlatform = os.platform(); export const cpuArch = os.arch(); export const systemVersion = os.release(); -export const hostname = os.hostname(); +// export const hostname = os.hostname(); // win7不支持 const homeDir = os.homedir(); export const downloadsPath = path.join(homeDir, 'Downloads'); export const systemName = os.type(); diff --git a/src/ntqqapi/native/crychic/index.ts b/src/ntqqapi/native/crychic/index.ts index 6de1418..a5ffa25 100644 --- a/src/ntqqapi/native/crychic/index.ts +++ b/src/ntqqapi/native/crychic/index.ts @@ -1,54 +1,58 @@ -import {log} from "../../../common/utils"; -import {NTQQApi} from "../../ntcall"; -import {cpModule} from "../cpmodule"; +import { log } from '../../../common/utils' +import { NTQQApi } from '../../ntcall' +import { cpModule } from '../cpmodule' type PokeHandler = (id: string, isGroup: boolean) => void type CrychicHandler = (event: string, id: string, isGroup: boolean) => void let pokeRecords: Record = {} -class Crychic{ - private crychic: any = undefined +class Crychic { + private crychic: any = undefined - loadNode(){ - if (!this.crychic){ - try { - cpModule('crychic'); - this.crychic = require("./crychic.node") - this.crychic.init() - }catch (e) { - log("crychic加载失败", e) - } + loadNode() { + if (!this.crychic) { + try { + cpModule('crychic') + this.crychic = require('./crychic.node') + this.crychic.init() + } catch (e) { + log('crychic加载失败', e) + } + } + } + + registerPokeHandler(fn: PokeHandler) { + this.registerHandler((event, id, isGroup) => { + if (event === 'poke') { + let existTime = pokeRecords[id] + if (existTime) { + if (Date.now() - existTime < 1500) { + return + } } - } - registerPokeHandler(fn: PokeHandler){ - this.registerHandler((event, id, isGroup)=>{ - if (event === "poke"){ - let existTime = pokeRecords[id] - if (existTime) { - if (Date.now() - existTime < 1500) { - return - } - } - pokeRecords[id] = Date.now() - fn(id, isGroup); - } - }) - } - registerHandler(fn: CrychicHandler){ - if (!this.crychic) return; - this.crychic.setCryHandler(fn) - } - sendFriendPoke(friendUid: string){ - if (!this.crychic) return; - this.crychic.sendFriendPoke(parseInt(friendUid)) - NTQQApi.fetchUnitedCommendConfig().then() - } - sendGroupPoke(groupCode: string, memberUin: string){ - if (!this.crychic) return; - this.crychic.sendGroupPoke(parseInt(memberUin), parseInt(groupCode)) - NTQQApi.fetchUnitedCommendConfig().then() - } + pokeRecords[id] = Date.now() + fn(id, isGroup) + } + }) + } + + registerHandler(fn: CrychicHandler) { + if (!this.crychic) return + this.crychic.setCryHandler(fn) + } + + sendFriendPoke(friendUid: string) { + if (!this.crychic) return + this.crychic.sendFriendPoke(parseInt(friendUid)) + NTQQApi.fetchUnitedCommendConfig().then() + } + + sendGroupPoke(groupCode: string, memberUin: string) { + if (!this.crychic) return + this.crychic.sendGroupPoke(parseInt(memberUin), parseInt(groupCode)) + NTQQApi.fetchUnitedCommendConfig().then() + } } export const crychic = new Crychic() \ No newline at end of file diff --git a/src/ntqqapi/native/moehook/hook.ts b/src/ntqqapi/native/moehook/hook.ts index c52c2d2..05392a6 100644 --- a/src/ntqqapi/native/moehook/hook.ts +++ b/src/ntqqapi/native/moehook/hook.ts @@ -30,4 +30,4 @@ class HookApi { } } -export const hookApi = new HookApi(); +// export const hookApi = new HookApi(); diff --git a/src/version.ts b/src/version.ts index c6ec41e..3a12035 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const version = '3.24.3' +export const version = '3.24.4'