import asyncio from flask import Flask from threading import Thread import random import time import requests import logging # uvloop is optional, but it's recommended to install it for better performance of pyrogram try: import uvloop except: print("uvloop is not installed") from pyrogram import Client from config import API_ID, API_HASH, BOT_TOKEN, REPL_URL app = Flask("") @app.route("/") def home(): return "You have found the home of a Python program!" def run(): app.run() if __name__ == '__main__': # Setting up uvloop try: uvloop.install() except: print("Could not apply uvloop on project") # Defining path to plugins plugins = dict(root="plugins") # Defining the pyrogram client's instance bot = Client("UploadBot", api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN, plugins=plugins) # Set webhook bot.set_webhook(url=f"https://manishx-genatoz.hf.space/{BOT_TOKEN}") # Start the flask app in a separate thread flask_thread = Thread(target=run) flask_thread.start() # Start the bot bot.start() bot.idle()