-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
29 lines (24 loc) · 1.12 KB
/
bot.py
File metadata and controls
29 lines (24 loc) · 1.12 KB
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
import os
from dotenv import load_dotenv
from telegram import Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackContext
from handlers.registrations import start, handle_contact
from handlers.chat import chat_with_gemini
from handlers.image_analysis import analyze_file
from handlers.translate import translate_text
from handlers.web_search import web_search
from handlers.translate import translate_text
load_dotenv()
TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
def main():
application = Application.builder().token(TOKEN).build()
application.add_handler(CommandHandler("start", start))
application.add_handler(MessageHandler(filters.CONTACT, handle_contact))
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, chat_with_gemini))
application.add_handler(MessageHandler(filters.PHOTO | filters.Document.ALL, analyze_file))
application.add_handler(CommandHandler("websearch", web_search))
application.add_handler(CommandHandler("translate", translate_text))
print("Bot running")
application.run_polling()
if __name__ == "__main__":
main()