Add attachment support to text messages
This commit is contained in:
parent
ed71354256
commit
940d2805be
@ -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) {
|
||||
|
@ -9,6 +9,7 @@ type Message struct {
|
||||
Mid string `json:"mid"`
|
||||
Text string `json:"text"`
|
||||
Seq int `json:"seq"`
|
||||
Attachments []Attachment `json:"attachments"`
|
||||
}
|
||||
|
||||
type Delivery struct {
|
||||
|
@ -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"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user