mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-24 18:25:40 +00:00
Add QuoteFormat option (telegram). Closes #413
This commit is contained in:
parent
be04d1a862
commit
406a54b597
@ -95,6 +95,7 @@ type Protocol struct {
|
||||
PrefixMessagesWithNick bool // mattemost, slack
|
||||
Protocol string // all protocols
|
||||
QuoteDisable bool // telegram
|
||||
QuoteFormat string // telegram
|
||||
RejoinDelay int // IRC
|
||||
ReplaceMessages [][]string // all protocols
|
||||
ReplaceNicks [][]string // all protocols
|
||||
|
@ -223,7 +223,7 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
||||
usernameReply = "unknown"
|
||||
}
|
||||
if !b.GetBool("QuoteDisable") {
|
||||
rmsg.Text = rmsg.Text + " (re @" + usernameReply + ":" + message.ReplyToMessage.Text + ")"
|
||||
rmsg.Text = b.handleQuote(rmsg.Text, usernameReply, message.ReplyToMessage.Text)
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,3 +415,14 @@ func (b *Btelegram) cacheAvatar(msg *config.Message) (string, error) {
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (b *Btelegram) handleQuote(message, quoteNick, quoteMessage string) string {
|
||||
format := b.GetString("quoteformat")
|
||||
if format == "" {
|
||||
format = "{MESSAGE} (re @{QUOTENICK}: {QUOTEMESSAGE})"
|
||||
}
|
||||
format = strings.Replace(format, "{MESSAGE}", message, -1)
|
||||
format = strings.Replace(format, "{QUOTENICK}", quoteNick, -1)
|
||||
format = strings.Replace(format, "{QUOTEMESSAGE}", quoteMessage, -1)
|
||||
return format
|
||||
}
|
||||
|
@ -815,6 +815,10 @@ UseInsecureURL=false
|
||||
#OPTIONAL (default false)
|
||||
QuoteDisable=false
|
||||
|
||||
#Format quoted/reply messages
|
||||
#OPTIONAL (default "{MESSAGE} (re @{QUOTENICK}: {QUOTEMESSAGE})")
|
||||
QuoteFormat="{MESSAGE} (re @{QUOTENICK}: {QUOTEMESSAGE})"
|
||||
|
||||
#Disable sending of edits to other bridges
|
||||
#OPTIONAL (default false)
|
||||
EditDisable=false
|
||||
|
Loading…
Reference in New Issue
Block a user