1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-06 04:07:18 +00:00

api: Add InteractionHandlerFunc

This commit is contained in:
diamondburned 2022-08-23 13:42:29 -07:00
parent 0f0c968634
commit 75ff7342b1
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -44,6 +44,15 @@ type InteractionHandler interface {
HandleInteraction(*discord.InteractionEvent) *api.InteractionResponse
}
// InteractionHandlerFunc is a function type that implements the interface.
type InteractionHandlerFunc func(*discord.InteractionEvent) *api.InteractionResponse
var _ InteractionHandler = InteractionHandlerFunc(nil)
func (f InteractionHandlerFunc) HandleInteraction(ev *discord.InteractionEvent) *api.InteractionResponse {
return f(ev)
}
type alwaysDeferInteraction struct {
f func(*discord.InteractionEvent)
flags discord.MessageFlags