privateone's picture
Update FileStream/bot/plugins/FileHandlers/polls.py
26f26bd verified
raw
history blame
1.54 kB
from pyrogram import Client
from FileStream.bot import FileStream
@FileStream.on_message(filters.command("result"))
async def get_result(FileStream , message):
result = await FileStream.get_messages(chat_id , poll.id)
print(result.poll.chosen_option)
instruction = {
"privacy_type":"PUBLIC",
"user_id":message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,,
"user_type": "TELEGRAM"
}
main_msg= await FileStream.get_messages(instruction['user_id]', result.poll.explanation)
#reply = await message.reply_text(LANG.PROCESSING_TEXT)
reply_markup, stream_text = await upload_type_func(file_info=get_file_info(message, instruction),replied_message=reply.id)
await update.message.edit_text(
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))
"""