Documentation
¶
Index ¶
- Constants
- func ExecuteWebhook(apiBaseURL, webhookID, webhookToken string, payload WebhookPayload) error
- func Ptr[T any](v T) *T
- type BotData
- type Channel
- type Client
- func (c *Client) ConnectAndRun() error
- func (c *Client) FetchBotUser() (string, error)
- func (c *Client) GetBotOwnerID() (string, error)
- func (c *Client) GetChannel(channelID string) (*Channel, error)
- func (c *Client) GetMessage(channelID, messageID string) (*Message, error)
- func (c *Client) IsChannelNSFW(channelID string) (bool, error)
- func (c *Client) OnCommand(name string, handler func(c *Client, cmd Command))
- func (c *Client) OnMessage(handler func(c *Client, m Message))
- func (c *Client) SendMessage(channelID string, payload SendMessagePayload) error
- func (c *Client) SetAuthType(tokenType string) error
- func (c *Client) SetBaseURLs(api, cdn, ws string)
- func (c *Client) SetCommandPrefix(prefix string)
- type Command
- type Embed
- type Masquerade
- type Message
- type SendMessagePayload
- type User
- type WebhookPayload
Constants ¶
View Source
const ( DefaultAPIBaseURL = "https://api.stoat.chat" DefaultCDNBaseURL = "https://cdn.stoatusercontent.com" DefaultWSBaseURL = "wss://events.stoat.chat" )
View Source
const ( BotTokenType = "Bot" SessionTokenType = "Session" )
Variables ¶
This section is empty.
Functions ¶
func ExecuteWebhook ¶
func ExecuteWebhook(apiBaseURL, webhookID, webhookToken string, payload WebhookPayload) error
Types ¶
type Client ¶
type Client struct {
APIBaseURL string
CDNBaseURL string
WSBaseURL string
Token string
TokenType string
Prefix string
HTTPClient *http.Client
Conn *websocket.Conn
UserID string
OnMessageHandlers []func(c *Client, m Message)
CommandHandlers map[string]func(c *Client, cmd Command)
}
func (*Client) ConnectAndRun ¶
func (*Client) FetchBotUser ¶
func (*Client) GetBotOwnerID ¶
func (*Client) GetMessage ¶
func (*Client) SendMessage ¶
func (c *Client) SendMessage(channelID string, payload SendMessagePayload) error
func (*Client) SetAuthType ¶
func (*Client) SetBaseURLs ¶
func (*Client) SetCommandPrefix ¶
type Masquerade ¶
type SendMessagePayload ¶
type SendMessagePayload struct {
Content *string `json:"content,omitempty"`
Embeds []Embed `json:"embeds,omitempty"`
Masquerade *Masquerade `json:"masquerade,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.