Spaces:
Running
Running
taslim19
Update devtools.py: add case-insensitive and flexible command triggers for userbot devtools
abc89fd
| """ | |
| Plugin to check Telegram username availability using the userbot. | |
| Command: /checkusername <username> | |
| """ | |
| from pyrogram import Client, filters | |
| from pyrogram.types import Message | |
| async def check_username_handler(client: Client, message: Message): | |
| if len(message.command) < 2: | |
| await message.reply_text("Please provide a username to check. Usage: /checkusername <username>") | |
| return | |
| username = message.command[1].strip().lower().replace("@", "") | |
| try: | |
| available = await client.check_username(username) | |
| if available: | |
| await message.reply_text(f"✅ The username '@{username}' is available!") | |
| else: | |
| await message.reply_text(f"❌ The username '@{username}' is already taken.") | |
| except Exception as e: | |
| await message.reply_text(f"⚠️ Error checking username: {e}") |