forked from tginfo/translator-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.ts
31 lines (26 loc) · 733 Bytes
/
bot.ts
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
27
28
29
30
31
import * as log from "@std/log";
import { Bot } from "grammy/mod.ts";
import { hydrateFiles } from "grammy_files/mod.ts";
import { Context } from "./utils.ts";
import handlers from "./handlers/mod.ts";
import env from "./env.ts";
const bot = new Bot<Context>(env.BOT_TOKEN);
bot.catch(({ error }) => log.warning(String(error)));
bot.api.config.use(hydrateFiles(bot.token));
bot.use(handlers);
export const start = () =>
bot.start({
drop_pending_updates: true,
onStart: () => {
log.info("The bot is running.");
},
allowed_updates: [
"callback_query",
"channel_post",
"chat_member",
"edited_channel_post",
"edited_message",
"inline_query",
"message",
],
});