Documentation
¶
Index ¶
- type Client
- type ClientImpl
- func (c *ClientImpl) Close(ctx context.Context)
- func (c *ClientImpl) CreateContent(content string, opts ...rest.RequestOpt) (*discord.Message, error)
- func (c *ClientImpl) CreateEmbeds(embeds []discord.Embed, opts ...rest.RequestOpt) (*discord.Message, error)
- func (c *ClientImpl) CreateMessage(messageCreate discord.WebhookMessageCreate, opts ...rest.RequestOpt) (*discord.Message, error)
- func (c *ClientImpl) CreateMessageInThread(messageCreate discord.WebhookMessageCreate, threadID snowflake.Snowflake, ...) (*discord.Message, error)
- func (c *ClientImpl) DeleteMessage(messageID snowflake.Snowflake, opts ...rest.RequestOpt) error
- func (c *ClientImpl) DeleteMessageInThread(messageID snowflake.Snowflake, threadID snowflake.Snowflake, ...) error
- func (c *ClientImpl) DeleteWebhook(opts ...rest.RequestOpt) error
- func (c *ClientImpl) GetWebhook(opts ...rest.RequestOpt) (*discord.IncomingWebhook, error)
- func (c *ClientImpl) ID() snowflake.Snowflake
- func (c *ClientImpl) Rest() rest.Webhooks
- func (c *ClientImpl) Token() string
- func (c *ClientImpl) URL() string
- func (c *ClientImpl) UpdateContent(messageID snowflake.Snowflake, content string, opts ...rest.RequestOpt) (*discord.Message, error)
- func (c *ClientImpl) UpdateEmbeds(messageID snowflake.Snowflake, embeds []discord.Embed, opts ...rest.RequestOpt) (*discord.Message, error)
- func (c *ClientImpl) UpdateMessage(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, ...) (*discord.Message, error)
- func (c *ClientImpl) UpdateMessageInThread(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, ...) (*discord.Message, error)
- func (c *ClientImpl) UpdateWebhook(webhookUpdate discord.WebhookUpdateWithToken, opts ...rest.RequestOpt) (*discord.IncomingWebhook, error)
- type Config
- type ConfigOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // ID returns the configured Webhook id ID() snowflake.Snowflake // Token returns the configured Webhook token Token() string // URL returns the full Webhook URL URL() string // Close closes all connections the Webhook Client has open Close(ctx context.Context) // Rest returns the underlying rest.Webhooks Rest() rest.Webhooks // GetWebhook fetches the current Webhook from discord GetWebhook(opts ...rest.RequestOpt) (*discord.IncomingWebhook, error) // UpdateWebhook updates the current Webhook UpdateWebhook(webhookUpdate discord.WebhookUpdateWithToken, opts ...rest.RequestOpt) (*discord.IncomingWebhook, error) // DeleteWebhook deletes the current Webhook DeleteWebhook(opts ...rest.RequestOpt) error // CreateMessage creates a new Message from the discord.WebhookMessageCreate CreateMessage(messageCreate discord.WebhookMessageCreate, opts ...rest.RequestOpt) (*discord.Message, error) // CreateMessageInThread creates a new Message from the discord.WebhookMessageCreate in the provided thread CreateMessageInThread(messageCreate discord.WebhookMessageCreate, threadID snowflake.Snowflake, opts ...rest.RequestOpt) (*discord.Message, error) // CreateContent creates a new Message from the provided content CreateContent(content string, opts ...rest.RequestOpt) (*discord.Message, error) // CreateEmbeds creates a new Message from the provided discord.Embed(s) CreateEmbeds(embeds []discord.Embed, opts ...rest.RequestOpt) (*discord.Message, error) // UpdateMessage updates an already sent Webhook Message with the discord.WebhookMessageUpdate UpdateMessage(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error) // UpdateMessageInThread updates an already sent Webhook Message with the discord.WebhookMessageUpdate in the provided thread UpdateMessageInThread(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, threadID snowflake.Snowflake, opts ...rest.RequestOpt) (*discord.Message, error) // UpdateContent updates an already sent Webhook Message with the content UpdateContent(messageID snowflake.Snowflake, content string, opts ...rest.RequestOpt) (*discord.Message, error) // UpdateEmbeds updates an already sent Webhook Message with the discord.Embed(s) UpdateEmbeds(messageID snowflake.Snowflake, embeds []discord.Embed, opts ...rest.RequestOpt) (*discord.Message, error) // DeleteMessage deletes an already sent Webhook Message DeleteMessage(messageID snowflake.Snowflake, opts ...rest.RequestOpt) error // DeleteMessageInThread deletes an already sent Webhook Message in the provided thread DeleteMessageInThread(messageID snowflake.Snowflake, threadID snowflake.Snowflake, opts ...rest.RequestOpt) error }
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
ClientImpl is used to interact with the discord webhook api
func (*ClientImpl) Close ¶
func (c *ClientImpl) Close(ctx context.Context)
Close closes all connections the webhook client has open
func (*ClientImpl) CreateContent ¶
func (c *ClientImpl) CreateContent(content string, opts ...rest.RequestOpt) (*discord.Message, error)
CreateContent creates a new message from the provided content
func (*ClientImpl) CreateEmbeds ¶
func (c *ClientImpl) CreateEmbeds(embeds []discord.Embed, opts ...rest.RequestOpt) (*discord.Message, error)
CreateEmbeds creates a new message from the provided embeds
func (*ClientImpl) CreateMessage ¶
func (c *ClientImpl) CreateMessage(messageCreate discord.WebhookMessageCreate, opts ...rest.RequestOpt) (*discord.Message, error)
CreateMessage creates a new message from the discord.WebhookMessageCreate
func (*ClientImpl) CreateMessageInThread ¶
func (c *ClientImpl) CreateMessageInThread(messageCreate discord.WebhookMessageCreate, threadID snowflake.Snowflake, opts ...rest.RequestOpt) (*discord.Message, error)
CreateMessageInThread creates a new Message in the provided thread
func (*ClientImpl) DeleteMessage ¶
func (c *ClientImpl) DeleteMessage(messageID snowflake.Snowflake, opts ...rest.RequestOpt) error
DeleteMessage deletes an already sent webhook message
func (*ClientImpl) DeleteMessageInThread ¶
func (c *ClientImpl) DeleteMessageInThread(messageID snowflake.Snowflake, threadID snowflake.Snowflake, opts ...rest.RequestOpt) error
DeleteMessageInThread deletes an already sent webhook message in a thread
func (*ClientImpl) DeleteWebhook ¶
func (c *ClientImpl) DeleteWebhook(opts ...rest.RequestOpt) error
DeleteWebhook deletes the current webhook
func (*ClientImpl) GetWebhook ¶
func (c *ClientImpl) GetWebhook(opts ...rest.RequestOpt) (*discord.IncomingWebhook, error)
GetWebhook fetches the current webhook from discord
func (*ClientImpl) ID ¶
func (c *ClientImpl) ID() snowflake.Snowflake
func (*ClientImpl) Rest ¶
func (c *ClientImpl) Rest() rest.Webhooks
func (*ClientImpl) Token ¶
func (c *ClientImpl) Token() string
func (*ClientImpl) UpdateContent ¶
func (c *ClientImpl) UpdateContent(messageID snowflake.Snowflake, content string, opts ...rest.RequestOpt) (*discord.Message, error)
UpdateContent updates an already sent webhook message with the content
func (*ClientImpl) UpdateEmbeds ¶
func (c *ClientImpl) UpdateEmbeds(messageID snowflake.Snowflake, embeds []discord.Embed, opts ...rest.RequestOpt) (*discord.Message, error)
UpdateEmbeds updates an already sent webhook message with the embeds
func (*ClientImpl) UpdateMessage ¶
func (c *ClientImpl) UpdateMessage(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)
UpdateMessage updates an already sent webhook message with the discord.WebhookMessageUpdate
func (*ClientImpl) UpdateMessageInThread ¶
func (c *ClientImpl) UpdateMessageInThread(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, threadID snowflake.Snowflake, opts ...rest.RequestOpt) (*discord.Message, error)
UpdateMessageInThread updates an already sent webhook message with the discord.WebhookMessageUpdate in a thread
func (*ClientImpl) UpdateWebhook ¶
func (c *ClientImpl) UpdateWebhook(webhookUpdate discord.WebhookUpdateWithToken, opts ...rest.RequestOpt) (*discord.IncomingWebhook, error)
UpdateWebhook updates the current webhook
type Config ¶
type Config struct { Logger log.Logger RestClient rest.Client RestClientConfigOpts []rest.ConfigOpt Webhooks rest.Webhooks DefaultAllowedMentions *discord.AllowedMentions }
Config is the configuration for the webhook client
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig is the default configuration for the webhook client
type ConfigOpt ¶
type ConfigOpt func(config *Config)
ConfigOpt is used to provide optional parameters to the webhook client
func WithDefaultAllowedMentions ¶
func WithDefaultAllowedMentions(allowedMentions discord.AllowedMentions) ConfigOpt
WithDefaultAllowedMentions sets the default allowed mentions for the webhook client
func WithLogger ¶
WithLogger sets the logger for the webhook client
func WithRestClient ¶
WithRestClient sets the rest client for the webhook client
func WithRestClientConfigOpts ¶
WithRestClientConfigOpts sets the rest client configuration for the webhook client
func WithWebhooks ¶
WithWebhooks sets the webhook service for the webhook client