It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
ReloadWhen turned on automatically changes
the theme color on reload.
When turned on automatically changes
the theme color every 5 sec.
Maintenance helps you to enable or disable maintenance mode in your Telegram bot. It allows you to pause bot functions for updates, testing, or troubleshooting. The mode status is saved in MongoDB so it stays active even after a restart. Only the admin can use this command to manage bot availability.
Follow the below steps to maintenance feature in any Repo.
1. Create a new file name 'maintenance.py'.
from pyrogram import Client, filters from pyrogram.types import Message from config import ADMIN, DB_URI, DB_NAME from motor.motor_asyncio import AsyncIOMotorClient # MongoDB setup mongo_client = AsyncIOMotorClient(DB_URI) db = mongo_client[DB_NAME] settings_col = db["settings"] # --- DB Helpers --- async def get_maintenance() -> bool: data = await settings_col.find_one({"_id": "maintenance"}) return data.get("status", False) if data else False async def set_maintenance(status: bool): await settings_col.update_one( {"_id": "maintenance"}, {"$set": {"status": status}}, upsert=True ) # --- Command --- @Client.on_message(filters.command("maintenance") & filters.user(ADMIN)) async def maintenance_cmd(_, m: Message): args = m.text.split(maxsplit=1) if len(args) < 2: return await m.reply("Usage: /maintenance [on/off]") status = args[1].lower() if status == "on": if await get_maintenance(): return await m.reply("⚠️ Maintenance mode is already enabled.") await set_maintenance(True) return await m.reply("✅ Maintenance mode **enabled**.") elif status == "off": if not await get_maintenance(): return await m.reply("⚠️ Maintenance mode is already disabled.") await set_maintenance(False) return await m.reply("❌ Maintenance mode **disabled**.") else: await m.reply("Invalid status. Use 'on' or 'off'.")
2. Now add this code in your main function of bot & don't forget to import necessary modules.
if await get_maintenance() and message.from_user.id != ADMIN: await message.delete() return await message.reply_text("**🛠️ Bot is Under Maintenance**", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Support", user_id=int(ADMIN))]]))
Note: Change functions names according to your repository.
Copying the post and using it without permission is strictly prohibited.