diff options
Diffstat (limited to 'bridge/discord/helpers.go')
-rw-r--r-- | bridge/discord/helpers.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bridge/discord/helpers.go b/bridge/discord/helpers.go index 8bc4f336..9ef234c5 100644 --- a/bridge/discord/helpers.go +++ b/bridge/discord/helpers.go @@ -137,6 +137,7 @@ var ( // See https://discordapp.com/developers/docs/reference#message-formatting. channelMentionRE = regexp.MustCompile("<#[0-9]+>") userMentionRE = regexp.MustCompile("@[^@\n]{1,32}") + emoteRE = regexp.MustCompile(`<a?(:\w+:)\d+>`) ) func (b *Bdiscord) replaceChannelMentions(text string) string { @@ -182,6 +183,10 @@ func (b *Bdiscord) replaceUserMentions(text string) string { return userMentionRE.ReplaceAllStringFunc(text, replaceUserMentionFunc) } +func replaceEmotes(text string) string { + return emoteRE.ReplaceAllString(text, "$1") +} + func (b *Bdiscord) replaceAction(text string) (string, bool) { if strings.HasPrefix(text, "_") && strings.HasSuffix(text, "_") { return text[1 : len(text)-1], true |