Transfinity_bot / bot.py
Nurbot's picture
Upload 5 files
2638527 verified
import logging
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, ContextTypes
from core import analyze_image
from utils import is_admin
import os
BOT_ADMIN_ID = 7700105638 # Only this user can interact
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
if not is_admin(update):
return await update.message.reply_text("🚫 Access Denied.")
await update.message.reply_text("πŸ‘‹ Welcome to TRANSFINITY FINAL CORE v.ULTIMA Signal Bot!
Send a chart screenshot to get a signal.")
async def handle_image(update: Update, context: ContextTypes.DEFAULT_TYPE):
if not is_admin(update):
return await update.message.reply_text("🚫 You are not authorized.")
photo = update.message.photo[-1]
file = await photo.get_file()
file_path = f"{update.message.from_user.id}_chart.jpg"
await file.download_to_drive(file_path)
result = analyze_image(file_path)
os.remove(file_path)
await update.message.reply_text(result)
def main():
app = ApplicationBuilder().token("8030635730:AAER9ANB3hTW_nBH5dOSfaYfEgwssh_Kh0Y").build()
app.add_handler(CommandHandler("start", start))
app.add_handler(MessageHandler(filters.PHOTO, handle_image))
app.run_polling()
if __name__ == "__main__":
main()