Currently, ComponentHandlers accept a ComponentData interface, and assertions must be done by the user. The user can make a mistake where an incorrect ID is used, causing a handler that expects one type to get an interaction of another type.
API proposal:
// Usage:
h.AddComponent("id", func(ctx context.Context, data ComponentData[*discord.ButtonInteraction]) {})
// Decls:
type ComponentData[T discord.ComponentInteraction] {...}
type ComponentHandler[T discord.ComponentInteraction] {...}
func (r *Router) AddComponent[T discord.ComponentInteraction](...)
Currently,
ComponentHandler
s accept aComponentData
interface, and assertions must be done by the user. The user can make a mistake where an incorrect ID is used, causing a handler that expects one type to get an interaction of another type.API proposal: