In my InteractionModule.cs, I have a [ComponentInteraction] that is mean to rebuild an array of buttons upon being pressed. When I run my bot, I get the following error:
[1;37mSystem.ArgumentException: [0;0m'No type TypeReader is defined for this Discord.WebSocket.SocketMessageComponent (Parameter 'type')'
To my understanding, a TypeReader will allow me to pass the customIds of the buttons I'm regenerating. For this context, I am confused on how to implement a TypeReader (or rather, where to put it, and how to convert data for my use).
Here's the section of my InteractionModule.cs I am using:
[ComponentInteraction("button*")]
public async Task RebuilderHandler(SocketMessageComponent component)
{
void generateButtonGrid(ComponentBuilder builder, int rows, int cols, string id)
{
string buttonName = "button";
int buttonNumber = 0;
for (int i = 0; i < rows; i++)
{
buttonNumber++;
buttonName = "button";
buttonName += buttonNumber.ToString();
if (buttonName == id)
{
builder.WithButton("\n", buttonName, ButtonStyle.Success, disabled: true, row: i);
}
else
{
builder.WithButton("\n", buttonName, ButtonStyle.Secondary, row: i);
}
for (int j = 0; j < cols - 1; j++)
{
buttonNumber++;
buttonName = "button";
buttonName += buttonNumber.ToString();
if (buttonName == id)
{
builder.WithButton("\n", buttonName, ButtonStyle.Success, disabled: true, row: i);
}
else
{
builder.WithButton("\n", buttonName, ButtonStyle.Secondary, row: i);
}
}
}
}
var builder = new ComponentBuilder();
generateButtonGrid(builder, 5, 5, component.Data.CustomId);
await component.UpdateAsync(x => x.Components = builder.Build());
}
Maybe there is something else I'm missing, or perhaps I wrote something wrong. Help is much appreciated 