From 2888fd64b0a25e40541d0ac8b4e176ba46905f9f Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 15 May 2017 23:23:10 +0200 Subject: Add UseFirstName option (telegram). Closes #144 --- bridge/config/config.go | 1 + bridge/telegram/telegram.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'bridge') diff --git a/bridge/config/config.go b/bridge/config/config.go index 6f34131f..2cd53666 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -70,6 +70,7 @@ type Protocol struct { UseAPI bool // mattermost, slack UseSASL bool // IRC UseTLS bool // IRC + UseFirstName bool // telegram } type ChannelOptions struct { diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 32269241..8631f2f9 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -98,9 +98,14 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) { message.Text = message.Text + b.Config.EditSuffix } if message.From != nil { - username = message.From.FirstName + if b.Config.UseFirstName { + username = message.From.FirstName + } if username == "" { username = message.From.UserName + if username == "" { + username = message.From.FirstName + } } text = message.Text channel = strconv.FormatInt(message.Chat.ID, 10) -- cgit v1.2.3