BinaryONe commited on
Commit
caf84b9
·
1 Parent(s): cb8a6c1

Callback Update

Browse files
FileStream/Database/database.py CHANGED
@@ -20,6 +20,7 @@ class Database:
20
  self.files = self.db.Public_Files
21
  self.pfile = self.db.Private_Files
22
  self.web_upload = self.db.Web_Files
 
23
 
24
  #---------------------[ SCHEMAS ]------------------------------#
25
  #---------------------[ NEW USER ]---------------------#
 
20
  self.files = self.db.Public_Files
21
  self.pfile = self.db.Private_Files
22
  self.web_upload = self.db.Web_Files
23
+ self.web_upload = self.db.Temp_Files
24
 
25
  #---------------------[ SCHEMAS ]------------------------------#
26
  #---------------------[ NEW USER ]---------------------#
FileStream/bot/plugins/FileHandlers/callback.py CHANGED
@@ -106,6 +106,40 @@ async def cb_data(bot: Client, update: CallbackQuery):
106
  disable_web_page_preview=True,
107
  reply_markup=reply_markup,
108
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  elif usr_cmd[0] == "pubup":
110
  try:
111
  user_id = str(usr_cmd[1])
 
106
  disable_web_page_preview=True,
107
  reply_markup=reply_markup,
108
  )
109
+ elif usr_cmd[0] == "initialize":
110
+ try:
111
+ upload_type=str(usr_cmd[1])
112
+ user_id = str(usr_cmd[2])
113
+ message_id = int(usr_cmd[3])
114
+
115
+ await update.message.edit_text(
116
+ text=f"Please Choose The File Type",
117
+ parse_mode=ParseMode.HTML,
118
+ disable_web_page_preview=True,
119
+ reply_markup=InlineKeyboardMarkup([
120
+ [InlineKeyboardButton("Movie", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{instruction['user_id']}_{message_id}_Movie")],
121
+ [InlineKeyboardButton("WebSeries", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{instruction['user_id']}_{message_id}_WebSeries")],
122
+ [InlineKeyboardButton("Anime", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{instruction['user_id']}_{message_id}_Anime")],
123
+ [InlineKeyboardButton("Documentary", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{instruction['user_id']}_{message_id}_Documentary")],
124
+ [InlineKeyboardButton("Regular", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{instruction['user_id']}_{message_id}_Regular")],
125
+ [ InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
126
+ ]),
127
+ )
128
+ except FloodWait as e:
129
+ print(f"Sleeping for {str(e.value)}s")
130
+ await asyncio.sleep(e.value)
131
+ await FileStream.send_message(
132
+ chat_id=Telegram.ULOG_GROUP,
133
+ text=
134
+ f"Gᴏᴛ FʟᴏᴏᴅWᴀɪᴛ ᴏғ {str(e.value)}s ғʀᴏᴍ [{message.from_user.first_name}](tg://user?id={message.from_user.id})\n\n**ᴜsᴇʀ ɪᴅ :** `{str(message.from_user.id)}`",
135
+ disable_web_page_preview=True,
136
+ parse_mode=ParseMode.MARKDOWN)
137
+ except Exception as e:
138
+ print(f"An error occurred: {str(e)}")
139
+ await FileStream.send_message(
140
+ chat_id=Telegram.ULOG_GROUP,
141
+ text=f"An error occurred: {str(e)}"
142
+ )
143
  elif usr_cmd[0] == "pubup":
144
  try:
145
  user_id = str(usr_cmd[1])
FileStream/bot/plugins/FileHandlers/stream.py CHANGED
@@ -65,19 +65,12 @@ async def private_receive_handler(bot: Client, message: Message):
65
 
66
  reply = await message.reply_text(LANG.PROCESSING_TEXT)
67
  file_info=get_file_info(message, instruction)
68
- await reply.edit_text(
69
- text=f"{file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']}",
70
- parse_mode=ParseMode.HTML,
71
- disable_web_page_preview=True,
72
- reply_markup=InlineKeyboardMarkup([
73
- [InlineKeyboardButton("Movie", callback_data=f"pubup_{instruction['user_id']}_{message.id}_Movie")],
74
- [InlineKeyboardButton("WebSeries", callback_data=f"pubup_{instruction['user_id']}_{message.id}_WebSeries")],
75
- [InlineKeyboardButton("Anime", callback_data=f"pubup_{instruction['user_id']}_{message.id}_Anime")],
76
- [InlineKeyboardButton("Documentary", callback_data=f"pubup_{instruction['user_id']}_{message.id}_Documentary")],
77
- [InlineKeyboardButton("Regular", callback_data=f"pubup_{instruction['user_id']}_{message.id}_Regular")],
78
- [ InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
79
- ]),
80
- )
81
  except FloodWait as e:
82
  print(f"Sleeping for {str(e.value)}s")
83
  await asyncio.sleep(e.value)
 
65
 
66
  reply = await message.reply_text(LANG.PROCESSING_TEXT)
67
  file_info=get_file_info(message, instruction)
68
+ reply_markup, stream_text = await upload_type_func(get_file_info(message, instruction))
69
+ await reply.edit_text(text=stream_text,
70
+ parse_mode=ParseMode.HTML,
71
+ disable_web_page_preview=True,
72
+ reply_markup=reply_markup,
73
+ quote=True)
 
 
 
 
 
 
 
74
  except FloodWait as e:
75
  print(f"Sleeping for {str(e.value)}s")
76
  await asyncio.sleep(e.value)
FileStream/utils/FileProcessors/bot_utils.py CHANGED
@@ -109,11 +109,11 @@ async def upload_type_func(file_info,replied_message):
109
  reply_markup = InlineKeyboardMarkup([[
110
  InlineKeyboardButton(
111
  "PUBLIC UPLOAD",
112
- callback_data=f"pubup_{file_info['user_id']}_{file_info['message_id']}_{replied_message}"),
113
  InlineKeyboardButton(
114
  "PRIVATE UPLOAD",
115
  callback_data=
116
- f"privup_{file_info['user_id']}_{file_info['message_id']}")
117
  ], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
118
 
119
  return reply_markup, stream_text
 
109
  reply_markup = InlineKeyboardMarkup([[
110
  InlineKeyboardButton(
111
  "PUBLIC UPLOAD",
112
+ callback_data=f"initialize_PUBLIC_{file_info['user_id']}_{file_info['message_id']}_{replied_message}"),
113
  InlineKeyboardButton(
114
  "PRIVATE UPLOAD",
115
  callback_data=
116
+ f"initialize_PRIVATE_{file_info['user_id']}_{file_info['message_id']}")
117
  ], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
118
 
119
  return reply_markup, stream_text