RenameBot / plugins /caption_cmds.py
Thaimozhi
Initial bot upload
5d668bd
Raw History Blame Contribute Delete
2.5 kB
from pyrogram import Client, filters
from pyrogram.types import Message
from helper.database import codeflixbots
@Client.on_message(filters.command("set_caption") & filters.private)
async def set_caption(client, message):
if len(message.command) == 1:
return await message.reply_text("Usage: `/set_caption [your custom caption template]`")
caption = message.text.split(" ", 1)[1]
await codeflixbots.set_caption(message.chat.id, caption)
await message.reply_text(f"**Caption set successfully:**\n\n{caption}")
@Client.on_message(filters.command("see_caption") & filters.private)
async def see_caption(client, message):
caption = await codeflixbots.get_caption(message.chat.id)
if caption:
await message.reply_text(f"**Your Current Caption Template:**\n\n{caption}")
else:
await message.reply_text("**You have not set any custom caption yet.**")
@Client.on_message(filters.command("del_caption") & filters.private)
async def del_caption(client, message):
await codeflixbots.set_caption(message.chat.id, None)
await message.reply_text("**Custom caption cleared!**")
@Client.on_message(filters.command("set_prefix") & filters.private)
async def set_prefix(client, message):
if len(message.command) == 1:
return await message.reply_text("Usage: `/set_prefix [your prefix text]`\nThis will be attached at the top of your custom caption.")
prefix = message.text.split(" ", 1)[1]
await codeflixbots.set_prefix(message.chat.id, prefix)
await message.reply_text(f"**Prefix set successfully:**\n\n{prefix}")
@Client.on_message(filters.command("del_prefix") & filters.private)
async def del_prefix(client, message):
await codeflixbots.set_prefix(message.chat.id, None)
await message.reply_text("**Custom prefix cleared!**")
@Client.on_message(filters.command("set_suffix") & filters.private)
async def set_suffix(client, message):
if len(message.command) == 1:
return await message.reply_text("Usage: `/set_suffix [your suffix text]`\nThis will be attached at the bottom of your custom caption.")
suffix = message.text.split(" ", 1)[1]
await codeflixbots.set_suffix(message.chat.id, suffix)
await message.reply_text(f"**Suffix set successfully:**\n\n{suffix}")
@Client.on_message(filters.command("del_suffix") & filters.private)
async def del_suffix(client, message):
await codeflixbots.set_suffix(message.chat.id, None)
await message.reply_text("**Custom suffix cleared!**")