Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Latency() time.Duration
- func (c *Client) On(event types.EventName, h gateway.RawHandler)
- func (c *Client) OnCommand(name string, h interaction.Handler)
- func (c *Client) OnComponent(customID string, h interaction.Handler)
- func (c *Client) OnMessageCreate(h func(context.Context, *types.Message))
- func (c *Client) OnModal(customID string, h interaction.Handler)
- func (c *Client) OnReady(h func(context.Context, *types.ReadyEvent))
- func (c *Client) OnSubcommand(command, subcommand string, h interaction.Handler)
- func (c *Client) OnSubcommandGroup(command, group, subcommand string, h interaction.Handler)
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) String() string
- func (c *Client) TriggerTyping(ctx context.Context, channelID types.Snowflake) error
- func (c *Client) UpdatePresence(ctx context.Context, presence types.PresenceUpdate) error
- func (c *Client) ValidateEventIntents(event types.EventName) error
- func (c *Client) WebhookHandler() (http.Handler, error)
- type Config
- type Option
- func WithAppID(appID string) Option
- func WithAutoDefer(autoDefer bool) Option
- func WithCompression(compress bool) Option
- func WithHTTPTimeout(d time.Duration) Option
- func WithIntents(intents types.Intent) Option
- func WithLargeThreshold(threshold int) Option
- func WithMaxRetries(retries int) Option
- func WithPublicKey(publicKey string) Option
- func WithShard(shardID, shardCount int) Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingToken = errors.New("bot token is required") ErrInvalidShard = errors.New("shard id must be non-negative and less than shard count") ErrMissingMessageIntent = errors.New("missing IntentGuildMessages or IntentDirectMessages for message events") )
View Source
var (
ErrMissingPublicKey = errors.New("public key is required for webhook interactions")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Config Config
REST *rest.Client
Gateway *gateway.Client
Router *interaction.Router
Dispatcher *gateway.EventDispatcher
}
func NewWithConfig ¶
func (*Client) OnComponent ¶
func (c *Client) OnComponent(customID string, h interaction.Handler)
func (*Client) OnMessageCreate ¶
func (*Client) OnSubcommand ¶
func (c *Client) OnSubcommand(command, subcommand string, h interaction.Handler)
func (*Client) OnSubcommandGroup ¶
func (c *Client) OnSubcommandGroup(command, group, subcommand string, h interaction.Handler)
func (*Client) TriggerTyping ¶
func (*Client) UpdatePresence ¶
func (*Client) ValidateEventIntents ¶
type Config ¶
type Config struct {
Token string
AppID string
PublicKey string
Intents types.Intent
ShardID int
ShardCount int
HTTPTimeout time.Duration
MaxRetries int
LargeThreshold int
AutoDefer bool
Compress bool
}
func DefaultConfig ¶
type Option ¶
type Option func(*Config)
func WithAutoDefer ¶
func WithCompression ¶
func WithHTTPTimeout ¶
func WithIntents ¶
func WithLargeThreshold ¶
func WithMaxRetries ¶
func WithPublicKey ¶
Click to show internal directories.
Click to hide internal directories.