Spaces:
Running
Running
| from pyrogram import Client, filters | |
| from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, ForceReply | |
| from helper.database import user_stats_update | |
| CMD = ["/"] | |
| async def caption_cmd(client, message): | |
| if not message.reply_to_message: | |
| return await message.reply_text("<b>Reply to a file, video, or audio with /caption <new caption text> to instantly change its caption!</b>") | |
| if len(message.command) < 2: | |
| return await message.reply_text("<b>Please provide the new caption text.</b>\n\nExample: <code>/caption My New Cool Caption</code>") | |
| new_caption = message.text.split(None, 1)[1] | |
| msg = await message.reply_text("π <b>Processing...</b>") | |
| 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"β <b>Error:</b> {e}") | |
| async def instant_caption_cb(client, query): | |
| await query.message.delete() | |
| await query.message.reply_text( | |
| "<b>Please Enter The New Caption...</b>", | |
| reply_to_message_id=query.message.reply_to_message.id, | |
| reply_markup=ForceReply(True) | |
| ) | |
| print("Instant Caption Plugin Loaded!") | |