Documentation
¶
Index ¶
- Variables
- type Client
- func (h *Client) Close(ctx context.Context)
- func (h *Client) CreateContent(content string, opts ...rest.RequestOpt) (*Message, error)
- func (h *Client) CreateEmbeds(embeds []discord.Embed, opts ...rest.RequestOpt) (*Message, error)
- func (h *Client) CreateMessage(messageCreate discord.WebhookMessageCreate, opts ...rest.RequestOpt) (*Message, error)
- func (h *Client) CreateMessageInThread(messageCreate discord.WebhookMessageCreate, threadID snowflake.Snowflake, ...) (*Message, error)
- func (h *Client) DeleteMessage(messageID snowflake.Snowflake, opts ...rest.RequestOpt) error
- func (h *Client) DeleteMessageInThread(messageID snowflake.Snowflake, threadID snowflake.Snowflake, ...) error
- func (h *Client) DeleteWebhook(opts ...rest.RequestOpt) error
- func (h *Client) GetWebhook(opts ...rest.RequestOpt) (*Webhook, error)
- func (h *Client) URL() string
- func (h *Client) UpdateContent(messageID snowflake.Snowflake, content string, opts ...rest.RequestOpt) (*Message, error)
- func (h *Client) UpdateEmbeds(messageID snowflake.Snowflake, embeds []discord.Embed, opts ...rest.RequestOpt) (*Message, error)
- func (h *Client) UpdateMessage(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, ...) (*Message, error)
- func (h *Client) UpdateMessageInThread(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, ...) (*Message, error)
- func (h *Client) UpdateWebhook(webhookUpdate discord.WebhookUpdateWithToken, opts ...rest.RequestOpt) (*Webhook, error)
- type Config
- type ConfigOpt
- func WithDefaultAllowedMentions(allowedMentions discord.AllowedMentions) ConfigOpt
- func WithEntityBuilder(entityBuilder EntityBuilder) ConfigOpt
- func WithLogger(logger log.Logger) ConfigOpt
- func WithRestClient(restClient rest.Client) ConfigOpt
- func WithRestClientConfig(restConfig rest.Config) ConfigOpt
- func WithRestClientConfigOpts(opts ...rest.ConfigOpt) ConfigOpt
- func WithWebhookService(webhookService rest.WebhookService) ConfigOpt
- type EntityBuilder
- type Message
- func (m *Message) ActionRows() []discord.ActionRowComponent
- func (m *Message) ButtonByID(customID discord.CustomID) *discord.ButtonComponent
- func (m *Message) Buttons() []discord.ButtonComponent
- func (m *Message) ComponentByID(customID discord.CustomID) discord.InteractiveComponent
- func (m *Message) Delete(opts ...rest.RequestOpt) error
- func (m *Message) InteractiveComponents() []discord.InteractiveComponent
- func (m *Message) SelectMenuByID(customID discord.CustomID) *discord.SelectMenuComponent
- func (m *Message) SelectMenus() []discord.SelectMenuComponent
- func (m *Message) Update(messageUpdate discord.WebhookMessageUpdate, opts ...rest.RequestOpt) (*Message, error)
- type Webhook
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{ RestClientConfig: &rest.DefaultConfig, DefaultAllowedMentions: &discord.DefaultAllowedMentions, }
DefaultConfig is the default configuration for the webhook client
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is used to interact with the discord webhook api
func (*Client) CreateContent ¶
CreateContent creates a new message from the provided content
func (*Client) CreateEmbeds ¶
CreateEmbeds creates a new message from the provided embeds
func (*Client) CreateMessage ¶
func (h *Client) CreateMessage(messageCreate discord.WebhookMessageCreate, opts ...rest.RequestOpt) (*Message, error)
CreateMessage creates a new message from the discord.WebhookMessageCreate
func (*Client) CreateMessageInThread ¶
func (h *Client) CreateMessageInThread(messageCreate discord.WebhookMessageCreate, threadID snowflake.Snowflake, opts ...rest.RequestOpt) (*Message, error)
CreateMessageInThread creates a new Message in the provided thread
func (*Client) DeleteMessage ¶
DeleteMessage deletes an already sent webhook message
func (*Client) DeleteMessageInThread ¶ added in v0.6.8
func (h *Client) DeleteMessageInThread(messageID snowflake.Snowflake, threadID snowflake.Snowflake, opts ...rest.RequestOpt) error
DeleteMessageInThread deletes an already sent webhook message in a thread
func (*Client) DeleteWebhook ¶
func (h *Client) DeleteWebhook(opts ...rest.RequestOpt) error
DeleteWebhook deletes the current webhook
func (*Client) GetWebhook ¶
func (h *Client) GetWebhook(opts ...rest.RequestOpt) (*Webhook, error)
GetWebhook fetches the current webhook from discord
func (*Client) UpdateContent ¶
func (h *Client) UpdateContent(messageID snowflake.Snowflake, content string, opts ...rest.RequestOpt) (*Message, error)
UpdateContent updates an already sent webhook message with the content
func (*Client) UpdateEmbeds ¶
func (h *Client) UpdateEmbeds(messageID snowflake.Snowflake, embeds []discord.Embed, opts ...rest.RequestOpt) (*Message, error)
UpdateEmbeds updates an already sent webhook message with the embeds
func (*Client) UpdateMessage ¶
func (h *Client) UpdateMessage(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, opts ...rest.RequestOpt) (*Message, error)
UpdateMessage updates an already sent webhook message with the discord.WebhookMessageUpdate
func (*Client) UpdateMessageInThread ¶ added in v0.6.8
func (h *Client) UpdateMessageInThread(messageID snowflake.Snowflake, messageUpdate discord.WebhookMessageUpdate, threadID snowflake.Snowflake, opts ...rest.RequestOpt) (*Message, error)
UpdateMessageInThread updates an already sent webhook message with the discord.WebhookMessageUpdate in a thread
func (*Client) UpdateWebhook ¶
func (h *Client) UpdateWebhook(webhookUpdate discord.WebhookUpdateWithToken, opts ...rest.RequestOpt) (*Webhook, error)
UpdateWebhook updates the current webhook
type Config ¶
type Config struct {
Logger log.Logger
RestClient rest.Client
RestClientConfig *rest.Config
WebhookService rest.WebhookService
EntityBuilder EntityBuilder
DefaultAllowedMentions *discord.AllowedMentions
}
Config is the 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 WithEntityBuilder ¶
func WithEntityBuilder(entityBuilder EntityBuilder) ConfigOpt
WithEntityBuilder sets the entity builder 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 WithRestClientConfig ¶
WithRestClientConfig sets the rest client configuration for the webhook client
func WithRestClientConfigOpts ¶
WithRestClientConfigOpts sets the rest client configuration for the webhook client
func WithWebhookService ¶
func WithWebhookService(webhookService rest.WebhookService) ConfigOpt
WithWebhookService sets the webhook service for the webhook client
type EntityBuilder ¶
type EntityBuilder interface {
// WebhookClient returns the underlying webhook client used by this EntityBuilder
WebhookClient() *Client
CreateMessage(message discord.Message) *Message
// CreateWebhook returns a new webhook.Webhook from the discord.Webhook
CreateWebhook(webhook discord.Webhook) *Webhook
}
EntityBuilder is used to transform discord package entities into webhook package entities which hold a reference to the webhook client
func NewEntityBuilder ¶
func NewEntityBuilder(webhookClient *Client) EntityBuilder
NewEntityBuilder returns a new default EntityBuilder
type Message ¶
Message represents a discord.Message which can be directly edited by the Client
func (*Message) ActionRows ¶
func (m *Message) ActionRows() []discord.ActionRowComponent
ActionRows returns all discord.ActionRowComponent(s) from this Message
func (*Message) ButtonByID ¶
func (m *Message) ButtonByID(customID discord.CustomID) *discord.ButtonComponent
ButtonByID returns a ButtonComponent with the specific customID from this Message
func (*Message) Buttons ¶
func (m *Message) Buttons() []discord.ButtonComponent
Buttons returns all ButtonComponent(s) from this Message
func (*Message) ComponentByID ¶
func (m *Message) ComponentByID(customID discord.CustomID) discord.InteractiveComponent
ComponentByID returns the discord.Component with the specific discord.CustomID
func (*Message) Delete ¶
func (m *Message) Delete(opts ...rest.RequestOpt) error
Delete allows you to edit an existing Message sent by you
func (*Message) InteractiveComponents ¶
func (m *Message) InteractiveComponents() []discord.InteractiveComponent
InteractiveComponents returns the discord.InteractiveComponent(s) from this Message
func (*Message) SelectMenuByID ¶
func (m *Message) SelectMenuByID(customID discord.CustomID) *discord.SelectMenuComponent
SelectMenuByID returns a SelectMenuComponent with the specific customID from this Message
func (*Message) SelectMenus ¶
func (m *Message) SelectMenus() []discord.SelectMenuComponent
SelectMenus returns all SelectMenuComponent(s) from this Message
func (*Message) Update ¶
func (m *Message) Update(messageUpdate discord.WebhookMessageUpdate, opts ...rest.RequestOpt) (*Message, error)
Update allows you to edit an existing Message sent by you
type Webhook ¶
type Webhook struct {
discord.IncomingWebhook
WebhookClient *Client
}
Webhook can be used to update or delete the Webhook
func (*Webhook) Delete ¶
func (h *Webhook) Delete(opts ...rest.RequestOpt) error
Delete is used to delete the Webhook
func (*Webhook) Update ¶
func (h *Webhook) Update(webhookUpdate discord.WebhookUpdateWithToken, opts ...rest.RequestOpt) (*Webhook, error)
Update is used to update the Webhook