interactions-py / interactions.py

A highly extensible, easy to use, and feature complete bot framework for Discord
https://interactions-py.github.io/interactions.py/
MIT License
838 stars 184 forks source link

fix: pass client for SelectDefaultValues.from_object #1654

Closed AstreaTSS closed 6 months ago

AstreaTSS commented 7 months ago

Pull Request Type

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

Checklist