Skip to content

Ended poll won't have victor answer #10155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
shark-speare opened this issue Apr 1, 2025 · 7 comments
Open
3 tasks done

Ended poll won't have victor answer #10155

shark-speare opened this issue Apr 1, 2025 · 7 comments
Labels
unconfirmed bug A bug report that needs triaging

Comments

@shark-speare
Copy link

shark-speare commented Apr 1, 2025

Summary

I can't get an answer when I end a poll manually

Reproduction Steps

I don't want the poll to last for hours, so I end it earlier
It works well when I end the poll, and it shows the answer in channel
But even if it has a victor answer, the victor_answer is still None
I've tried:

  • wait for a while after ending the poll, still not working
  • try to wait until poll.is_finalized() but ended up in forever waiting
  • try bot.wait_for() and wait until `message.type == discord.MessageType.poll_result)

None of these works

Minimal Reproducible Code

await channel.send(poll=poll) #This is a channel

asyncio.sleep(60)
final_poll = await poll.end()
answer = final_poll.victor_answer
print(answer.text)

Expected Results

It should return a poll with victor_answer instead of victor_answer being None

Actual Results

It returned a poll with not attribute victor_answer, so trying to print the text will go wrong

Intents

discord.Intents.all()

System Information

  • Python v3.12.7-final
  • discord.py v2.5.2-final
  • aiohttp v3.11.14
  • system info: Darwin 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8122

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

@shark-speare shark-speare added the unconfirmed bug A bug report that needs triaging label Apr 1, 2025
@DA-344
Copy link
Contributor

DA-344 commented Apr 1, 2025

You need to check the Victor answer on the poll_result message, not on the poll object you’ve sent. To access the poll you can wait for the poll_result message and then obtain the reference poll: msg.reference.resolved.poll and from there the Victor_answer

@shark-speare
Copy link
Author

shark-speare commented Apr 1, 2025

But what is victor_answer used for? I have to get the content of message instead of use that? Then what is it made for? poll.end() returns updated poll, but what update would be done after ending if it's not a victor_answer?

@DA-344
Copy link
Contributor

DA-344 commented Apr 2, 2025

It is a shortcut for iterating through the reference message embed fields and finding the “victor_answer_id” field.

@shark-speare
Copy link
Author

Sorry I couldn't understand, could you give me an example?

@DA-344
Copy link
Contributor

DA-344 commented Apr 2, 2025

Poll.victor_answer is a shortcut for handling this embed type on the poll_result message. And to get it you need that data which is obtained on the resolved reference message of the message with poll_result type.

@shark-speare
Copy link
Author

So I can only get the embed information in the result message, and can't get the answer from the poll?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug A bug report that needs triaging
Projects
None yet
Development

No branches or pull requests

3 participants
@DA-344 @shark-speare and others