summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-04-16 21:48:53 +0200
committerGitHub <noreply@github.com>2020-04-16 21:48:53 +0200
commit13c90893c7d3b757eb77541c5ec44489fde5661e (patch)
treeae937c4e2f4021716a5e1412ccb8d9927c52a67c /vendor/github.com/matterbridge
parent976fbcd07f61a8d030722a32dfc7ccc9b632399e (diff)
downloadmatterbridge-msglm-13c90893c7d3b757eb77541c5ec44489fde5661e.tar.gz
matterbridge-msglm-13c90893c7d3b757eb77541c5ec44489fde5661e.tar.bz2
matterbridge-msglm-13c90893c7d3b757eb77541c5ec44489fde5661e.zip
Update matterbridge/Rocket.Chat.Go.SDK (#1087)
Diffstat (limited to 'vendor/github.com/matterbridge')
-rw-r--r--vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go4
-rw-r--r--vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/realtime/messages.go22
2 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go
index 8be3e3b6..0c5e9b01 100644
--- a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go
+++ b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go
@@ -7,6 +7,7 @@ type Message struct {
RoomID string `json:"rid"`
Msg string `json:"msg"`
EditedBy string `json:"editedBy,omitempty"`
+ Type string `json:"t,omitempty"`
Groupable bool `json:"groupable,omitempty"`
@@ -16,6 +17,9 @@ type Message struct {
Mentions []User `json:"mentions,omitempty"`
User *User `json:"u,omitempty"`
+
+ Attachments []Attachment `json:"attachments,omitempty"`
+
PostMessage
// Bot interface{} `json:"bot"`
diff --git a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/realtime/messages.go b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/realtime/messages.go
index 9c0c9bb4..3c3f6fe2 100644
--- a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/realtime/messages.go
+++ b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/realtime/messages.go
@@ -191,6 +191,26 @@ func getMessageFromData(data interface{}) *models.Message {
func getMessageFromDocument(arg *gabs.Container) *models.Message {
var ts *time.Time
+ var attachments []models.Attachment
+
+ attachmentSrc, err := arg.Path("attachments").Children()
+ if err != nil {
+ attachments = make([]models.Attachment, 0)
+ } else {
+ attachments = make([]models.Attachment, len(attachmentSrc))
+ for i, attachment := range attachmentSrc {
+ attachments[i] = models.Attachment{
+ Timestamp: stringOrZero(attachment.Path("ts").Data()),
+ Title: stringOrZero(attachment.Path("title").Data()),
+ TitleLink: stringOrZero(attachment.Path("title_link").Data()),
+ TitleLinkDownload: stringOrZero(attachment.Path("title_link_download").Data()),
+ ImageURL: stringOrZero(attachment.Path("image_url").Data()),
+
+ AuthorName: stringOrZero(arg.Path("u.name").Data()),
+ }
+ }
+ }
+
date := stringOrZero(arg.Path("ts.$date").Data())
if len(date) > 0 {
if ti, err := strconv.ParseFloat(date, 64); err == nil {
@@ -202,11 +222,13 @@ func getMessageFromDocument(arg *gabs.Container) *models.Message {
ID: stringOrZero(arg.Path("_id").Data()),
RoomID: stringOrZero(arg.Path("rid").Data()),
Msg: stringOrZero(arg.Path("msg").Data()),
+ Type: stringOrZero(arg.Path("t").Data()),
Timestamp: ts,
User: &models.User{
ID: stringOrZero(arg.Path("u._id").Data()),
UserName: stringOrZero(arg.Path("u.username").Data()),
},
+ Attachments: attachments,
}
}