webhook

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteWithToken

func DeleteWithToken(ctx context.Context, id, token string) error

DeleteWithToken is like Delete on a webhook resource except it does not require authentication.

func Exec

func Exec(ctx context.Context, id, token string, p *discord.WebhookParameters, wait bool) (*discord.Message, error)

Exec executes the webhook with the id id given its token and some execution parameters. wait indicates if we should wait for server confirmation of message send before response. If wait is set to false, the returned Message will be nil even if there is no error.

func GetWithToken

func GetWithToken(ctx context.Context, id, token string) (*discord.Webhook, error)

GetWithToken returns a webhook given its ID an a token. The user field in the returned webhook will be nil.

func ModifyWithToken

func ModifyWithToken(ctx context.Context, id, token string, s *discord.WebhookSettings) (*discord.Webhook, error)

ModifyWithToken is like Modify on a Webhook resource except this call does not require authentication, does not allow to change the channel_id parameter in the webhook settings, and does not return a user in the webhook.

Types

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

Resource is a resource that allows to perform various actions on a Discord webhook. Create one with Client.Webhook.

func NewResource

func NewResource(c resource.RestClient, id string) *Resource

func (*Resource) Delete

func (r *Resource) Delete(ctx context.Context) error

Delete is like DeleteWithReason but with no particular reason.

func (*Resource) DeleteWithReason

func (r *Resource) DeleteWithReason(ctx context.Context, reason string) error

DeleteWithReason deletes the webhook. The given reason will be set in the audit log entry for this action.

func (*Resource) Get

func (r *Resource) Get(ctx context.Context) (*discord.Webhook, error)

Get returns the webhook.

func (*Resource) Modify

func (r *Resource) Modify(ctx context.Context, settings *discord.WebhookSettings) (*discord.Webhook, error)

Modify is like ModifyWithReason but with no particular reason.

func (*Resource) ModifyWithReason

func (r *Resource) ModifyWithReason(ctx context.Context, settings *discord.WebhookSettings, reason string) (*discord.Webhook, error)

ModifyWithReason modifies the webhook. Requires the 'MANAGE_WEBHOOKS' permission. The given reason will be set in the audit log entry for this action.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL