-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (21 loc) · 754 Bytes
/
index.js
File metadata and controls
26 lines (21 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* eslint-disable no-console */
const { bot } = require("./bot");
const config = require("./bot/config/config");
const { startServer } = require("./bot/server");
if (!config.TELEGRAM_BOT_TOKEN) {
console.error("❗️ TELEGRAM_BOT_TOKEN is not set.");
}
(async () => {
try {
console.log("Launching bot...");
bot.launch();
console.log("🤖 Bot launched successfully");
startServer(config.PORT);
console.log(`✅ Server and Bot are LIVE on port ${config.PORT}`);
// Graceful shutdown
process.once("SIGINT", () => bot.stop("SIGINT"));
process.once("SIGTERM", () => bot.stop("SIGTERM"));
} catch (err) {
console.error("❗️ Failed to launch bot:", err);
}
})();