From b922788792f9dff530df25f15cda3652c55ac5fb Mon Sep 17 00:00:00 2001 From: Clansty Date: Fri, 1 Mar 2024 03:47:04 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=E5=8F=98=E9=87=8F?= =?UTF-8?q?=20TG=5FLOG=5FLEVEL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/package.json | 2 +- main/src/client/Telegram.ts | 4 ++-- main/src/controllers/ForwardController.ts | 1 + main/src/models/env.ts | 1 + pnpm-lock.yaml | 17 +++++++++++------ 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/main/package.json b/main/package.json index ce69158b..3981d75f 100644 --- a/main/package.json +++ b/main/package.json @@ -39,7 +39,7 @@ "fastify": "^4.26.0", "file-type": "^19.0.0", "fluent-ffmpeg": "^2.1.2", - "icqq": "^0.6.8", + "icqq": "^0.6.10", "image-size": "^1.1.1", "lodash": "^4.17.21", "log4js": "^6.6.1", diff --git a/main/src/client/Telegram.ts b/main/src/client/Telegram.ts index e37ba4b7..2cd03a84 100644 --- a/main/src/client/Telegram.ts +++ b/main/src/client/Telegram.ts @@ -12,7 +12,7 @@ import TelegramChat from './TelegramChat'; import TelegramSession from '../models/TelegramSession'; import { LogLevel } from 'telegram/extensions/Logger'; import { BigInteger } from 'big-integer'; -import { EditMessageParams, IterMessagesParams } from 'telegram/client/messages'; +import { IterMessagesParams } from 'telegram/client/messages'; import { PromisedNetSockets, PromisedWebSockets } from 'telegram/extensions'; import { ConnectionTCPFull, ConnectionTCPObfuscated } from 'telegram/network'; import env from '../models/env'; @@ -62,7 +62,7 @@ export default class Telegram { connection: env.TG_CONNECTION === 'websocket' ? ConnectionTCPObfuscated : ConnectionTCPFull, }, ); - // this.client.logger.setLevel(LogLevel.WARN); + this.client.logger.setLevel(env.TG_LOG_LEVEL as LogLevel); } public static async create(startArgs: UserAuthParams | BotAuthParams, appName = 'Q2TG') { diff --git a/main/src/controllers/ForwardController.ts b/main/src/controllers/ForwardController.ts index 6f0c247f..160a5312 100644 --- a/main/src/controllers/ForwardController.ts +++ b/main/src/controllers/ForwardController.ts @@ -178,6 +178,7 @@ export default class ForwardController { private onQqPoke = async (event: FriendPokeEvent | GroupPokeEvent) => { const target = event.notice_type === 'friend' ? event.friend : event.group; const pair = this.instance.forwardPairs.find(target); + if (!pair) return; if ((pair?.flags | this.instance.flags) & flags.DISABLE_POKE) return; let operatorName: string, targetName: string; if (target instanceof Friend) { diff --git a/main/src/models/env.ts b/main/src/models/env.ts index 6d0c3ff5..956eb367 100644 --- a/main/src/models/env.ts +++ b/main/src/models/env.ts @@ -4,6 +4,7 @@ import path from 'path'; const configParsed = z.object({ DATA_DIR: z.string().default(path.resolve('./data')), OICQ_LOG_LEVEL: z.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal', 'mark', 'off']).default('warn'), + TG_LOG_LEVEL: z.enum(['none', 'error', 'warn', 'info', 'debug']).default('warn'), FFMPEG_PATH: z.string().optional(), FFPROBE_PATH: z.string().optional(), SIGN_API: z.string().url().optional(), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 841ac2c1..be6f7282 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,8 +60,8 @@ importers: specifier: ^2.1.2 version: 2.1.2 icqq: - specifier: ^0.6.8 - version: 0.6.8 + specifier: ^0.6.10 + version: 0.6.10 image-size: specifier: ^1.1.1 version: 1.1.1 @@ -91,7 +91,7 @@ importers: version: 0.2.2 telegram: specifier: https://github.com/clansty/gramjs/releases/download/2.19.10%2Brevert_media/telegram-2.19.10.tgz - version: '@github.com/clansty/gramjs/releases/download/2.19.10%25252525252525252525252Brevert_media/telegram-2.19.10.tgz' + version: '@github.com/clansty/gramjs/releases/download/2.19.10%252525252525252525252525252Brevert_media/telegram-2.19.10.tgz' tmp-promise: specifier: ^3.0.3 version: 3.0.3 @@ -3310,8 +3310,8 @@ packages: safer-buffer: 2.1.2 dev: false - /icqq@0.6.8: - resolution: {integrity: sha512-+Whg6gcxomNshRhij3vuEnjaO/8ODAzl3ZVda6KKwZtWTwuD23iX4pR57Kv7+VGw6Lp5fEGF6hjSxPHw9Rvqcg==} + /icqq@0.6.10: + resolution: {integrity: sha512-3LfK9r7WUnuVFyrVDH92DgFhsqNK/Itp91XJAD+DZHKEQK6UlR7F+xoEcpUIEfi9dy8GWqOgr5ZTunjd5GhMdA==} engines: {node: '>= v14'} deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. dependencies: @@ -3320,6 +3320,7 @@ packages: long: 4.0.0 pngjs: 6.0.0 probe-image-size: 7.2.3 + silk-wasm: 3.2.3 triptrap: 0.0.17 transitivePeerDependencies: - debug @@ -4711,6 +4712,10 @@ packages: cac: 6.7.14 dev: false + /silk-wasm@3.2.3: + resolution: {integrity: sha512-zZ3hgMpiPR6cFnKvCPgPpCwx6n5RoJCbEGIFlge2kAxAmgzBTf0b2F2xIPG5W4obUhQPQXXTTH074eGZJK01xw==} + dev: false + /simple-concat@1.0.1: resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} dev: false @@ -5611,7 +5616,7 @@ packages: - utf-8-validate dev: false - '@github.com/clansty/gramjs/releases/download/2.19.10%25252525252525252525252Brevert_media/telegram-2.19.10.tgz': + '@github.com/clansty/gramjs/releases/download/2.19.10%252525252525252525252525252Brevert_media/telegram-2.19.10.tgz': resolution: {tarball: https://github.com/clansty/gramjs/releases/download/2.19.10%2Brevert_media/telegram-2.19.10.tgz} name: telegram version: 2.19.10