5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 20:40:27 +00:00

Use unknown as username if unsigned channel (telegram)

This commit is contained in:
Wim 2017-01-27 23:59:24 +01:00
parent 397b8ff892
commit dcccd43427

View File

@ -135,9 +135,9 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
if username == "" { if username == "" {
username = update.ChannelPost.From.UserName username = update.ChannelPost.From.UserName
} }
text = update.ChannelPost.Text
channel = strconv.FormatInt(update.ChannelPost.Chat.ID, 10)
} }
text = update.ChannelPost.Text
channel = strconv.FormatInt(update.ChannelPost.Chat.ID, 10)
} }
// handle groups // handle groups
if update.Message != nil { if update.Message != nil {
@ -146,11 +146,16 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
if username == "" { if username == "" {
username = update.Message.From.UserName username = update.Message.From.UserName
} }
text = update.Message.Text
channel = strconv.FormatInt(update.Message.Chat.ID, 10)
} }
text = update.Message.Text
channel = strconv.FormatInt(update.Message.Chat.ID, 10)
}
if username == "" {
username = "unknown"
}
if text != "" {
flog.Debugf("Sending message from %s on %s to gateway", username, b.Account)
b.Remote <- config.Message{Username: username, Text: text, Channel: channel, Account: b.Account}
} }
flog.Debugf("Sending message from %s on %s to gateway", username, b.Account)
b.Remote <- config.Message{Username: username, Text: text, Channel: channel, Account: b.Account}
} }
} }