github.com/diamondburned/arikawa/v2@v2.1.0/discord/webhook.go (about)

     1  package discord
     2  
     3  import "time"
     4  
     5  type Webhook struct {
     6  	ID   WebhookID   `json:"id"`
     7  	Type WebhookType `json:"type"`
     8  	User User        `json:"user"` // creator
     9  
    10  	GuildID   GuildID   `json:"guild_id,omitempty"`
    11  	ChannelID ChannelID `json:"channel_id"`
    12  
    13  	Name   string `json:"name"`
    14  	Avatar Hash   `json:"avatar"`
    15  	Token  string `json:"token"` // incoming webhooks only
    16  }
    17  
    18  // CreatedAt returns a time object representing when the webhook was created.
    19  func (w Webhook) CreatedAt() time.Time {
    20  	return w.ID.Time()
    21  }
    22  
    23  type WebhookType uint8
    24  
    25  const (
    26  	_ WebhookType = iota
    27  	IncomingWebhook
    28  	ChannelFollowerWebhook
    29  )