MCPcopy Index your code
hub / github.com/TechifyBots/File-Stream-Bot / private_receive_handler

Function private_receive_handler

biisal/bot/plugins/stream.py:52–139  ·  view source on GitHub ↗
(c: Client, m: Message)

Source from the content-addressed store, hash-verified

50
51@StreamBot.on_message((filters.private) & (filters.document | filters.video | filters.audio | filters.photo) , group=4)
52async def private_receive_handler(c: Client, m: Message):
53 if not await db.is_user_exist(m.from_user.id):
54 await db.add_user(m.from_user.id)
55 await c.send_message(
56 Var.NEW_USER_LOG,
57 f"#𝐍𝐞𝐰𝐔𝐬𝐞𝐫\n\n**᚛› 𝐍𝐚𝐦𝐞 - [{m.from_user.first_name}](tg://user?id={m.from_user.id})**"
58 )
59 if Var.UPDATES_CHANNEL != "None":
60 try:
61 user = await c.get_chat_member(Var.UPDATES_CHANNEL, m.chat.id)
62 if user.status == "kicked":
63 await c.send_message(
64 chat_id=m.chat.id,
65 text="You are banned!\n\n Contact Developer [Rahul](https://telegram.me/CallOwnerBot) he will help you.",
66 disable_web_page_preview=True
67 )
68 return
69 except UserNotParticipant:
70 await c.send_photo(
71 chat_id=m.chat.id,
72 photo="https://graph.org/file/a8095ab3c9202607e78ad.jpg",
73 caption="""<b>ᴊᴏɪɴ ᴏᴜʀ ᴜᴘᴅᴀᴛᴇs ᴄʜᴀɴɴᴇʟ ᴛᴏ ᴜꜱᴇ ᴍᴇ</b>""",
74 reply_markup=InlineKeyboardMarkup(
75 [
76 [
77 InlineKeyboardButton("ᴊᴏɪɴ ɴᴏᴡ 🚩", url=f"https://telegram.me/{Var.UPDATES_CHANNEL}")
78 ]
79 ]
80 ),
81 )
82 return
83 except Exception as e:
84 await m.reply_text(e)
85 await c.send_message(
86 chat_id=m.chat.id,
87 text="sᴏᴍᴇᴛʜɪɴɢ ᴡᴇɴᴛ ᴡʀᴏɴɢ. ᴄᴏɴᴛᴀᴄᴛ ᴍʏ [ʙᴏss](https://telegram.me/CallOwnerBot)",
88 disable_web_page_preview=True
89 )
90 return
91 ban_chk = await db.is_banned(int(m.from_user.id))
92 if ban_chk == True:
93 return await m.reply(Var.BAN_ALERT)
94
95 try: # This is the outer try block
96 log_msg = await m.copy(chat_id=Var.BIN_CHANNEL)
97 stream_link = f"{Var.URL}watch/{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}"
98 online_link = f"{Var.URL}{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}"
99 try: # This is the inner try block
100 if Var.SHORTLINK:
101 stream = get_shortlink(stream_link)
102 download = get_shortlink(online_link)
103 else:
104 stream = stream_link
105 download = online_link
106 except Exception as e:
107 print(f"An error occurred: {e}")
108
109 a = await log_msg.reply_text(

Callers

nothing calls this directly

Calls 8

get_nameFunction · 0.90
get_hashFunction · 0.90
humanbytesFunction · 0.90
get_media_file_sizeFunction · 0.90
get_shortlinkFunction · 0.85
is_user_existMethod · 0.80
add_userMethod · 0.80
is_bannedMethod · 0.80

Tested by

no test coverage detected