Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDiscordGateway ¶
func NewDiscordGateway(logger l0g.Logger) (ports.DiscordGateway, error)
NewDiscordGateway creates a new instance of the Discord gateway. It takes a logger as a parameter and returns a DiscordGateway interface and an error.
Types ¶
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway represents a Discord gateway that manages the session and logger.
func (*Gateway) AddHandler ¶
func (d *Gateway) AddHandler(handler ports.MessageHandler) error
AddHandler adds a new message handler to the Discord gateway. It takes a `ports.NewMessageHandler` function as a parameter and returns an error. The function registers the handler with the Discord session and opens the connection. It then waits for a termination signal to gracefully close the connection. If an error occurs during the session opening or closing, it is logged, and the function returns the error.
Click to show internal directories.
Click to hide internal directories.