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

Using closures as component callbacks #1462

Open
Spacerulerwill opened this issue Nov 10, 2023 · 0 comments
Open

Using closures as component callbacks #1462

Spacerulerwill opened this issue Nov 10, 2023 · 0 comments

Comments

@Spacerulerwill
Copy link

Is there any way to do this like in discord.py / discord.js. The reason I need to do this is because I need to somehow pass variables and data from my slash command callback to my select menu callback. If anyone knows how to use closures to achieve this, or another method I would be very grateful.

To clarify, I'm looking for a discord go equivalent to something like this in discord.py

async def command(ctx:Context):
    x = 5
    async def callback():
        # do something with x
        ...
    
    # we would create the component and add its callback here, and then add to message
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

No branches or pull requests

1 participant