Documentation ¶
Index ¶
- Constants
- func NewAdapter(provider data.DiscordProvider) (adapter.Adapter, error)
- type Adapter
- func (s *Adapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)
- func (s *Adapter) GetName() string
- func (s *Adapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)
- func (s *Adapter) GetUserInfo(userID string) (*adapter.UserInfo, error)
- func (s *Adapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent
- func (s *Adapter) Send(ctx context.Context, channelID string, elements templates.OutputElements) error
- func (s *Adapter) SendError(ctx context.Context, channelID string, title string, err error) error
- func (s *Adapter) SendText(ctx context.Context, channelID string, message string) error
Constants ¶
const ZeroWidthSpace = "\u200b"
Variables ¶
This section is empty.
Functions ¶
func NewAdapter ¶
func NewAdapter(provider data.DiscordProvider) (adapter.Adapter, error)
NewAdapter will construct a DiscordAdapter instance for a given provider configuration.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is the Discord provider implementation of a relay, which knows how to receive events from the Discord API, translate them into Gort events, and forward them along.
func (*Adapter) GetChannelInfo ¶
func (s *Adapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)
GetChannelInfo provides info on a specific provider channel accessible to the adapter.
func (*Adapter) GetPresentChannels ¶
func (s *Adapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)
GetPresentChannels returns a slice of channels that a user is present in.
func (*Adapter) GetUserInfo ¶
GetUserInfo provides info on a specific provider user accessible to the adapter.
func (*Adapter) Listen ¶
func (s *Adapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent
Listen causes the Adapter to initiate a connection to its provider and begin relaying back events (including errors) via the returned channel.
func (*Adapter) Send ¶ added in v0.9.0
func (s *Adapter) Send(ctx context.Context, channelID string, elements templates.OutputElements) error
Send the contents of a response envelope to a specified channel. If channelID is empty the value of envelope.Request.ChannelID will be used.