import gradio as gr from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext, CallbackQueryHandler import logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) def start(update: Update, context: CallbackContext) -> None: update.message.reply_text('Welcome Sir.') def handle_message(update: Update, context: CallbackContext) -> None: user = update.message.from_user if user.username == 'Mohammed_Alakhras': if update.message.document: context.bot.send_document(chat_id=update.message.chat_id, document=update.message.document.file_id, caption='معاينة', thumb='a.png') else: update.message.reply_text('Only The Admin Can Use this Bot./n@Mohammed_Alakhras') context.bot.forward_message(chat_id='@Mohammed_Alakhras', from_chat_id=update.message.chat_id, message_id=update.message.message_id) def handle_callback(update: Update, context: CallbackContext) -> None: query = update.callback_query query.answer() query.edit_message_text(text=f"Selected option: {query.data}") def main() -> None: updater = Updater("5782912329:AAEIcqsSUpuLxYtIk8RMsZgDYviUlQZ3zso", use_context=True) dispatcher = updater.dispatcher dispatcher.add_handler(CommandHandler("start", start)) dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, handle_message)) dispatcher.add_handler(CallbackQueryHandler(handle_callback)) updater.start_polling() updater.idle() def run_bot(): main() inputs = [] output = "text" gr.Interface(fn=main, inputs=inputs, outputs=run_bot).launch()