Replies: 1 comment 1 reply
-
var builder = new ComponentBuilder();
var rows = ComponentBuilder.FromMessage(interaction as IComponentInteraction).Message).ActionRows;
for (int i = 0; i < rows.Count; i++)
{
foreach (var component in rows[i].Components)
{
switch (component)
{
case ButtonComponent button:
builder.WithButton(button.ToBuilder()
.WithDisabled(true), i);
break;
case SelectMenuComponent menu:
builder.WithSelectMenu(menu.ToBuilder()
.WithDisabled(true), i);
break;
}
}
}
await messageComponent.Message.ModifyAsync(x => x.Components = builder.Build()); This does the trick, while also maintaining the original position of the button/select menu. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
csmir
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How do you guys disable a button after it's been clicked?
Beta Was this translation helpful? Give feedback.
All reactions