Spaces:
Runtime error
Runtime error
File size: 1,448 Bytes
2638527 | 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 34 35 36 37 38 39 40 | 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()
|