nyxx-discord / nyxx

Wrapper around Discord API for Dart
Apache License 2.0
326 stars 49 forks source link

Add polls support #644

Closed MCausc78 closed 5 months ago

MCausc78 commented 7 months ago

Description

Implement https://github.com/discord/discord-api-docs/pull/6746

I haven't tested sending message with poll (PollBuilder) and await message.endPoll(); since sending message with poll gives:

Unhandled exception:
403: Forbidden (0) POST https://discord.com/api/v10/channels/XXX/messages
#0      HttpHandler.executeSafe (package:nyxx/src/http/handler.dart:210:7)
<asynchronous suspension>
#1      MessageManager.create (package:nyxx/src/http/managers/message_manager.dart:412:22)
<asynchronous suspension>

endPoll:

Unhandled exception:
Cannot edit a message authored by another user (50005) POST https://discord.com/api/v10/channels/XXX/polls/YYY/expire
#0      HttpHandler.executeSafe (package:nyxx/src/http/handler.dart:210:7)
<asynchronous suspension>
#1      MessageManager.endPoll (package:nyxx/src/http/managers/message_manager.dart:682:22)
<asynchronous suspension>

After testing sending poll/endPoll, mark as ready for review

Connected issues & other potential problems

None

Type of change

Please delete options that are not relevant.

Checklist:

MCausc78 commented 6 months ago

Can you add tests?

Integration tests that send and end a poll would be nice.

Yeah, polls aren't locked under experiment now, i'll add them once i will at home

abitofevrything commented 6 months ago

Sounds great, thanks!