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:
parent
0f0c968634
commit
75ff7342b1
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue