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

Function start

clone_plugins/commands.py:45–101  ·  view source on GitHub ↗
(client, message)

Source from the content-addressed store, hash-verified

43
44@Client.on_message(filters.command("start") & filters.incoming)
45async def start(client, message):
46 me = await client.get_me()
47 if not await clonedb.is_user_exist(me.id, message.from_user.id):
48 await clonedb.add_user(me.id, message.from_user.id)
49 if len(message.command) != 2:
50 buttons = [[
51 InlineKeyboardButton('💝 sᴜʙsᴄʀɪʙᴇ ᴍʏ ʏᴏᴜᴛᴜʙᴇ ᴄʜᴀɴɴᴇʟ', url='https://youtube.com/@Tech_VJ')
52 ],[
53 InlineKeyboardButton('🤖 ᴄʀᴇᴀᴛᴇ ʏᴏᴜʀ ᴏᴡɴ ᴄʟᴏɴᴇ ʙᴏᴛ', url=f'https://t.me/{BOT_USERNAME}?start=clone')
54 ],[
55 InlineKeyboardButton('💁‍♀️ ʜᴇʟᴘ', callback_data='help'),
56 InlineKeyboardButton('ᴀʙᴏᴜᴛ 🔻', callback_data='about')
57 ]]
58 reply_markup = InlineKeyboardMarkup(buttons)
59 await message.reply_photo(
60 photo=random.choice(PICS),
61 caption=script.CLONE_START_TXT.format(message.from_user.mention, me.mention),
62 reply_markup=reply_markup
63 )
64 return
65
66# Don't Remove Credit Tg - @VJ_Bots
67# Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ
68# Ask Doubt on telegram @KingVJ01
69
70 data = message.command[1]
71 try:
72 pre, file_id = data.split('_', 1)
73 except:
74 file_id = data
75 pre = ""
76
77 pre, file_id = ((base64.urlsafe_b64decode(data + "=" * (-len(data) % 4))).decode("ascii")).split("_", 1)
78 try:
79 msg = await client.send_cached_media(
80 chat_id=message.from_user.id,
81 file_id=file_id,
82 protect_content=True if pre == 'filep' else False,
83 )
84 filetype = msg.media
85 file = getattr(msg, filetype.value)
86 title = '@VJ_Bots ' + ' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@'), file.file_name.split()))
87 size=get_size(file.file_size)
88 f_caption = f"<code>{title}</code>"
89 if CUSTOM_FILE_CAPTION:
90 try:
91 f_caption=CUSTOM_FILE_CAPTION.format(file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='')
92 except:
93 return
94 await msg.edit_caption(f_caption)
95 k = await msg.reply(f"<b><u>❗️❗️❗️IMPORTANT❗️️❗️❗️</u></b>\n\nThis Movie File/Video will be deleted in <b><u>{AUTO_DELETE} mins</u> 🫥 <i></b>(Due to Copyright Issues)</i>.\n\n<b><i>Please forward this File/Video to your Saved Messages and Start Download there</i></b>",quote=True)
96 await asyncio.sleep(AUTO_DELETE_TIME)
97 await msg.delete()
98 await k.edit_text("<b>Your File/Video is successfully deleted!!!</b>")
99 return
100 except:
101 pass
102

Callers

nothing calls this directly

Calls 3

get_sizeFunction · 0.70
is_user_existMethod · 0.45
add_userMethod · 0.45

Tested by

no test coverage detected