Skip to content
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

Add support for polls #534

Merged
merged 35 commits into from
Apr 18, 2024
Merged

Add support for polls #534

merged 35 commits into from
Apr 18, 2024

Conversation

jb3
Copy link
Collaborator

@jb3 jb3 commented Apr 13, 2024

image

My fellow developers,

Today, we stand on the cusp of a new frontier in the world of Elixir programming. A frontier where innovation, collaboration, and sheer determination converge to push the boundaries of what we thought possible. It is with great pride and optimism that I address you today to herald the rapid development of Nostrum, an Elixir Discord library, masterfully crafted and tirelessly maintained by the indomitable trio: Joe, Craig, and Johannes.

As we look back on the journey that has brought us to this moment, we see countless hours of dedication, relentless pursuit of excellence, and an unwavering commitment to empowering developers worldwide. Nostrum has become not just a library, but a symbol of ingenuity and progress in the Elixir community.

But today, my friends, we stand on the precipice of something even greater. Today, we unveil a new implementation that will revolutionize the very fabric of Nostrum: the introduction of polls. Yes, you heard it right. Polls, a simple yet powerful tool that will democratize decision-making, foster engagement, and elevate the user experience to unprecedented heights.

With the integration of polls into Nostrum, developers will now have the ability to gather feedback, gauge opinions, and make informed decisions in real-time. Whether it's deciding on the next feature to implement, choosing the direction of a project, or simply gauging community sentiment, polls will be the cornerstone of collaboration within the Nostrum ecosystem.

But let us not forget the significance of this moment. It is not merely the addition of a feature, but a testament to our collective vision and unwavering commitment to pushing the boundaries of what is possible. With polls, we empower every developer to have a voice, to shape the future of Nostrum, and to leave their mark on the ever-evolving landscape of Elixir programming.

So let us embrace this moment with open arms, knowing that together, we have ushered in a new era of innovation and possibility. Let us continue to push the boundaries, defy the odds, and inspire generations to come. For in the world of Elixir development, the sky is not the limit – it is only the beginning.

Thank you.

The Nitty Gritty

  • New structures for creating polls and receiving poll results (Nostrum.Struct.Message.Poll)
    • Helper methods for creating polls that can send with the Api module.
  • Gateway
    • Handle new gateway events for poll vote add and remove
    • Add new gateway intents for receiving the above events
  • REST API
    • New API methods for fetching poll voters and ending polls early
  • Documentation
    • Documentation for all new features, structures and methods
    • Example code for creating and sending polls
    • Tests for new features (mainly helper methods)

We should not merge this until the upstream discord/discord-api-docs#6746 merges.

jb3 added 5 commits April 13, 2024 18:38
Adds the following structures for Discord Polls (under Nostrum.Struct.Message):
- `Poll`: The root poll struct, which has utility methods for creating
new polls
- `Answer`: An option on a poll, this stores the ID and contains the
media
- `MediaObject`: This is the media type used for storage of both the
questions and answers, storing the text and (in the case of answers) the emoji.
Adds the new poll key to the Message structures we have, as well as
mentioning that the Api.create_message methods take the new `poll` attribute.
@jb3 jb3 marked this pull request as draft April 13, 2024 18:52
@jchristgit jchristgit self-assigned this Apr 14, 2024
jb3 added 3 commits April 14, 2024 12:42
Adds the new gateway intents for receiving dispatch messages about votes
being added/removed from polls.

Also documents the auto moderator intents that were already present but undocumented.
@jb3 jb3 marked this pull request as ready for review April 14, 2024 14:47
lib/nostrum/api.ex Outdated Show resolved Hide resolved
lib/nostrum/api.ex Outdated Show resolved Hide resolved
lib/nostrum/api.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/event/poll_vote_change.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/event/poll_vote_change.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/message/poll/results.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/message/poll/media_object.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/message/poll/media_object.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/message/poll/results.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/message/poll/results.ex Outdated Show resolved Hide resolved
lib/nostrum/api.ex Outdated Show resolved Hide resolved
lib/nostrum/struct/message.ex Show resolved Hide resolved
lib/nostrum/struct/message/poll.ex Show resolved Hide resolved
lib/nostrum/struct/message.ex Show resolved Hide resolved
@jb3 jb3 requested a review from jchristgit April 18, 2024 19:00
@jb3
Copy link
Collaborator Author

jb3 commented Apr 18, 2024

Upstream PR has merged, once we are happy with this we can merge it in.

@jb3 jb3 merged commit a82e9f4 into master Apr 18, 2024
6 checks passed
@jb3 jb3 deleted the jb3/polls branch April 18, 2024 19:06
@jb3
Copy link
Collaborator Author

jb3 commented Apr 18, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants