Attach extraction method to bridge struct

This commit is contained in:
Duco van Amstel
2018-11-26 09:19:45 +00:00
committed by GitHub
parent 4837dacf3d
commit d122bc8f9a

View File

@@ -269,7 +269,7 @@ var (
topicOrPurposeRE = regexp.MustCompile(`(?s)(@.+) (cleared|set)(?: the)? channel (topic|purpose)(?:: (.*))?`) topicOrPurposeRE = regexp.MustCompile(`(?s)(@.+) (cleared|set)(?: the)? channel (topic|purpose)(?:: (.*))?`)
) )
func extractTopicOrPurpose(text string) (string, string) { func (b *Bslack) extractTopicOrPurpose(text string) (string, string) {
r := topicOrPurposeRE.FindStringSubmatch(text) r := topicOrPurposeRE.FindStringSubmatch(text)
if len(r) == 5 { if len(r) == 5 {
action, updateType, extracted := r[2], r[3], r[4] action, updateType, extracted := r[2], r[3], r[4]
@@ -281,7 +281,7 @@ func extractTopicOrPurpose(text string) (string, string) {
} }
} }
b.Log.Warnf("Encountered channel topic or purpose change message with unexpected format: %s", text) b.Log.Warnf("Encountered channel topic or purpose change message with unexpected format: %s", text)
return unknown, "" return "unknown", ""
} }
// @see https://api.slack.com/docs/message-formatting#linking_to_channels_and_users // @see https://api.slack.com/docs/message-formatting#linking_to_channels_and_users