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) FastHTTPHandler() fasthttp.RequestHandler
- func (a *App) Get(key string) (interface{}, bool)
- func (a *App) HTTPHandler() http.HandlerFunc
- func (a *App) LambdaHandler() LambdaHandler
- 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.Client
- func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (a *App) Set(key string, obj interface{})
- type Config
- type HandlerFunc
- type LambdaHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FailUnknownError ¶ added in v0.1.3
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 (*App) AutocompleteHandler ¶ added in v0.0.15
func (a *App) AutocompleteHandler(handler HandlerFunc)
func (*App) CommandHandler ¶ added in v0.0.13
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) FastHTTPHandler ¶ added in v0.1.0
func (a *App) FastHTTPHandler() fasthttp.RequestHandler
FastHTTPHandler exposes a fasthttp handler to process incoming interactions
func (*App) HTTPHandler ¶ added in v0.0.17
func (a *App) HTTPHandler() http.HandlerFunc
HTTPHandler exposes a net/http handler to process incoming interactions
func (*App) LambdaHandler ¶ added in v0.0.15
func (a *App) LambdaHandler() LambdaHandler
LambdaHandler exposes an AWS APi Gateway Lambda handler to process incoming interactions
func (*App) ModalHandler ¶ added in v0.1.0
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.
type Config ¶
type Config struct { // PublicKey is your interactions public key provided on the Discord developers site PublicKey string // Logger allows you to specify a custom logrus Logger for the App to use Logger *zerolog.Logger // Token (optional) is your Discord token that will be passed to the internal REST client Token string // RESTClient (optional) is the REST client you are overriding with. Useful for proxies. RESTClient *rest.Client }
Config contains the configuration values for the interactions App
type HandlerFunc ¶
type HandlerFunc func(context.Context, *objects.Interaction) *objects.InteractionResponse
type LambdaHandler ¶ added in v0.1.0
type LambdaHandler func(context.Context, events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)