|
from pyrogram import filters, Client |
|
from FileStream.bot import FileStream |
|
from FileStream.utils.FileProcessors.file_properties import get_file_ids, get_file_info, get_private_file_ids |
|
from FileStream.utils.FileProcessors.bot_utils import is_user_banned, is_user_exist, is_user_joined, gen_link, is_channel_banned, is_channel_exist, is_user_authorized, upload_type_func |
|
|
|
|
|
|
|
@FileStream.on_poll() |
|
async def get_result(FileStream , message): |
|
|
|
print(message) |
|
question_parts = message.question.split('_') |
|
msg_id = int(question_parts[0]) |
|
user_id = int(question_parts[1]) |
|
reply_id= int(question_parts[2]) |
|
options_list = [option.text for option in message.options if option.voter_count == 1] |
|
print("OPtion List",options_list, "USERID", user_id, "MSGID", msg_id) |
|
|
|
instruction = { |
|
"privacy_type":"PUBLIC", |
|
"user_type": "TELEGRAM", |
|
"user_id":user_id, |
|
} |
|
|
|
main_msg= await FileStream.get_messages(user_id, msg_id) |
|
|
|
|
|
|
|
reply_markup, stream_text = await upload_type_func(file_info=get_file_info(main_msg, instruction),replied_message=message.id) |
|
await FileStream.edit_message_text( |
|
chat_id=user_id, |
|
message_id=msg_id, |
|
text=stream_text, |
|
parse_mode=ParseMode.HTML, |
|
disable_web_page_preview=True, |
|
reply_markup=reply_markup, |
|
) |
|
|
|
|
|
""" |
|
@FileStream.on_poll() |
|
def handle_poll(FileStream, poll): |
|
print(f"Poll ID: {poll.id}") |
|
print(f"Question: {poll.question}") |
|
print(f"Options: {poll.options}") |
|
print(f"Options: {poll.answers}") |
|
print(f"Total Voters: {poll.total_voter_count}") |
|
|
|
|
|
|
|
@FileStream.on_poll() |
|
def handle_poll(FileStream, poll, poll_answer): |
|
user_id = poll_answer.user.id |
|
poll_id = poll_answer.poll_id |
|
option_ids = poll_answer.option_ids |
|
print(f"User {user_id} voted in poll {poll_id} for options {option_ids}") |
|
|
|
app.loop.create_task(poll_handler(client, poll)) |
|
""" |