From e986f0d7dfe1ff610483b199d29b31b806e98885 Mon Sep 17 00:00:00 2001 From: gutmet Date: Sun, 20 Sep 2020 09:48:52 +0200 Subject: [PATCH] display urls to included media --- drivel.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivel.go b/drivel.go index a0c2c33..956172e 100644 --- a/drivel.go +++ b/drivel.go @@ -507,15 +507,31 @@ func quote(args []string) error { } type Status struct { - Full_text string - Id_str string - User StatusUser - Quoted_status *Status - Retweeted_status *Status + Full_text string + Id_str string + User StatusUser + Quoted_status *Status + Retweeted_status *Status + Extended_entities Entities +} + +type Entities struct { + Media []Media +} + +type Media struct { + Media_url string } func (m Status) String() string { s := m.User.Name + " " + "(" + m.Id_str + ")" + ":\n" + m.Full_text + allMedia := m.Extended_entities.Media + if len(allMedia) > 0 { + s += "\n\nMedia:" + for _, media := range allMedia { + s += " " + media.Media_url + } + } if m.Quoted_status != nil { s += "\n\nQuotes " + m.Quoted_status.String() } else if m.Retweeted_status != nil {