This repository has been archived on 2025-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
2023-09-08 22:09:35 +03:00

28 lines
611 B
TypeScript

#!/usr/bin/env tsx
import { onShutdown } from "node-graceful-shutdown";
import { createBot } from "../index.js";
import { config } from "#root/config.js";
import { logger } from "#root/logger.js";
try {
const bot = createBot(config.BOT_TOKEN);
// Graceful shutdown
onShutdown(async () => {
logger.info("shutdown");
await bot.stop();
});
await bot.start({
onStart: ({ username }) =>
logger.info({
msg: "bot running...",
username,
}),
});
} catch (error) {
logger.error(error);
process.exit(1);
}