from pyrogram import Client, filters from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, ForceReply from helper.database import user_stats_update CMD = ["/"] @Client.on_message(filters.command("caption", CMD) & filters.private) async def caption_cmd(client, message): if not message.reply_to_message: return await message.reply_text("Reply to a file, video, or audio with /caption to instantly change its caption!") if len(message.command) < 2: return await message.reply_text("Please provide the new caption text.\n\nExample: /caption My New Cool Caption") new_caption = message.text.split(None, 1)[1] msg = await message.reply_text("🚀 Processing...") try: await client.copy_message( chat_id=message.chat.id, from_chat_id=message.chat.id, message_id=message.reply_to_message.id, caption=new_caption ) await msg.delete() user_stats_update(message.from_user.id, 0) except Exception as e: await msg.edit(f"❌ Error: {e}") @Client.on_callback_query(filters.regex('^instant_caption$')) async def instant_caption_cb(client, query): await query.message.delete() await query.message.reply_text( "Please Enter The New Caption...", reply_to_message_id=query.message.reply_to_message.id, reply_markup=ForceReply(True) ) print("Instant Caption Plugin Loaded!")