Documentation ¶
Index ¶
- type App
- func (a *App) CommandHandler(handler HandlerFunc)
- func (a *App) ComponentHandler(handler HandlerFunc)
- func (a *App) Get(key string) (interface{}, bool)
- func (a *App) ProcessRequest(data []byte) (resp *objects.InteractionResponse, err error)
- func (a *App) Rest() *rest.Client
- func (a *App) Run(port int) error
- func (a *App) Set(key string, obj interface{})
- type Config
- type HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Router *fasthttprouter.Router // contains filtered or unexported fields }
App is the primary interactions server
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) ProcessRequest ¶
func (a *App) ProcessRequest(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 *logrus.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(*objects.Interaction) *objects.InteractionResponse
Click to show internal directories.
Click to hide internal directories.