|
|
|
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): |
|
|
|
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}">ᗪOᗯᑎᒪOᗩᗪ ᕼᗴᖇᗴ</a>\n""" |
|
h=message.caption |
|
|
|
duration_start = h.find("Dᴜʀᴀᴛɪᴏɴ:") + len("Dᴜʀᴀᴛɪᴏɴ:") |
|
duration_end = h.find("\n", duration_start) |
|
duration = h[duration_start:duration_end] |
|
|
|
|
|
combined_message = f"{h[:duration_end]}\n\n{l}\nUᴘʟᴏᴀᴅᴇᴅ ʙʏ 🔥 TᴇᴀᴍMʀPʀɪɴᴄᴇ 🔥" |
|
print(combined_message) |
|
await message.edit_caption(combined_message) |
|
|
|
|
|
if __name__ == '__main__': |
|
bot.run() |
|
|