commit c64dc6845cf06c997bb90f7aee9e34a3d518414d
Author: Wim <wim@42.be>
Date: Thu Feb 15 00:07:25 2018 +0000
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index 79acf13..41a07fc 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -22111 +2216 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
var text string
if m.Content != "" {
flog.Debugf("Receiving message %#v", m.Message)
- /*
- if len(m.MentionRoles) > 0 {
- m.Message.Content = b.replaceRoleMentions(m.Message.Content)
- }
- */
m.Message.Content = b.stripCustomoji(m.Message.Content)
m.Message.Content = b.replaceChannelMentions(m.Message.Content)
text, err = m.ContentWithMoreMentionsReplaced(b.c)
@@ -2337 +2286 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
flog.Errorf("ContentWithMoreMentionsReplaced failed: %s", err)
text = m.ContentWithMentionsReplaced()
}
- // text = m.ContentWithMentionsReplaced()
}
rmsg := config.Message{Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg",
@@ -33018 +3246 @@ func (b *bdiscord) getChannelName(id string) string {
return ""
}
-func (b *bdiscord) replaceRoleMentions(text string) string {
- roles, err := b.c.GuildRoles(b.guildID)
- if err != nil {
- flog.Debugf("%#v", string(err.(*discordgo.RESTError).ResponseBody))
- return text
- }
- for _, role := range roles {
- text = strings.Replace(text, "<@&"+role.ID+">", "@"+role.Name, -1)
- }
- return text
-}
-
func (b *bdiscord) replaceChannelMentions(text string) string {
var err error
re := regexp.MustCompile("<#[0-9]+>")