diff --git a/cmd/bot/main.go b/cmd/bot/main.go index 78b4d32..23d4e9d 100644 --- a/cmd/bot/main.go +++ b/cmd/bot/main.go @@ -32,6 +32,7 @@ func main() { m.HandleMessage(func(m messenger.Message, r *messenger.Response) { fmt.Printf("%v (Sent, %v)\n", m.Text, m.Time.Format(time.UnixDate)) fmt.Println(r.Text("Hello, World!")) + fmt.Println(m.Attachments) }) m.HandleDelivery(func(d messenger.Delivery, r *messenger.Response) { diff --git a/message.go b/message.go index 4115d2f..87b3930 100644 --- a/message.go +++ b/message.go @@ -3,12 +3,13 @@ package messenger import "time" type Message struct { - Sender Sender `json:"-"` - Recipient Recipient `json:"-"` - Time time.Time `json:"-"` - Mid string `json:"mid"` - Text string `json:"text"` - Seq int `json:"seq"` + Sender Sender `json:"-"` + Recipient Recipient `json:"-"` + Time time.Time `json:"-"` + Mid string `json:"mid"` + Text string `json:"text"` + Seq int `json:"seq"` + Attachments []Attachment `json:"attachments"` } type Delivery struct { diff --git a/receiving.go b/receiving.go index c36e772..16df557 100644 --- a/receiving.go +++ b/receiving.go @@ -26,3 +26,12 @@ type Sender struct { type Recipient struct { ID int64 `json:"id"` } + +type Attachment struct { + Type string `json:"type"` + Payload Payload `json:"payload"` +} + +type Payload struct { + URL string `json:"url"` +}