Documentation ¶
Index ¶
- func ETFPayloadToMessage(ctx context.Context, ep ETFPayload) (wsapi.WSMessage, error)
- type DispatchHandlerFunc
- type Dispatcher
- func (c *Dispatcher) AddHandler(event string, handler DispatchHandlerFunc)
- func (c *Dispatcher) ConnectToBot(b *bot.DiscordBot)
- func (c *Dispatcher) GenerateHeartbeat(reqCtx context.Context, seqNum int) (wsapi.WSMessage, error)
- func (c *Dispatcher) HandleRequest(req wsapi.WSMessage, resp chan<- wsapi.WSMessage) snowflake.Snowflake
- func (c *Dispatcher) SetDebug(val bool)
- type ETFPayload
- type Logger
- type Message
- type MessageType
- type Payload
- type Reaction
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ETFPayloadToMessage ¶
ETFPayloadToMessage converts a specialized etf payload to a websocket message
Types ¶
type DispatchHandlerFunc ¶
type DispatchHandlerFunc = func(Payload, wsapi.WSMessage, chan<- wsapi.WSMessage) snowflake.Snowflake
DispatcherFunc is the api that a bot expects a handler function to have
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(deps dependencies) *Dispatcher
NewDispatcher creates a new Dispatcher object with default state and session management handlers installed
func (*Dispatcher) AddHandler ¶
func (c *Dispatcher) AddHandler(event string, handler DispatchHandlerFunc)
func (*Dispatcher) ConnectToBot ¶
func (c *Dispatcher) ConnectToBot(b *bot.DiscordBot)
func (*Dispatcher) GenerateHeartbeat ¶
func (*Dispatcher) HandleRequest ¶
func (*Dispatcher) SetDebug ¶
func (c *Dispatcher) SetDebug(val bool)
type ETFPayload ¶
ETFPayload is the interface that a specialized etf api payload conforms to
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents the data about a message in a discord channel
func MessageFromElement ¶
MessageFromElement generates a new Message object from the given Element
func MessageFromElementMap ¶
MessageFromElementMap generates a new Message object from the given data
func (*Message) ContentString ¶
ContentString returns the content of the message
func (*Message) MessageType ¶
func (m *Message) MessageType() MessageType
MessageType returns the MessageType of the message
type MessageType ¶
type MessageType int
MessageType represents the type of message received in a discord channel
const ( DefaultMessage MessageType = 0 RecipientAddMessage MessageType = 1 RecipientRemoveMessage MessageType = 2 CallMessage MessageType = 3 ChannelNameChangeMessage MessageType = 4 ChannelIconChangeMessage MessageType = 5 ChannelPinnedMessageMessage MessageType = 6 GuildMemberJoinMessage MessageType = 7 )
These are the known message types
func MessageTypeFromElement ¶
func MessageTypeFromElement(e etfapi.Element) (MessageType, error)
MessageTypeFromElement generates a MessageType representation from the given message-type Element
func (MessageType) String ¶
func (t MessageType) String() string
type Reaction ¶
type Reaction struct {
// contains filtered or unexported fields
}
Message represents the data about a message in a discord channel
func ReactionFromElement ¶
ReactionFromElement generates a new Reaction object from the given Element
func ReactionFromElementMap ¶
ReactionFromElementMap generates a new Reaction object from the given data
func (*Reaction) Emoji ¶
Emoji returns the emoji of the reaction ChannelID returns the ID of the channel the reaction was to
type User ¶
type User struct {
// contains filtered or unexported fields
}
User represents the data about a discord user
func UserFromElement ¶
UserFromElement generates a new User object from the given Element