discordgw

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL