Skip to content

Commit b38d23c

Browse files
committed
fix not working @everyone pings
1 parent 7abdb21 commit b38d23c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

redditbot/subscriptions.go

+17-3
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,24 @@ func (b *Bot) sendPost(sub Subscription, post RedditPost) bool {
216216
}
217217

218218
if sub.RoleID != 0 {
219-
webhookMessageCreate.Content = discord.RoleMention(sub.RoleID) + "\n" + webhookMessageCreate.Content
220-
webhookMessageCreate.AllowedMentions = &discord.AllowedMentions{
221-
Roles: []snowflake.ID{sub.RoleID},
219+
var (
220+
mentionContent string
221+
allowedMentions discord.AllowedMentions
222+
)
223+
if sub.RoleID == sub.GuildID {
224+
mentionContent = "@everyone"
225+
allowedMentions = discord.AllowedMentions{
226+
Parse: []discord.AllowedMentionType{discord.AllowedMentionTypeEveryone},
227+
}
228+
} else {
229+
mentionContent = discord.RoleMention(sub.RoleID)
230+
allowedMentions = discord.AllowedMentions{
231+
Roles: []snowflake.ID{sub.RoleID},
232+
}
222233
}
234+
235+
webhookMessageCreate.Content = mentionContent + "\n" + webhookMessageCreate.Content
236+
webhookMessageCreate.AllowedMentions = &allowedMentions
223237
}
224238

225239
postsSent.With(prometheus.Labels{

0 commit comments

Comments
 (0)