fix: include guild member in reproxy permission check

This commit is contained in:
Ske 2022-06-05 23:26:11 +02:00
parent 1448e0f5bd
commit 995fddf929

View File

@ -219,8 +219,8 @@ public class ProxyService
var threadId = messageChannel.IsThread() ? messageChannel.Id : (ulong?)null; var threadId = messageChannel.IsThread() ? messageChannel.Id : (ulong?)null;
var guild = await _rest.GetGuildOrNull(msg.Guild!.Value); var guild = await _rest.GetGuildOrNull(msg.Guild!.Value);
// Grab user permissions // Grab user permissions (the MessageCreateEvent cast is gross but so is our permission handling rn)
var senderPermissions = PermissionExtensions.PermissionsFor(guild, rootChannel, trigger.Author.Id, null); var senderPermissions = PermissionExtensions.PermissionsFor(guild, rootChannel, trigger.Author.Id, ((MessageCreateEvent) trigger).Member);
var allowEveryone = senderPermissions.HasFlag(PermissionSet.MentionEveryone); var allowEveryone = senderPermissions.HasFlag(PermissionSet.MentionEveryone);
// Make sure user has permissions to send messages // Make sure user has permissions to send messages