aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-12-02 19:25:55 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-12-02 19:25:55 +0300
commitca4923f5635e2696b4e59d01fec4866b568d4f23 (patch)
treefd7c63948bf0cb8579c345aaf5a740f621b18341 /telegram/utils.go
parent9c25d4ad8f2ccfa156a8cfc4c0d4d7dc35bdd95c (diff)
Tests for message formatters, fix broken timestamp tests
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 6ec4405..8b3eb13 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -222,7 +222,7 @@ func (c *Client) formatMessage(chatID int64, messageID int64, preview bool, mess
str.WriteString(fmt.Sprintf("%v | %s | ", message.Id, c.formatContact(message.SenderUserId)))
// TODO: timezone
if !preview {
- str.WriteString(time.Unix(int64(message.Date), 0).Format("02 Jan 2006 15:04:05 | "))
+ str.WriteString(time.Unix(int64(message.Date), 0).UTC().Format("02 Jan 2006 15:04:05 | "))
}
var text string
@@ -344,8 +344,8 @@ func (c *Client) contentToFilename(content client.MessageContent) (*client.File,
case client.TypeMessagePhoto:
photo, _ := content.(*client.MessagePhoto)
sizes := photo.Photo.Sizes
- file := sizes[len(sizes)-1].Photo
if len(sizes) > 1 {
+ file := sizes[len(sizes)-1].Photo
return file, strconv.Itoa(int(file.Id)) + ".jpg"
} else {
return nil, ""