Fix member lookup in SanitizeEveryoneMaybe

This commit is contained in:
Ske 2020-05-01 17:03:43 +02:00
parent e133bd657d
commit d0f1aeb548

View File

@ -215,9 +215,8 @@ namespace PluralKit.Bot
private static async Task<string> SanitizeEveryoneMaybe(DiscordMessage message, private static async Task<string> SanitizeEveryoneMaybe(DiscordMessage message,
string messageContents) string messageContents)
{ {
var member = await message.Channel.Guild.GetMemberAsync(message.Author.Id); var permissions = await message.Channel.PermissionsIn(message.Author);
if ((member.PermissionsIn(message.Channel) & Permissions.MentionEveryone) == 0) return messageContents.SanitizeEveryone(); return (permissions & Permissions.MentionEveryone) == 0 ? messageContents.SanitizeEveryone() : messageContents;
return messageContents;
} }
private async Task<bool> EnsureBotPermissions(DiscordChannel channel) private async Task<bool> EnsureBotPermissions(DiscordChannel channel)