File size: 2,495 Bytes
5d668bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 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!**")
|