MCPcopy Index your code
hub / github.com/CodeXBotz/File-Sharing-Bot / link_generator

Function link_generator

plugins/link_generator.py:44–60  ·  view source on GitHub ↗
(client: Client, message: Message)

Source from the content-addressed store, hash-verified

42
43@Bot.on_message(filters.private & filters.user(ADMINS) & filters.command('genlink'))
44async def link_generator(client: Client, message: Message):
45 while True:
46 try:
47 channel_message = await client.ask(text = "Forward Message from the DB Channel (with Quotes)..\nor Send the DB Channel Post link", chat_id = message.from_user.id, filters=(filters.forwarded | (filters.text & ~filters.forwarded)), timeout=60)
48 except:
49 return
50 msg_id = await get_message_id(client, channel_message)
51 if msg_id:
52 break
53 else:
54 await channel_message.reply("❌ Error\n\nthis Forwarded Post is not from my DB Channel or this Link is not taken from DB Channel", quote = True)
55 continue
56
57 base64_string = await encode(f"get-{msg_id * abs(client.db_channel.id)}")
58 link = f"https://t.me/{client.username}?start={base64_string}"
59 reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
60 await channel_message.reply_text(f"<b>Here is your link</b>\n\n{link}", quote=True, reply_markup=reply_markup)

Callers

nothing calls this directly

Calls 2

get_message_idFunction · 0.90
encodeFunction · 0.90

Tested by

no test coverage detected