Spaces:
Running
Running
BinaryONe
commited on
Commit
·
a7ff8c9
1
Parent(s):
0a0961c
changes In Upload
Browse files
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
|
@@ -131,6 +131,7 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 131 |
try:
|
| 132 |
user_id = str(usr_cmd[1])
|
| 133 |
message_id = int(usr_cmd[2])
|
|
|
|
| 134 |
message = await FileStream.get_messages(user_id, message_id)
|
| 135 |
instruction = {
|
| 136 |
"privacy_type": "PUBLIC",
|
|
@@ -139,7 +140,8 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 139 |
}
|
| 140 |
file_caption = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 141 |
file_name = get_name(message)
|
| 142 |
-
print("
|
|
|
|
| 143 |
await FileStream.delete_messages(
|
| 144 |
chat_id=user_id,
|
| 145 |
message_ids=message_id
|
|
@@ -152,13 +154,13 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 152 |
allows_multiple_answers=True,
|
| 153 |
chat_id=user_id
|
| 154 |
)
|
| 155 |
-
|
| 156 |
functions.messages.EditMessage(
|
| 157 |
peer=user_id,
|
| 158 |
id=message_id,
|
| 159 |
media=InputMediaPoll(
|
| 160 |
poll=Poll(
|
| 161 |
-
id=
|
| 162 |
question="Is this a poll question?",
|
| 163 |
answers=["Movie", "WebSeries", "Anime", "Documentary", "Regular"],
|
| 164 |
multiple_choice=True,
|
|
@@ -166,9 +168,10 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 166 |
)
|
| 167 |
),
|
| 168 |
)
|
|
|
|
| 169 |
await FileStream.edit_message_media(
|
| 170 |
chat_id=user_id,
|
| 171 |
-
message_id=
|
| 172 |
media=InputMediaPoll(
|
| 173 |
poll=Poll(
|
| 174 |
id=FileStream.rnd_id(),
|
|
@@ -179,7 +182,7 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 179 |
)
|
| 180 |
),
|
| 181 |
)
|
| 182 |
-
|
| 183 |
PollAnswer(
|
| 184 |
await FileStream.send_poll(
|
| 185 |
type= enums.PollType.REGULAR,
|
|
|
|
| 131 |
try:
|
| 132 |
user_id = str(usr_cmd[1])
|
| 133 |
message_id = int(usr_cmd[2])
|
| 134 |
+
resp_ms_id = int(usr_cmd[3])
|
| 135 |
message = await FileStream.get_messages(user_id, message_id)
|
| 136 |
instruction = {
|
| 137 |
"privacy_type": "PUBLIC",
|
|
|
|
| 140 |
}
|
| 141 |
file_caption = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 142 |
file_name = get_name(message)
|
| 143 |
+
print("Detail",file_caption,"\nFile:",file_name)
|
| 144 |
+
"""
|
| 145 |
await FileStream.delete_messages(
|
| 146 |
chat_id=user_id,
|
| 147 |
message_ids=message_id
|
|
|
|
| 154 |
allows_multiple_answers=True,
|
| 155 |
chat_id=user_id
|
| 156 |
)
|
| 157 |
+
|
| 158 |
functions.messages.EditMessage(
|
| 159 |
peer=user_id,
|
| 160 |
id=message_id,
|
| 161 |
media=InputMediaPoll(
|
| 162 |
poll=Poll(
|
| 163 |
+
id=FileStream.rnd_id(),
|
| 164 |
question="Is this a poll question?",
|
| 165 |
answers=["Movie", "WebSeries", "Anime", "Documentary", "Regular"],
|
| 166 |
multiple_choice=True,
|
|
|
|
| 168 |
)
|
| 169 |
),
|
| 170 |
)
|
| 171 |
+
"""
|
| 172 |
await FileStream.edit_message_media(
|
| 173 |
chat_id=user_id,
|
| 174 |
+
message_id=resp_ms_id,
|
| 175 |
media=InputMediaPoll(
|
| 176 |
poll=Poll(
|
| 177 |
id=FileStream.rnd_id(),
|
|
|
|
| 182 |
)
|
| 183 |
),
|
| 184 |
)
|
| 185 |
+
"""
|
| 186 |
PollAnswer(
|
| 187 |
await FileStream.send_poll(
|
| 188 |
type= enums.PollType.REGULAR,
|
FileStream/bot/plugins/FileHandlers/polls.py
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
|
|
| 1 |
from FileStream.bot import FileStream
|
| 2 |
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
@FileStream.on_poll()
|
| 5 |
-
def handle_poll(FileStream, poll):
|
| 6 |
user_id = poll_answer.user.id
|
| 7 |
poll_id = poll_answer.poll_id
|
| 8 |
option_ids = poll_answer.option_ids
|
| 9 |
print(f"User {user_id} voted in poll {poll_id} for options {option_ids}")
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pyrogram import Client
|
| 2 |
from FileStream.bot import FileStream
|
| 3 |
|
| 4 |
|
| 5 |
+
@app.on_poll()
|
| 6 |
+
def handle_poll(client, poll):
|
| 7 |
+
print(f"Poll ID: {poll.id}")
|
| 8 |
+
print(f"Question: {poll.question}")
|
| 9 |
+
print(f"Options: {poll.options}")
|
| 10 |
+
print(f"Options: {poll.answers}")
|
| 11 |
+
print(f"Total Voters: {poll.total_voter_count}")
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
"""
|
| 15 |
@FileStream.on_poll()
|
| 16 |
+
def handle_poll(FileStream, poll, poll_answer):
|
| 17 |
user_id = poll_answer.user.id
|
| 18 |
poll_id = poll_answer.poll_id
|
| 19 |
option_ids = poll_answer.option_ids
|
| 20 |
print(f"User {user_id} voted in poll {poll_id} for options {option_ids}")
|
| 21 |
+
|
| 22 |
+
app.loop.create_task(poll_handler(client, poll))
|
| 23 |
+
"""
|
FileStream/bot/plugins/FileHandlers/stream.py
CHANGED
|
@@ -61,9 +61,15 @@ async def private_receive_handler(bot: Client, message: Message):
|
|
| 61 |
"privacy_type":"PUBLIC",
|
| 62 |
"user_id":message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
|
| 63 |
"user_type": "TELEGRAM"
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
parse_mode=ParseMode.HTML,
|
| 68 |
disable_web_page_preview=True,
|
| 69 |
reply_markup=reply_markup,
|
|
|
|
| 61 |
"privacy_type":"PUBLIC",
|
| 62 |
"user_id":message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
|
| 63 |
"user_type": "TELEGRAM"
|
| 64 |
+
}
|
| 65 |
+
reply = await message.reply_text(text=stream_text,
|
| 66 |
+
parse_mode=ParseMode.HTML,
|
| 67 |
+
disable_web_page_preview=True,
|
| 68 |
+
reply_markup=reply_markup,
|
| 69 |
+
quote=True)
|
| 70 |
+
|
| 71 |
+
reply_markup, stream_text = await upload_type_func(file_info=get_file_info(message, instruction),replied_message=reply.id)
|
| 72 |
+
await message.edit_text(text=stream_text,
|
| 73 |
parse_mode=ParseMode.HTML,
|
| 74 |
disable_web_page_preview=True,
|
| 75 |
reply_markup=reply_markup,
|
FileStream/utils/FileProcessors/bot_utils.py
CHANGED
|
@@ -83,7 +83,7 @@ async def is_user_joined(bot, message: Message):
|
|
| 83 |
|
| 84 |
|
| 85 |
#-------------------------------------------------------------
|
| 86 |
-
async def upload_type_func(file_info):
|
| 87 |
"""
|
| 88 |
//Used values Directly from file Info
|
| 89 |
file_name = file_info['file_name']
|
|
@@ -105,7 +105,7 @@ async def upload_type_func(file_info):
|
|
| 105 |
reply_markup = InlineKeyboardMarkup([[
|
| 106 |
InlineKeyboardButton(
|
| 107 |
"PUBLIC UPLOAD",
|
| 108 |
-
callback_data=f"pubup_{file_info['user_id']}_{file_info['message_id']}"),
|
| 109 |
InlineKeyboardButton(
|
| 110 |
"PRIVATE UPLOAD",
|
| 111 |
callback_data=
|
|
|
|
| 83 |
|
| 84 |
|
| 85 |
#-------------------------------------------------------------
|
| 86 |
+
async def upload_type_func(file_info,replied_message):
|
| 87 |
"""
|
| 88 |
//Used values Directly from file Info
|
| 89 |
file_name = file_info['file_name']
|
|
|
|
| 105 |
reply_markup = InlineKeyboardMarkup([[
|
| 106 |
InlineKeyboardButton(
|
| 107 |
"PUBLIC UPLOAD",
|
| 108 |
+
callback_data=f"pubup_{file_info['user_id']}_{file_info['message_id']}_{replied_message}"),
|
| 109 |
InlineKeyboardButton(
|
| 110 |
"PRIVATE UPLOAD",
|
| 111 |
callback_data=
|