diff options
Diffstat (limited to 'bridge/telegram')
-rw-r--r-- | bridge/telegram/handlers.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go index bbe12437..a74a3f8a 100644 --- a/bridge/telegram/handlers.go +++ b/bridge/telegram/handlers.go @@ -357,6 +357,14 @@ func (b *Btelegram) handleQuote(message, quoteNick, quoteMessage string) string if format == "" { format = "{MESSAGE} (re @{QUOTENICK}: {QUOTEMESSAGE})" } + quoteMessagelength := len(quoteMessage) + if b.GetInt("QuoteLengthLimit") != 0 && quoteMessagelength >= b.GetInt("QuoteLengthLimit") { + runes := []rune(quoteMessage) + quoteMessage = string(runes[0:b.GetInt("QuoteLengthLimit")]) + if quoteMessagelength > b.GetInt("QuoteLengthLimit") { + quoteMessage += "..." + } + } format = strings.Replace(format, "{MESSAGE}", message, -1) format = strings.Replace(format, "{QUOTENICK}", quoteNick, -1) format = strings.Replace(format, "{QUOTEMESSAGE}", quoteMessage, -1) |