Documentation
¶
Index ¶
- type DiscordSource
- func (s *DiscordSource) Ack(ctx context.Context, msg hermod.Message) error
- func (s *DiscordSource) Close() error
- func (s *DiscordSource) GetState() map[string]string
- func (s *DiscordSource) Ping(ctx context.Context) error
- func (s *DiscordSource) Read(ctx context.Context) (hermod.Message, error)
- func (s *DiscordSource) SetBaseURL(u string)
- func (s *DiscordSource) SetState(state map[string]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscordSource ¶
type DiscordSource struct {
// contains filtered or unexported fields
}
DiscordSource implements the hermod.Source interface for polling Discord messages.
func NewDiscordSource ¶
func NewDiscordSource(token, channelID string, interval time.Duration) *DiscordSource
NewDiscordSource creates a new DiscordSource.
func (*DiscordSource) Close ¶
func (s *DiscordSource) Close() error
Close closes the Discord source.
func (*DiscordSource) GetState ¶
func (s *DiscordSource) GetState() map[string]string
GetState returns the current state of the source.
func (*DiscordSource) Ping ¶
func (s *DiscordSource) Ping(ctx context.Context) error
Ping checks the connection to Discord.
func (*DiscordSource) SetBaseURL ¶
func (s *DiscordSource) SetBaseURL(u string)
SetBaseURL overrides the vendor endpoint this connector talks to.
The hostname is hardcoded in the constructor, which made the connector impossible to exercise without dialling the live API -- so it sat outside the conformance suite, untested, while connectors that took an address were covered. This is the seam that closes that gap: point it at a test server or a dead address and the contract can be checked offline.
An empty string leaves the default in place, so a caller that has nothing to override does not have to special-case it.
func (*DiscordSource) SetState ¶
func (s *DiscordSource) SetState(state map[string]string)
SetState sets the current state of the source.