2020-01-19 02:27:30 +00:00
|
|
|
package discord
|
|
|
|
|
2021-05-20 22:47:44 +00:00
|
|
|
import "time"
|
|
|
|
|
2020-01-19 02:27:30 +00:00
|
|
|
type Webhook struct {
|
2020-07-21 20:27:59 +00:00
|
|
|
ID WebhookID `json:"id"`
|
2020-01-19 02:27:30 +00:00
|
|
|
Type WebhookType `json:"type"`
|
|
|
|
User User `json:"user"` // creator
|
|
|
|
|
2020-07-21 20:27:59 +00:00
|
|
|
GuildID GuildID `json:"guild_id,omitempty"`
|
|
|
|
ChannelID ChannelID `json:"channel_id"`
|
2020-01-19 02:27:30 +00:00
|
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
Avatar Hash `json:"avatar"`
|
|
|
|
Token string `json:"token"` // incoming webhooks only
|
|
|
|
}
|
|
|
|
|
2021-05-20 22:47:44 +00:00
|
|
|
// CreatedAt returns a time object representing when the webhook was created.
|
|
|
|
func (w Webhook) CreatedAt() time.Time {
|
|
|
|
return w.ID.Time()
|
|
|
|
}
|
|
|
|
|
2020-01-19 02:27:30 +00:00
|
|
|
type WebhookType uint8
|
|
|
|
|
|
|
|
const (
|
|
|
|
_ WebhookType = iota
|
|
|
|
IncomingWebhook
|
|
|
|
ChannelFollowerWebhook
|
|
|
|
)
|