Skip to content

Sending custom objects to button handler and using them. #1710

Answered by Plerx2493
JayKobe6k asked this question in Support
Discussion options

You must be logged in to vote

There are several ways to solve your problem:

  1. You put some kind of id in your button id and use a injected service which will hold your state
  2. Designe your buttons to be stateless. Put your needed data into the custom id. For example "ban-{id}" which will always ban a certain member given some checks dont fail.
  3. Use DSharpPlus.Interactivity and use methods like DiscordMessage#WaitForButtonAsync. Find the docs here

About your feedback about the lib:
We use standard C# events and target user with an intermediate understanding of the language which should include knowledge about handling events and handling state in an threadsafe and application wide manner

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@JayKobe6k
Comment options

@Plerx2493
Comment options

@JayKobe6k
Comment options

@Plerx2493
Comment options

@JayKobe6k
Comment options

Answer selected by Plerx2493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants