envs
This commit is contained in:
@@ -198,8 +198,8 @@ app.get('/health', (req: Request, res: Response) => {
|
||||
});
|
||||
|
||||
// Error handler
|
||||
app.use((err: Error, req: Request, res: Response, next: any) => {
|
||||
console.error(err.stack);
|
||||
app.use((_err: Error, _req: Request, res: Response, _next: any) => {
|
||||
console.error(_err.stack);
|
||||
res.status(500).json({ error: 'Something went wrong!' });
|
||||
});
|
||||
|
||||
@@ -238,11 +238,16 @@ app.listen(port, () => {
|
||||
const botToken = process.env.TELEGRAM_BOT_TOKEN;
|
||||
const webAppUrl = process.env.WEB_APP_URL || `http://localhost:${port}`;
|
||||
|
||||
if (botToken) {
|
||||
const bot = new QuixoticBot(botToken, webAppUrl);
|
||||
console.log('🤖 Telegram bot started');
|
||||
if (botToken && botToken.length > 10) {
|
||||
try {
|
||||
new QuixoticBot(botToken, webAppUrl);
|
||||
console.log('🤖 Telegram bot started');
|
||||
} catch (error: any) {
|
||||
console.error('❌ Bot initialization failed:', error.message);
|
||||
console.warn('⚠️ Bot disabled due to error');
|
||||
}
|
||||
} else {
|
||||
console.warn('⚠️ TELEGRAM_BOT_TOKEN not found - bot will not start');
|
||||
console.warn('⚠️ TELEGRAM_BOT_TOKEN not found or invalid - bot will not start');
|
||||
}
|
||||
|
||||
export default app;
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user