Spaces:
Running
Running
BinaryONe
commited on
Commit
·
513293c
1
Parent(s):
278d044
Callback Update
Browse files
FileStream/utils/FileProcessors/bot_utils.py
CHANGED
@@ -98,7 +98,6 @@ async def upload_type_func(file_info,replied_message):
|
|
98 |
user_id = file_info['user_id']
|
99 |
message_id = file_info['message_id']
|
100 |
"""
|
101 |
-
|
102 |
existing_file = await db.get_file_by_fileuniqueid_only(file_info['file']['file_unique_id'])
|
103 |
if existing_file :
|
104 |
|
@@ -110,31 +109,22 @@ async def upload_type_func(file_info,replied_message):
|
|
110 |
|
111 |
name = file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']
|
112 |
title, year = Get_Title_Year(name)
|
113 |
-
stream_text = LANG.STREAM_TEXT_Y.format(file_info['file']['file_name'],
|
114 |
-
reply_markup = InlineKeyboardMarkup([
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
InlineKeyboardButton(
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
InlineKeyboardButton(
|
123 |
-
"TEMPORARY",
|
124 |
-
callback_data=
|
125 |
-
f"tempup_{file_info['user_id']}_{file_info['message_id']}")
|
126 |
-
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
|
127 |
-
|
128 |
return reply_markup, stream_text
|
129 |
|
130 |
|
131 |
async def priv_func(file_name, file_size):
|
132 |
-
|
133 |
file_size = humanbytes(file_size)
|
134 |
stream_text = LANG.PRIV_FILE_RENAME.format(file_name, file_size)
|
135 |
-
reply_markup = InlineKeyboardMarkup(
|
136 |
-
[[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
|
137 |
-
|
138 |
return reply_markup, stream_text
|
139 |
|
140 |
|
@@ -151,24 +141,24 @@ async def gen_priv_file_link(_id):
|
|
151 |
|
152 |
if "video" in mime_type:
|
153 |
stream_text = LANG.STREAM_TEXT.format(file_name, file_size, stream_link, page_link, file_link)
|
154 |
-
reply_markup = InlineKeyboardMarkup(
|
155 |
-
[
|
156 |
-
|
157 |
-
|
158 |
],
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
164 |
else:
|
165 |
stream_text = LANG.STREAM_TEXT_X.format(file_name, file_size, stream_link,file_link)
|
166 |
reply_markup = InlineKeyboardMarkup(
|
167 |
[[InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)],
|
168 |
[
|
169 |
InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", url=file_link),
|
170 |
-
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
171 |
-
callback_data=f"msgdelpvt_{_id}")
|
172 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
|
173 |
return reply_markup, stream_text
|
174 |
|
@@ -195,8 +185,7 @@ async def gen_link(_id):
|
|
195 |
],
|
196 |
[
|
197 |
InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", url=file_link),
|
198 |
-
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
199 |
-
callback_data=f"msgdelpvt_{_id}")
|
200 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
|
201 |
else:
|
202 |
stream_text = LANG.STREAM_TEXT_X.format(file_name, file_size, stream_link,file_link)
|
@@ -256,10 +245,8 @@ async def is_channel_banned(bot, message):
|
|
256 |
await bot.edit_message_reply_markup(
|
257 |
chat_id=message.chat.id,
|
258 |
message_id=message.id,
|
259 |
-
reply_markup=InlineKeyboardMarkup(
|
260 |
-
|
261 |
-
)
|
262 |
-
)
|
263 |
return True
|
264 |
return False
|
265 |
|
|
|
98 |
user_id = file_info['user_id']
|
99 |
message_id = file_info['message_id']
|
100 |
"""
|
|
|
101 |
existing_file = await db.get_file_by_fileuniqueid_only(file_info['file']['file_unique_id'])
|
102 |
if existing_file :
|
103 |
|
|
|
109 |
|
110 |
name = file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']
|
111 |
title, year = Get_Title_Year(name)
|
112 |
+
stream_text = LANG.STREAM_TEXT_Y.format(file_info['file']['file_name'],title+" "+str(year),humanbytes(file_info['file']['file_size']))
|
113 |
+
reply_markup = InlineKeyboardMarkup([
|
114 |
+
[
|
115 |
+
InlineKeyboardButton("PUBLIC",callback_data=f"pubup_{file_info['user_id']}_{file_info['message_id']}"),
|
116 |
+
InlineKeyboardButton("PRIVATE",callback_data=f"privup_{file_info['user_id']}_{file_info['message_id']}"),
|
117 |
+
InlineKeyboardButton("TEMPORARY",callback_data=f"tempup_{file_info['user_id']}_{file_info['message_id']}")
|
118 |
+
],
|
119 |
+
[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
120 |
+
])
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
return reply_markup, stream_text
|
122 |
|
123 |
|
124 |
async def priv_func(file_name, file_size):
|
|
|
125 |
file_size = humanbytes(file_size)
|
126 |
stream_text = LANG.PRIV_FILE_RENAME.format(file_name, file_size)
|
127 |
+
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
|
|
|
|
|
128 |
return reply_markup, stream_text
|
129 |
|
130 |
|
|
|
141 |
|
142 |
if "video" in mime_type:
|
143 |
stream_text = LANG.STREAM_TEXT.format(file_name, file_size, stream_link, page_link, file_link)
|
144 |
+
reply_markup = InlineKeyboardMarkup([
|
145 |
+
[
|
146 |
+
InlineKeyboardButton("sᴛʀᴇᴀᴍ",url=page_link),
|
147 |
+
InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)
|
148 |
],
|
149 |
+
[
|
150 |
+
InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", url=file_link),
|
151 |
+
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelpvt_{_id}")
|
152 |
+
],
|
153 |
+
[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
154 |
+
])
|
155 |
else:
|
156 |
stream_text = LANG.STREAM_TEXT_X.format(file_name, file_size, stream_link,file_link)
|
157 |
reply_markup = InlineKeyboardMarkup(
|
158 |
[[InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)],
|
159 |
[
|
160 |
InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", url=file_link),
|
161 |
+
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelpvt_{_id}")
|
|
|
162 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
|
163 |
return reply_markup, stream_text
|
164 |
|
|
|
185 |
],
|
186 |
[
|
187 |
InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", url=file_link),
|
188 |
+
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelpvt_{_id}")
|
|
|
189 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
|
190 |
else:
|
191 |
stream_text = LANG.STREAM_TEXT_X.format(file_name, file_size, stream_link,file_link)
|
|
|
245 |
await bot.edit_message_reply_markup(
|
246 |
chat_id=message.chat.id,
|
247 |
message_id=message.id,
|
248 |
+
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(f"ᴄʜᴀɴɴᴇʟ ɪs ʙᴀɴɴᴇᴅ",callback_data="N/A")]]
|
249 |
+
))
|
|
|
|
|
250 |
return True
|
251 |
return False
|
252 |
|