File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ import { bot } from "./services/telegraf.js";
44
55const app = express ( ) ;
66
7+ app . get ( "/" , ( req , res ) => {
8+ res . send ( "Hello World!" ) ;
9+ } ) ;
10+
711app . use ( cors ( ) ) ;
812app . use ( express . json ( ) ) ;
913
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ const BOT_USERNAME = process.env.BOT_USERNAME;
1010const LEARNVERSE_BASE_URL = process . env . LEARNVERSE_BASE_URL ;
1111const LEARNVERSE_API_BASE_URL = process . env . LEARNVERSE_API_BASE_URL ;
1212const NODE_ENV = process . env . NODE_ENV || "development" ;
13+ const TELEGRAM_BOT_BASE_URL = process . env . TELEGRAM_BOT_BASE_URL ;
1314
1415export {
1516 PORT ,
@@ -19,4 +20,5 @@ export {
1920 LEARNVERSE_BASE_URL ,
2021 LEARNVERSE_API_BASE_URL ,
2122 NODE_ENV ,
23+ TELEGRAM_BOT_BASE_URL ,
2224} ;
Original file line number Diff line number Diff line change 1+ import { NODE_ENV , TELEGRAM_BOT_BASE_URL } from "../config/config" ;
2+
3+ export function startSelfPing ( ) {
4+ if ( NODE_ENV !== "production" ) return ;
5+
6+ setInterval ( async ( ) => {
7+ try {
8+ const res = await fetch ( TELEGRAM_BOT_BASE_URL ) ;
9+ console . log ( `[KeepAlive] Pinged self: ${ res . status } ` ) ;
10+ } catch ( err ) {
11+ console . error ( "[KeepAlive] Ping failed:" , err ) ;
12+ }
13+ } , 1000 * 60 * 10 ) ;
14+ }
You can’t perform that action at this time.
0 commit comments