summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-01-27 23:59:24 +0100
committerWim <wim@42.be>2017-01-27 23:59:24 +0100
commitdcccd434276c0e7e263e7567af63d6afd2712507 (patch)
tree54d237dd879614275e94ba2a21a660ecdf324287 /bridge
parent397b8ff892b61a80a4940c8b81edddbc8df5cf66 (diff)
downloadmatterbridge-msglm-dcccd434276c0e7e263e7567af63d6afd2712507.tar.gz
matterbridge-msglm-dcccd434276c0e7e263e7567af63d6afd2712507.tar.bz2
matterbridge-msglm-dcccd434276c0e7e263e7567af63d6afd2712507.zip
Use unknown as username if unsigned channel (telegram)
Diffstat (limited to 'bridge')
-rw-r--r--bridge/telegram/telegram.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go
index e17c7801..38d7fd12 100644
--- a/bridge/telegram/telegram.go
+++ b/bridge/telegram/telegram.go
@@ -135,9 +135,9 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
if 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
if update.Message != nil {
@@ -146,11 +146,16 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
if 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}
}
}