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

feat: Add poll result embed type #1730

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

retr0-init
Copy link
Contributor

@retr0-init retr0-init commented Aug 8, 2024

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

The new poll feature results in a new EmbedType, poll_result. Missing this will lead to error to be:

ValueError: 'poll_result' is not a valid EmbedType

Changes

Add the poll_result to the EmbedType in the enum.py

Related Issues

N/A

Test Scenarios

Create a poll and end the poll.
Try to use the following code in the channel where the poll was created.

@interactions.slash_command(
    "test", description="test command", scopes=[DEV_GUILD] if DEV_GUILD else None
)
async def test_cmd(self, ctx: interactions.SlashContext):
    """Register as an extension command"""
    async for msg in ctx.channel.history(10):
        ...

It should not generate any error

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

@retr0-init
Copy link
Contributor Author

This yields another message:

Class `MessageType` received an invalid and unexpected value `46`, a new enum item will be created to represent this value. Please update interactions.py or report this issue on GitHub - https://github.com/interactions-py/interactions.py/issues

I think this is the poll_result message type. However, it is not shown on the official documentation on https://discord.com/developers/docs/resources/message#message-object-message-types

Do you think I need to create a message type in the MessageType enum like POLL_RESULT for the value of 46?

@AstreaTSS
Copy link
Member

We usually don't add undocumented features.

@retr0-init
Copy link
Contributor Author

OK. I will document this into an issue. And if there is any update about this on the official documentation, we can proceed with the addition

@retr0-init retr0-init marked this pull request as ready for review August 9, 2024 00:25
@AstreaTSS AstreaTSS mentioned this pull request Aug 12, 2024
@AstreaTSS AstreaTSS changed the title fixed: Add poll result message support feat: Add poll result embed type Aug 12, 2024
Copy link
Member

@AstreaTSS AstreaTSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this PR because of how prevalent errors are without it, but it's worth noting that the PR for this embed type notes a lot more fields for it. These fields aren't necessary to add right now as interactions.py will ignore them, but they should be added at some point.

@AstreaTSS AstreaTSS merged commit 38f3162 into interactions-py:unstable Aug 12, 2024
2 checks passed
@retr0-init retr0-init deleted the pr-1730 branch August 12, 2024 16:42
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