File size: 1,618 Bytes
134fc6f 6df05a9 134fc6f 6df05a9 134fc6f |
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 |
#!/usr/bin/env python3
from logging import basicConfig, INFO, getLogger
from os import getenv
from dotenv import load_dotenv
from pyrogram import Client, filters
basicConfig(level=INFO, format="[%(levelname)s] %(asctime)s - %(message)s")
log = getLogger(__name__)
load_dotenv('.env', override=True)
API_ID = int(getenv("API_ID", 0))
API_HASH = getenv("API_HASH")
BOT_TOKEN = getenv('BOT_TOKEN')
if BOT_TOKEN:
try:
bot = Client("TgBotStadtus", api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)
except Exception as e:
log.warning(e)
exit(1)
@bot.on_message(filters.channel & (filters.document | filters.video))
async def change_caption(client, message):
# Add your logic here to handle the message
if message.video:
hash = message.video.file_unique_id[:6]
elif message.document:
hash = message.document.file_unique_id[:6]
l = f"""Fast Download Link:\n <a href='https://f2l.mrprincebotz.workers.dev/{message.chat.id}?id={message.id}&hash={hash}'>Dᴏᴡɴʟᴏᴀᴅ Hᴇʀᴇ</a>\n"""
h=message.caption
# Extracting duration from the string h
duration_start = h.find("Dᴜʀᴀᴛɪᴏɴ:") + len("Dᴜʀᴀᴛɪᴏɴ:")
duration_end = h.find("\n", duration_start)
duration = h[duration_start:duration_end]
# Combining strings h, duration, and l
combined_message = f"{h[:duration_end]}\n\n{l}Uᴘʟᴏᴀᴅᴇᴅ ʙʏ <a href='http://t.me/TeamMrPrince'>🔥 TᴇᴀᴍMʀPʀɪɴᴄᴇ 🔥</a>"
print(combined_message)
await message.edit_caption(combined_message)
if __name__ == '__main__':
bot.run()
|