mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-22 12:50:27 +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
|
PrefixMessagesWithNick bool // mattemost, slack
|
||||||
Protocol string // all protocols
|
Protocol string // all protocols
|
||||||
QuoteDisable bool // telegram
|
QuoteDisable bool // telegram
|
||||||
|
QuoteFormat string // telegram
|
||||||
RejoinDelay int // IRC
|
RejoinDelay int // IRC
|
||||||
ReplaceMessages [][]string // all protocols
|
ReplaceMessages [][]string // all protocols
|
||||||
ReplaceNicks [][]string // all protocols
|
ReplaceNicks [][]string // all protocols
|
||||||
|
@ -223,7 +223,7 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
|||||||
usernameReply = "unknown"
|
usernameReply = "unknown"
|
||||||
}
|
}
|
||||||
if !b.GetBool("QuoteDisable") {
|
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
|
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)
|
#OPTIONAL (default false)
|
||||||
QuoteDisable=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
|
#Disable sending of edits to other bridges
|
||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
EditDisable=false
|
EditDisable=false
|
||||||
|
Loading…
Reference in New Issue
Block a user