Module twilight_cache_inmemory::permission
source · permission-calculator
only.Expand description
Calculate the permissions for members in on a guild- or channel-level with information from the cache.
Required Configuration
Calculating permissions required that some information relevant to the
member, their roles, and the channel or guild is available in the cache.
These will only be stored in the cache when certain ResourceType
s are
enabled. To enable the configurations for both the
InMemoryCachePermissions::in_channel
and
InMemoryCachePermissions::root
operations you must enable
their required ResourceType
s like so:
use twilight_cache_inmemory::{InMemoryCache, ResourceType};
let resource_types = ResourceType::CHANNEL | ResourceType::MEMBER | ResourceType::ROLE;
let cache = InMemoryCache::builder()
.resource_types(resource_types)
.build();
Disabled Member Communication Caveats
The permission calculator checks the current system time against when a
given member had their [communication disabled until]. If a member’s
communication is disabled, then they are restricted to
read-only permissions. If the system time is incorrect then this may
result in invalid behavior. This behavior can be opted out of via
InMemoryCachePermissions::check_member_communication_disabled
.
Structs
- Error calculating permissions with the information in a cache.
- Calculate the permissions of a member with information from the cache.
- Error calculating permissions with information in a cache.
Enums
- Type of
ChannelError
that occurred. - Type of
RootError
that occurred.
Constants
- Permissions a member is allowed to have when their communication has been disabled.