MCPcopy Create free account
hub / github.com/VJBots/VJ-File-Store / gen_link_s

Function gen_link_s

clone_plugins/genlink.py:15–40  ·  view source on GitHub ↗
(client: Client, message)

Source from the content-addressed store, hash-verified

13
14@Client.on_message(filters.command(['link']))
15async def gen_link_s(client: Client, message):
16 replied = message.reply_to_message
17 if not replied:
18 return await message.reply('Reply to a message to get a shareable link.')
19 file_type = replied.media
20 if file_type not in [enums.MessageMediaType.VIDEO, enums.MessageMediaType.AUDIO, enums.MessageMediaType.DOCUMENT]:
21 return await message.reply("Reply to a supported media")
22
23# Don't Remove Credit Tg - @VJ_Bots
24# Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ
25# Ask Doubt on telegram @KingVJ01
26
27 file_id = getattr(replied, file_type.value).file_id
28 string = 'file_'
29 string += file_id
30 outstr = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=")
31 user_id = message.from_user.id
32 user = await get_user(user_id)
33 # Get the bot's username
34 bot_username = (await client.get_me()).username
35 share_link = f"https://t.me/{bot_username}?start={outstr}"
36 if user["shortener_api"]:
37 await message.reply(f"<b>⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🔗 ᴏʀɪɢɪɴᴀʟ ʟɪɴᴋ :- {share_link}</b>")
38 else:
39 short_link = await get_short_link(user, share_link)
40 await message.reply(f"<b>⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🖇️ sʜᴏʀᴛ ʟɪɴᴋ :- {short_link}</b>")
41
42
43# Don't Remove Credit Tg - @VJ_Bots

Callers

nothing calls this directly

Calls 2

get_userFunction · 0.90
get_short_linkFunction · 0.90

Tested by

no test coverage detected