diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-01-21 01:23:15 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-01-21 01:23:15 -0500 |
commit | b4d3fc44c5cc24dcbe4f6fdc0ffe73acdb95cda9 (patch) | |
tree | e50c3073980d421dee57acc5115e351ef965a341 /src/discord/discord.cpp | |
parent | d2cbe00af25bacd40fc4c55191bf9c9073aca1bf (diff) | |
parent | e5af1bdec6e8671f1e752b4480975c8240048113 (diff) | |
download | abaddon-portaudio-b4d3fc44c5cc24dcbe4f6fdc0ffe73acdb95cda9.tar.gz abaddon-portaudio-b4d3fc44c5cc24dcbe4f6fdc0ffe73acdb95cda9.zip |
Merge branch 'master' into folders
Diffstat (limited to 'src/discord/discord.cpp')
-rw-r--r-- | src/discord/discord.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index 15fed3a..360c632 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -341,12 +341,10 @@ bool DiscordClient::HasChannelPermission(Snowflake user_id, Snowflake channel_id } Permission DiscordClient::ComputePermissions(Snowflake member_id, Snowflake guild_id) const { - const auto member = GetMember(member_id, guild_id); - const auto guild = GetGuild(guild_id); - if (!member.has_value() || !guild.has_value()) - return Permission::NONE; + const auto member_roles = m_store.GetMemberRoles(guild_id, member_id); + const auto guild_owner = m_store.GetGuildOwner(guild_id); - if (guild->OwnerID == member_id) + if (guild_owner == member_id) return Permission::ALL; const auto everyone = GetRole(guild_id); @@ -354,7 +352,7 @@ Permission DiscordClient::ComputePermissions(Snowflake member_id, Snowflake guil return Permission::NONE; Permission perms = everyone->Permissions; - for (const auto role_id : member->Roles) { + for (const auto role_id : member_roles) { const auto role = GetRole(role_id); if (role.has_value()) perms |= role->Permissions; @@ -371,8 +369,8 @@ Permission DiscordClient::ComputeOverwrites(Permission base, Snowflake member_id return Permission::ALL; const auto channel = GetChannel(channel_id); - const auto member = GetMember(member_id, *channel->GuildID); - if (!member.has_value() || !channel.has_value()) + const auto member_roles = m_store.GetMemberRoles(*channel->GuildID, member_id); + if (!channel.has_value()) return Permission::NONE; Permission perms = base; @@ -384,7 +382,7 @@ Permission DiscordClient::ComputeOverwrites(Permission base, Snowflake member_id Permission allow = Permission::NONE; Permission deny = Permission::NONE; - for (const auto role_id : member->Roles) { + for (const auto role_id : member_roles) { const auto overwrite = GetPermissionOverwrite(channel_id, role_id); if (overwrite.has_value()) { allow |= overwrite->Allow; |