forked from jshiffer/matterbridge
parent
bab385c342
commit
8522d8f29c
@ -291,6 +291,7 @@ var (
|
|||||||
channelRE = regexp.MustCompile(`<#[a-zA-Z0-9]+\|(.+?)>`)
|
channelRE = regexp.MustCompile(`<#[a-zA-Z0-9]+\|(.+?)>`)
|
||||||
variableRE = regexp.MustCompile(`<!((?:subteam\^)?[a-zA-Z0-9]+)(?:\|@?(.+?))?>`)
|
variableRE = regexp.MustCompile(`<!((?:subteam\^)?[a-zA-Z0-9]+)(?:\|@?(.+?))?>`)
|
||||||
urlRE = regexp.MustCompile(`<(.*?)(\|.*?)?>`)
|
urlRE = regexp.MustCompile(`<(.*?)(\|.*?)?>`)
|
||||||
|
codeFenceRE = regexp.MustCompile(`(?m)^` + "```" + `\w+$`)
|
||||||
topicOrPurposeRE = regexp.MustCompile(`(?s)(@.+) (cleared|set)(?: the)? channel (topic|purpose)(?:: (.*))?`)
|
topicOrPurposeRE = regexp.MustCompile(`(?s)(@.+) (cleared|set)(?: the)? channel (topic|purpose)(?:: (.*))?`)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -353,6 +354,10 @@ func (b *Bslack) replaceURL(text string) string {
|
|||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Bslack) replaceCodeFence(text string) string {
|
||||||
|
return codeFenceRE.ReplaceAllString(text, "```")
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Bslack) handleRateLimit(err error) error {
|
func (b *Bslack) handleRateLimit(err error) error {
|
||||||
rateLimit, ok := err.(*slack.RateLimitedError)
|
rateLimit, ok := err.(*slack.RateLimitedError)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -188,6 +188,8 @@ func (b *Bslack) Send(msg config.Message) (string, error) {
|
|||||||
b.Log.Debugf("=> Receiving %#v", msg)
|
b.Log.Debugf("=> Receiving %#v", msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg.Text = b.replaceCodeFence(msg.Text)
|
||||||
|
|
||||||
// Make a action /me of the message
|
// Make a action /me of the message
|
||||||
if msg.Event == config.EventUserAction {
|
if msg.Event == config.EventUserAction {
|
||||||
msg.Text = "_" + msg.Text + "_"
|
msg.Text = "_" + msg.Text + "_"
|
||||||
|
Loading…
Reference in New Issue
Block a user