mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-14 15:30:27 +00:00
Do not break messages on newline (slack). Closes #258
This commit is contained in:
parent
86cd7f1ba6
commit
90a61f15cc
@ -234,25 +234,23 @@ func (b *Bslack) handleSlack() {
|
|||||||
if message.Text == "" || message.Username == "" {
|
if message.Text == "" || message.Username == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
texts := strings.Split(message.Text, "\n")
|
text := message.Text
|
||||||
for _, text := range texts {
|
text = b.replaceURL(text)
|
||||||
text = b.replaceURL(text)
|
text = html.UnescapeString(text)
|
||||||
text = html.UnescapeString(text)
|
flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account)
|
||||||
flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account)
|
msg := config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username), UserID: message.UserID, ID: "slack " + message.Raw.Timestamp}
|
||||||
msg := config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username), UserID: message.UserID, ID: "slack " + message.Raw.Timestamp}
|
if message.Raw.SubType == "me_message" {
|
||||||
if message.Raw.SubType == "me_message" {
|
msg.Event = config.EVENT_USER_ACTION
|
||||||
msg.Event = config.EVENT_USER_ACTION
|
|
||||||
}
|
|
||||||
if message.Raw.SubType == "channel_leave" || message.Raw.SubType == "channel_join" {
|
|
||||||
msg.Username = "system"
|
|
||||||
msg.Event = config.EVENT_JOIN_LEAVE
|
|
||||||
}
|
|
||||||
// edited messages have a submessage, use this timestamp
|
|
||||||
if message.Raw.SubMessage != nil {
|
|
||||||
msg.ID = "slack " + message.Raw.SubMessage.Timestamp
|
|
||||||
}
|
|
||||||
b.Remote <- msg
|
|
||||||
}
|
}
|
||||||
|
if message.Raw.SubType == "channel_leave" || message.Raw.SubType == "channel_join" {
|
||||||
|
msg.Username = "system"
|
||||||
|
msg.Event = config.EVENT_JOIN_LEAVE
|
||||||
|
}
|
||||||
|
// edited messages have a submessage, use this timestamp
|
||||||
|
if message.Raw.SubMessage != nil {
|
||||||
|
msg.ID = "slack " + message.Raw.SubMessage.Timestamp
|
||||||
|
}
|
||||||
|
b.Remote <- msg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user