Skip to content

fix: pass client for SelectDefaultValues.from_object #1654

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

Merged

Conversation

AstreaTSS
Copy link
Member

Pull Request Type

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

Description

This PR fixes SelectDefaultValues.from_object by making sure a client object is passed into the proper init.

Changes

See diff - it's not a big change.

Related Issues

Resolves #1653

Test Scenarios

import interactions
bot = interactions.Client(intents=Intents.DEFAULT)
@interactions.slash_command(
    name="test",
    description="test"
)
async def test_cmd(ctx: interactions.SlashContext):
    component = interactions.UserSelectMenu(max_values=3, default_values=[interactions.models.discord.components.SelectDefaultValues.from_object(ctx.author)])
    # Or the following code is the same as above
    # component = interactions.UserSelectMenu(max_values=3, default_values=[ctx.author])
    await ctx.send("Test", components=[component])

bot.start("TOKEN")

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x - or, well, someone else tested the fix. My PC isn't allowing for bots to run for some reason 😅.

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

@AstreaTSS AstreaTSS mentioned this pull request Apr 7, 2024
13 tasks
@silasary silasary merged commit b0abff1 into interactions-py:unstable Apr 26, 2024
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