Skip to content

Commit

Permalink
chore: 增加变量 TG_LOG_LEVEL
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Feb 29, 2024
1 parent c7368c5 commit b922788
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions main/src/client/Telegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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') {
Expand Down
1 change: 1 addition & 0 deletions main/src/controllers/ForwardController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions main/src/models/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
17 changes: 11 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b922788

Please sign in to comment.