-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
33 lines (22 loc) · 952 Bytes
/
app.py
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
32
33
import os
from telegram import Update
from telegram.ext import Application, ContextTypes, CommandHandler, MessageHandler, filters
from commands.translate.translate import translateCommand
from commands.start.start import startCommand
from commands.help.help import helpCommand
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("TOKEN")
async def error(update: Update, context: ContextTypes.DEFAULT_TYPE):
print("error", context.error)
def main():
app = Application.builder().token(TOKEN).build()
app.add_handler(CommandHandler('start', startCommand))
app.add_handler(CommandHandler('help', helpCommand))
app.add_handler(CommandHandler('tr', translateCommand))
app.add_handler(CommandHandler('translate', translateCommand))
# app.add_handler(MessageHandler(filters.TEXT, handleRequest))
app.add_error_handler(error)
print("[BOT] - status: running")
app.run_polling(poll_interval=3)
main()