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 support select menu defaults #1556

Merged
merged 3 commits into from
Nov 16, 2023
Merged

Conversation

LordOfPolls
Copy link
Contributor

Pull Request Type

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

Description

Discord added support for default assignments on select menus, this PR supports this

Please note, the __all__ scope of the new objects is intentional, the encouraged usage of this should be passing DiscordObjects, not SelectDefaultValues

Changes

  • Create DefaultableSelectMenu and make all affected select menus inherit from it
  • Create SelectDefaultValues
  • Update init's to allow for default assignment

Related Issues

Test Scenarios

@slash_command("test_mutliline")
async def test(ctx: interactions.SlashContext):
    user_select = interactions.UserSelectMenu()
    user_select.add_default_value(ctx.author)
    await ctx.send(components=[user_select])


@slash_command("test_inline")
async def test_inline(ctx: interactions.SlashContext):
    user_select = interactions.UserSelectMenu(default_values=[ctx.author])
    await ctx.send(components=[user_select])

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2023

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Coverage Δ
interactions/models/discord/components.py 35.09% <52.38%> (+1.76%) ⬆️

📢 Thoughts on this report? Let us know!.

@LordOfPolls LordOfPolls merged commit 78ab162 into unstable Nov 16, 2023
9 of 12 checks passed
@LordOfPolls LordOfPolls deleted the select-defaults branch November 16, 2023 14:44
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.

3 participants