sewter / bot.py
UNUSUALxd's picture
Update bot.py
79b9477 verified
Raw
History Blame Contribute Delete
1.2 kB
import threading
import http.server
import socketserver
from pyrogram import Client
from config import API_ID, API_HASH, BOT_TOKEN
# ==========================================
# SILENT HUGGING FACE KEEP-ALIVE SERVER
# ==========================================
def run_dummy_server():
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write(b"DevOps Shell Bot is Active!")
# Mute the HTTP logs to prevent log spam from UptimeRobot
def log_message(self, format, *args):
pass
with socketserver.TCPServer(("0.0.0.0", 7860), Handler) as httpd:
httpd.serve_forever()
threading.Thread(target=run_dummy_server, daemon=True).start()
# ==========================================
# PYROGRAM BOT INITIALIZATION
# ==========================================
if __name__ == "__main__":
app = Client(
"shell_bot",
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN,
plugins=dict(root="handlers")
)
print("๐Ÿš€ DevOps Shell Bot is starting...")
app.run()