Documentation ¶
Index ¶
- func FailUnknownError(w http.ResponseWriter, jr *json.Encoder)
- type App
- func (a *App) AutocompleteHandler(handler HandlerFunc)
- func (a *App) CommandHandler(handler HandlerFunc)
- func (a *App) ComponentHandler(handler HandlerFunc)
- func (a *App) HTTPHandler() http.HandlerFunc
- func (a *App) ModalHandler(handler HandlerFunc)
- func (a *App) ProcessRequest(ctx context.Context, data []byte) (resp *objects.InteractionResponse, err error)
- func (a *App) Rest() rest.RESTClient
- func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type HandlerFunc
- type InteractionOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FailUnknownError ¶
func FailUnknownError(w http.ResponseWriter, jr *json.Encoder)
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the primary interactions server
func New ¶
func New(publicKey string, opts ...InteractionOption) (*App, error)
Create a new interactions server instance
func (*App) AutocompleteHandler ¶
func (a *App) AutocompleteHandler(handler HandlerFunc)
func (*App) CommandHandler ¶
func (a *App) CommandHandler(handler HandlerFunc)
CommandHandler sets the function to handle slash command events
func (*App) ComponentHandler ¶
func (a *App) ComponentHandler(handler HandlerFunc)
ComponentHandler sets the function to handle Component events.
func (*App) HTTPHandler ¶
func (a *App) HTTPHandler() http.HandlerFunc
HTTPHandler exposes a net/http handler to process incoming interactions
func (*App) ModalHandler ¶
func (a *App) ModalHandler(handler HandlerFunc)
func (*App) ProcessRequest ¶
func (a *App) ProcessRequest(ctx context.Context, data []byte) (resp *objects.InteractionResponse, err error)
ProcessRequest is used internally to process a validated request. It is exposed to allow users to tied Postcord in with any web framework of their choosing. Ensure you only pass validated requests.
func (*App) Rest ¶
func (a *App) Rest() rest.RESTClient
Rest exposes the internal Rest client so you can make calls to the Discord API
type HandlerFunc ¶
type HandlerFunc func(context.Context, *objects.Interaction) *objects.InteractionResponse
type InteractionOption ¶
type InteractionOption func(*App)
func WithClient ¶
func WithClient(c rest.RESTClient) InteractionOption
func WithLogger ¶
func WithLogger(l zerolog.Logger) InteractionOption
Click to show internal directories.
Click to hide internal directories.