File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,22 @@ import { Bot } from "grammy";
22import { GenerateCommand } from "./service/command/generator" ;
33import { MessageCheck } from "./service/MessageCheck" ;
44import { Spam } from "./service/bot/spam" ;
5- import { groupJoin } from "./service/bot/groupJoin" ;
65import { Logger } from "./config/logger" ;
76import { db } from "./service/db" ;
8- const logger = new Logger ( { file : "app.log" , level : "info" } ) ;
7+ const logger = new Logger ( {
8+ file : "app.log" ,
9+ level : "info" ,
10+ timestampFormat : "locale" ,
11+ rotation : {
12+ enabled : true ,
13+ maxSize : 5 * 1024 * 1024 , // 5 MB
14+ maxFiles : 3 ,
15+ } ,
16+ errorHandling : {
17+ file : "error-app.log" ,
18+ console : true ,
19+ } ,
20+ } ) ;
921const bot = new Bot ( process . env . TELEGRAM_BOT_TOKEN ! ) ;
1022new GenerateCommand ( bot ) . generate ( ) ;
1123bot . on ( "message" , async ( ctx ) => {
@@ -23,7 +35,7 @@ bot.on("message", async (ctx) => {
2335 }
2436 }
2537} ) ;
26- bot . on ( "my_chat_member" , groupJoin ) ;
38+ bot . on ( "my_chat_member" , MessageCheck . initialGroup ) ;
2739( async ( ) => {
2840 try {
2941 await db . initialize ( ) ;
Original file line number Diff line number Diff line change 1+ import { Logger } from "../config/logger" ;
12import { SafeExecution } from "../decorators/SafeExecution" ;
23import { Middleware } from "./mid" ;
3-
4+ const logger = new Logger ( { file : "ActionFilter.log" , level : 'info' , timestampFormat : 'locale' } )
45export class ActionFilter extends Middleware {
56 @SafeExecution ( )
67 /**
@@ -28,7 +29,7 @@ export class ActionFilter extends Middleware {
2829 */
2930 async userInGroup ( ) : Promise < void > {
3031 const userId = this . ctx . message ?. reply_to_message ?. from ?. id ;
31-
32+
3233 if ( ! userId ) {
3334 await this . ctx . reply (
3435 "Unable to determine the user ID. Please ensure you are replying to a valid user." ,
You can’t perform that action at this time.
0 commit comments