Skip to content

Commit

Permalink
Use AllowedMentions instead of manually disabling everyone pings
Browse files Browse the repository at this point in the history
  • Loading branch information
yutotakano authored and siniStar7 committed Sep 7, 2022
1 parent a3a2601 commit 8fde5fe
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,6 @@ func (b *Bridge) loop() {
return "<" + emoji + ">"
})

// Replace everyone and here - https://git.io/Je1yi
content = strings.ReplaceAll(content, "@everyone", "@\u200beveryone")
content = strings.ReplaceAll(content, "@here", "@\u200bhere")

if username == "" {
// System messages come straight from the bot
if _, err := b.discord.Session.ChannelMessageSend(mapping.DiscordChannel, content); err != nil {
Expand All @@ -435,9 +431,16 @@ func (b *Bridge) loop() {
_, err := b.discord.transmitter.Send(
mapping.DiscordChannel,
&discordgo.WebhookParams{
Username: username,
AvatarURL: avatar,
Content: content,
Username: username,
AvatarURL: avatar,
Content: content,
AllowedMentions: &discordgo.MessageAllowedMentions{
// Allow user and role mentions, but not everyone or here mentions
Parse: []discordgo.AllowedMentionType{
discordgo.AllowedMentionTypeRoles,
discordgo.AllowedMentionTypeUsers,
},
},
},
)

Expand Down

0 comments on commit 8fde5fe

Please sign in to comment.