hikari.api.cache
#
Core interface for a cache implementation.
Cache
#
Bases: ABC
Interface describing the operations a cache component should provide.
This will be used by the gateway to cache specific types of objects that the application should attempt to remember for later, depending on how this is implemented. The requirement for this stems from the assumption by Discord that bot applications will maintain some form of "memory" of the events that occur.
The implementation may choose to use a simple in-memory collection of objects, or may decide to use a distributed system such as a Redis cache for cross-process bots.
settings
abstractmethod
property
#
settings: CacheSettings
Get the configured settings for this cache.
get_available_guild
abstractmethod
#
get_available_guild(
guild: SnowflakeishOr[PartialGuild],
) -> Optional[GatewayGuild]
Get the object of an available guild from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GatewayGuild]
|
The object of the guild if found, else |
get_available_guilds_view
abstractmethod
#
get_available_guilds_view() -> CacheView[Snowflake, GatewayGuild]
Get a view of the available guild objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GatewayGuild]
|
A view of guild IDs to the guild objects found in the cache. |
get_dm_channel_id
abstractmethod
#
get_dm_channel_id(user: SnowflakeishOr[PartialUser]) -> Optional[Snowflake]
Get the DM channel ID for a user.
PARAMETER | DESCRIPTION |
---|---|
user |
Object or ID of the user to get the DM channel ID for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Snowflake]
|
ID of the DM channel which was found cached for the supplied user or
|
get_dm_channel_ids_view
abstractmethod
#
get_emoji
abstractmethod
#
get_emoji(emoji: SnowflakeishOr[CustomEmoji]) -> Optional[KnownCustomEmoji]
Get a known custom emoji from the cache.
PARAMETER | DESCRIPTION |
---|---|
emoji |
Object or ID of the emoji to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[KnownCustomEmoji]
|
The object of the emoji that was found in the cache or |
get_emojis_view
abstractmethod
#
get_emojis_view() -> CacheView[Snowflake, KnownCustomEmoji]
Get a view of the known custom emoji objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, KnownCustomEmoji]
|
A view of emoji IDs to objects of the known custom emojis found in the cache. |
get_emojis_view_for_guild
abstractmethod
#
get_emojis_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, KnownCustomEmoji]
Get a view of the known custom emojis cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached emoji objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, KnownCustomEmoji]
|
A view of emoji IDs to objects of emojis found in the cache for the specified guild. |
get_guild
abstractmethod
#
get_guild(guild: SnowflakeishOr[PartialGuild]) -> Optional[GatewayGuild]
Get a guild from the cache.
Warning
This will return a guild regardless of whether it is available or
not. To only query available guilds, use hikari.api.cache.Cache.get_available_guild
instead. Likewise, to only query unavailable guilds, use
hikari.api.cache.Cache.get_unavailable_guild
.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GatewayGuild]
|
The object of the guild if found, else |
get_guild_channel
abstractmethod
#
get_guild_channel(
channel: SnowflakeishOr[PartialChannel],
) -> Optional[PermissibleGuildChannel]
Get a guild channel from the cache.
PARAMETER | DESCRIPTION |
---|---|
channel |
Object or ID of the guild channel to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[PermissibleGuildChannel]
|
The object of the guild channel that was found in the cache or
|
get_guild_channels_view
abstractmethod
#
get_guild_channels_view() -> CacheView[Snowflake, PermissibleGuildChannel]
Get a view of the guild channels in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, PermissibleGuildChannel]
|
A view of channel IDs to objects of the guild channels found in the cache. |
get_guild_channels_view_for_guild
abstractmethod
#
get_guild_channels_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, PermissibleGuildChannel]
Get a view of the guild channels in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached channels for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, PermissibleGuildChannel]
|
A view of channel IDs to objects of the guild channels found in the cache for the specified guild. |
get_guilds_view
abstractmethod
#
get_guilds_view() -> CacheView[Snowflake, GatewayGuild]
Get a view of all the guild objects in the cache regardless if availability.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GatewayGuild]
|
A view of guild IDs to the guild objects found in the cache. |
get_invite
abstractmethod
#
get_invite(code: Union[InviteCode, str]) -> Optional[InviteWithMetadata]
Get an invite object from the cache.
PARAMETER | DESCRIPTION |
---|---|
code |
The object or string code of the invite to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[InviteWithMetadata]
|
The object of the invite that was found in the cache or |
get_invites_view
abstractmethod
#
get_invites_view() -> CacheView[str, InviteWithMetadata]
Get a view of the invite objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of string codes to objects of the invites that were found in the cache. |
get_invites_view_for_channel
abstractmethod
#
get_invites_view_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[str, InviteWithMetadata]
Get a view of the invite objects in the cache for a specified channel.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get invite objects for.
TYPE:
|
channel |
Object or ID of the channel to get invite objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of string codes to objects of the invites there were found in the cache for the specified channel. |
get_invites_view_for_guild
abstractmethod
#
get_invites_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[str, InviteWithMetadata]
Get a view of the invite objects in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get invite objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of string code to objects of the invites that were found in the cache for the specified guild. |
get_me
abstractmethod
#
get_member
abstractmethod
#
get_member(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[Member]
Get a member object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get a cached member for.
TYPE:
|
user |
Object or ID of the user to get a cached member for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Member]
|
The object of the member found in the cache, else |
get_members_view
abstractmethod
#
get_members_view_for_guild
abstractmethod
#
get_members_view_for_guild(
guild_id: Snowflakeish,
) -> CacheView[Snowflake, Member]
Get a view of the members cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild_id |
The ID of the guild to get the cached member view for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, Member]
|
The view of user IDs to the members cached for the specified guild. |
get_message
abstractmethod
#
get_message(message: SnowflakeishOr[PartialMessage]) -> Optional[Message]
Get a message object from the cache.
PARAMETER | DESCRIPTION |
---|---|
message |
Object or ID of the message to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Message]
|
The object of the message found in the cache or |
get_messages_view
abstractmethod
#
get_presence
abstractmethod
#
get_presence(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[MemberPresence]
Get a presence object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get a presence for.
TYPE:
|
user |
Object or ID of the user to get a presence for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[MemberPresence]
|
The object of the presence that was found in the cache or
|
get_presences_view
abstractmethod
#
get_presences_view() -> (
CacheView[Snowflake, CacheView[Snowflake, MemberPresence]]
)
get_presences_view_for_guild
abstractmethod
#
get_presences_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, MemberPresence]
Get a view of the presence objects in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached presence objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, MemberPresence]
|
A view of user IDs to objects of the presence found in the cache for the specified guild. |
get_role
abstractmethod
#
get_role(role: SnowflakeishOr[PartialRole]) -> Optional[Role]
Get a role object from the cache.
PARAMETER | DESCRIPTION |
---|---|
role |
Object or ID of the role to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Role]
|
The object of the role found in the cache or |
get_roles_view
abstractmethod
#
get_roles_view_for_guild
abstractmethod
#
get_roles_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, Role]
Get a view of the roles in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached roles for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, Role]
|
A view of role IDs to objects of the roles that were found in the cache for the specified guild. |
get_sticker
abstractmethod
#
get_sticker(sticker: SnowflakeishOr[GuildSticker]) -> Optional[GuildSticker]
Get a sticker from the cache.
PARAMETER | DESCRIPTION |
---|---|
sticker |
Object or ID of the sticker to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GuildSticker]
|
The object of the sticker that was found in the cache or |
get_stickers_view
abstractmethod
#
get_stickers_view() -> CacheView[Snowflake, GuildSticker]
Get a view of the sticker objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildSticker]
|
A view of sticker IDs to objects of the stickers found in the cache. |
get_stickers_view_for_guild
abstractmethod
#
get_stickers_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, GuildSticker]
Get a view of the known custom emojis cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached sticker objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildSticker]
|
A view of sticker IDs to objects of stickers found in the cache for the specified guild. |
get_thread
abstractmethod
#
get_thread(
thread: SnowflakeishOr[PartialChannel],
) -> Optional[GuildThreadChannel]
Get a thread channel from the cache.
PARAMETER | DESCRIPTION |
---|---|
thread |
Object or ID of the thread to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GuildThreadChannel]
|
The object of the thread that was found in the cache
or |
get_threads_view
abstractmethod
#
get_threads_view() -> CacheView[Snowflake, GuildThreadChannel]
Get a view of the thread channels in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels found in the cache. |
get_threads_view_for_channel
abstractmethod
#
get_threads_view_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[Snowflake, GuildThreadChannel]
Get a view of the thread channels in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached thread channels for.
TYPE:
|
channel |
Object or ID of the channel to get the cached thread channels for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels found in the cache for the specified channel. |
get_threads_view_for_guild
abstractmethod
#
get_threads_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, GuildThreadChannel]
Get a view of the thread channels in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached thread channels for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels found in the cache for the specified guild. |
get_unavailable_guild
abstractmethod
#
get_unavailable_guild(
guild: SnowflakeishOr[PartialGuild],
) -> Optional[GatewayGuild]
Get the object of an unavailable guild from the cache.
Note
Unlike hikari.api.cache.Cache.get_available_guild
, the objects returned by this
method will likely be out of date and inaccurate as they are
considered unavailable, meaning that we are not receiving gateway
events for this guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GatewayGuild]
|
The object of the guild if found, else |
get_unavailable_guilds_view
abstractmethod
#
get_unavailable_guilds_view() -> CacheView[Snowflake, GatewayGuild]
Get a view of the unavailable guild objects in the cache.
Note
Unlike hikari.api.cache.Cache.get_available_guilds_view
, the objects returned by
this method will likely be out of date and inaccurate as they are
considered unavailable, meaning that we are not receiving gateway
events for this guild.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GatewayGuild]
|
A view of guild IDs to the guild objects found in the cache. |
get_user
abstractmethod
#
get_user(user: SnowflakeishOr[PartialUser]) -> Optional[User]
Get a user object from the cache.
PARAMETER | DESCRIPTION |
---|---|
user |
Object or ID of the user to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[User]
|
The object of the user that was found in the cache, else
|
get_users_view
abstractmethod
#
get_voice_state
abstractmethod
#
get_voice_state(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[VoiceState]
Get a voice state object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get a voice state for.
TYPE:
|
user |
Object or ID of the user to get a voice state for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[VoiceState]
|
The object of the voice state that was found in the cache, or
|
get_voice_states_view
abstractmethod
#
get_voice_states_view() -> (
CacheView[Snowflake, CacheView[Snowflake, VoiceState]]
)
Get a view of all the voice state objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, CacheView[Snowflake, VoiceState]]
|
A view of guild IDs to views of user IDs to objects of the voice states that were found in the cache. |
get_voice_states_view_for_channel
abstractmethod
#
get_voice_states_view_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[Snowflake, VoiceState]
Get a view of the voice states cached for a specific channel.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached voice states for.
TYPE:
|
channel |
Object or ID of the channel to get the cached voice states for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, VoiceState]
|
A view of user IDs to objects of the voice states found cached for the specified channel. |
get_voice_states_view_for_guild
abstractmethod
#
get_voice_states_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, VoiceState]
Get a view of the voice states cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached voice states for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, VoiceState]
|
A view of user IDs to objects of the voice states found cached for the specified guild. |
CacheView
#
Bases: Mapping[_KeyT, _ValueT]
, ABC
Interface describing an immutable snapshot view of part of a cache.
This can be treated as a normal typing.Mapping
but with some special methods.
MutableCache
#
Cache that exposes read-only operations as well as mutation operations.
This is only exposed to internal components. There is no guarantee the user-facing cache will provide these methods or not.
settings
abstractmethod
property
#
settings: CacheSettings
Get the configured settings for this cache.
clear_dm_channel_ids
abstractmethod
#
clear_emojis
abstractmethod
#
clear_emojis() -> CacheView[Snowflake, KnownCustomEmoji]
Remove all the known custom emoji objects from the cache.
Note
This will skip emojis that are being kept alive by a reference on a presence entry.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, KnownCustomEmoji]
|
A cache view of emoji IDs to objects of the emojis that were removed from the cache. |
clear_emojis_for_guild
abstractmethod
#
clear_emojis_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, KnownCustomEmoji]
Remove the known custom emoji objects cached for a specific guild.
Note
This will skip emojis that are being kept alive by a reference on a presence entry.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove the cached emoji objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, KnownCustomEmoji]
|
A view of emoji IDs to objects of the emojis that were removed from the cache. |
clear_guild_channels
abstractmethod
#
clear_guild_channels() -> CacheView[Snowflake, PermissibleGuildChannel]
Remove all guild channels from the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, PermissibleGuildChannel]
|
A view of channel IDs to objects of the guild channels that were removed from the cache. |
clear_guild_channels_for_guild
abstractmethod
#
clear_guild_channels_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, PermissibleGuildChannel]
Remove guild channels from the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove cached channels for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, PermissibleGuildChannel]
|
A view of channel IDs to objects of the guild channels that were removed from the cache. |
clear_guilds
abstractmethod
#
clear_guilds() -> CacheView[Snowflake, GatewayGuild]
Remove all the guild objects from the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GatewayGuild]
|
The cache view of guild IDs to guild objects that were removed from the cache. |
clear_invites
abstractmethod
#
clear_invites() -> CacheView[str, InviteWithMetadata]
Remove all the invite objects from the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of invite code strings to objects of the invites that were removed from the cache. |
clear_invites_for_channel
abstractmethod
#
clear_invites_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[str, InviteWithMetadata]
Remove the invite objects in the cache for a specific channel.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove invite objects for.
TYPE:
|
channel |
Object or ID of the channel to remove invite objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of invite code strings to objects of the invites that were removed from the cache for the specified channel. |
clear_invites_for_guild
abstractmethod
#
clear_invites_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[str, InviteWithMetadata]
Remove the invite objects in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove invite objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of invite code strings to objects of the invites that were removed from the cache for the specified guild. |
clear_members
abstractmethod
#
clear_members_for_guild
abstractmethod
#
clear_members_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, Member]
Remove the members for a specific guild from the cache.
Note
This will skip members that are being referenced by other entries in the cache; a matching voice state will keep a member entry alive.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove cached members for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, Member]
|
The view of user IDs to the member objects that were removed from the cache. |
clear_messages
abstractmethod
#
clear_presences
abstractmethod
#
clear_presences() -> CacheView[Snowflake, CacheView[Snowflake, MemberPresence]]
Remove all the presences in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, CacheView[Snowflake, MemberPresence]]
|
A view of guild IDs to views of user IDs to objects of the presences that were removed from the cache. |
clear_presences_for_guild
abstractmethod
#
clear_presences_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, MemberPresence]
Remove the presences in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove presences for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, MemberPresence]
|
A view of user IDs to objects of the presences that were removed from the cache for the specified guild. |
clear_roles
abstractmethod
#
clear_roles_for_guild
abstractmethod
#
clear_roles_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, Role]
Remove role objects from the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove roles for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, Role]
|
A view of role IDs to objects of the roles that were removed from the cache for the specific guild. |
clear_stickers
abstractmethod
#
clear_stickers() -> CacheView[Snowflake, GuildSticker]
Remove all the sticker objects from the cache.
Note
This will skip stickers that are being kept alive by a reference.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildSticker]
|
A cache view of sticker IDs to objects of the stickers that were removed from the cache. |
clear_stickers_for_guild
abstractmethod
#
clear_stickers_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, GuildSticker]
Remove the known custom emoji objects cached for a specific guild.
Note
This will skip stickers that are being kept alive by a reference.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove the cached sticker objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildSticker]
|
A view of sticker IDs to objects of the stickers that were removed from the cache. |
clear_threads
abstractmethod
#
clear_threads() -> CacheView[Snowflake, GuildThreadChannel]
Remove all thread channels from the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels that were removed from the cache. |
clear_threads_for_channel
abstractmethod
#
clear_threads_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[Snowflake, GuildThreadChannel]
Remove thread channels from the cache for a specific channel.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove cached threads for.
TYPE:
|
channel |
Object or ID of the channel to remove cached threads for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels that were removed from the cache. |
clear_threads_for_guild
abstractmethod
#
clear_threads_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, GuildThreadChannel]
Remove thread channels from the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove cached threads for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels that were removed from the cache. |
clear_voice_states
abstractmethod
#
clear_voice_states() -> CacheView[Snowflake, CacheView[Snowflake, VoiceState]]
Remove all voice state objects from the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, CacheView[Snowflake, VoiceState]]
|
A view of guild IDs to views of user IDs to objects of the voice states that were removed from the states. |
clear_voice_states_for_channel
abstractmethod
#
clear_voice_states_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[Snowflake, VoiceState]
Remove the voice state objects cached for a specific channel.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove voice states for.
TYPE:
|
channel |
Object or ID of the channel to remove voice states for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, VoiceState]
|
A view of user IDs to objects of the voice state that were removed from the cache for the specified channel. |
clear_voice_states_for_guild
abstractmethod
#
clear_voice_states_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, VoiceState]
Clear the voice state objects cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove cached voice states for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, VoiceState]
|
A view of user IDs to the voice state objects that were removed from the cache. |
delete_dm_channel_id
abstractmethod
#
delete_dm_channel_id(user: SnowflakeishOr[PartialUser]) -> Optional[Snowflake]
Remove a DM channel ID from the cache.
PARAMETER | DESCRIPTION |
---|---|
user |
Object or ID of the user to remove the cached DM channel ID for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Snowflake]
|
The DM channel ID which was removed from the cache if found, else
|
delete_emoji
abstractmethod
#
delete_emoji(emoji: SnowflakeishOr[CustomEmoji]) -> Optional[KnownCustomEmoji]
Remove a known custom emoji from the cache.
Note
This will not delete emojis that are being kept alive by a reference on a presence entry.
PARAMETER | DESCRIPTION |
---|---|
emoji |
Object or ID of the emoji to remove from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[KnownCustomEmoji]
|
The object of the emoji that was removed from the cache or
|
delete_guild
abstractmethod
#
delete_guild(guild: SnowflakeishOr[PartialGuild]) -> Optional[GatewayGuild]
Remove a guild object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GatewayGuild]
|
The object of the guild that was removed from the cache, will be
|
delete_guild_channel
abstractmethod
#
delete_guild_channel(
channel: SnowflakeishOr[PartialChannel],
) -> Optional[PermissibleGuildChannel]
Remove a guild channel from the cache.
PARAMETER | DESCRIPTION |
---|---|
channel |
Object or ID of the guild channel to remove from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[PermissibleGuildChannel]
|
The object of the guild channel that was removed from the cache if
found, else |
delete_invite
abstractmethod
#
delete_invite(code: Union[InviteCode, str]) -> Optional[InviteWithMetadata]
Remove an invite object from the cache.
PARAMETER | DESCRIPTION |
---|---|
code |
Object or string code of the invite to remove from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[InviteWithMetadata]
|
The object of the invite that was removed from the cache if found,
else |
delete_me
abstractmethod
#
delete_member
abstractmethod
#
delete_member(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[Member]
Remove a member object from the cache.
Note
You cannot delete a member entry that's being referenced by other entries in the cache; a matching voice state will keep a member entry alive.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove a member from the cache for.
TYPE:
|
user |
Object or ID of the user to remove a member from the cache for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Member]
|
The object of the member that was removed from the cache if found,
else |
delete_message
abstractmethod
#
delete_message(message: SnowflakeishOr[PartialMessage]) -> Optional[Message]
Remove a message object from the cache.
PARAMETER | DESCRIPTION |
---|---|
message |
Object or ID of the messages to remove the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Message]
|
The object of the message that was removed from the cache if found,
else |
delete_presence
abstractmethod
#
delete_presence(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[MemberPresence]
Remove a presence from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to remove a presence for.
TYPE:
|
user |
Object or ID of the user to remove a presence for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[MemberPresence]
|
The object of the presence that was removed from the cache if found,
else |
delete_role
abstractmethod
#
delete_role(role: SnowflakeishOr[PartialRole]) -> Optional[Role]
Remove a role object form the cache.
PARAMETER | DESCRIPTION |
---|---|
role |
Object or ID of the role to remove from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Role]
|
The object of the role that was removed from the cache if found,
else |
delete_sticker
abstractmethod
#
delete_sticker(sticker: SnowflakeishOr[GuildSticker]) -> Optional[GuildSticker]
Remove a sticker from the cache.
Note
This will not delete stickers that are being kept alive by a reference.
PARAMETER | DESCRIPTION |
---|---|
sticker |
Object or ID of the sticker to remove from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GuildSticker]
|
The object of the sticker that was removed from the cache or
|
delete_thread
abstractmethod
#
delete_thread(
thread: SnowflakeishOr[PartialChannel],
) -> Optional[GuildThreadChannel]
Remove a thread channel from the cache.
PARAMETER | DESCRIPTION |
---|---|
thread |
Object or ID of the thread to remove from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GuildThreadChannel]
|
The object of the thread that was removed from the cache if
found, else |
delete_voice_state
abstractmethod
#
delete_voice_state(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[VoiceState]
Remove a voice state object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild the voice state to remove is related to.
TYPE:
|
user |
Object or ID of the user who the voice state to remove belongs to.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[VoiceState]
|
The object of the voice state that was removed from the cache if
found, else |
get_available_guild
abstractmethod
#
get_available_guild(
guild: SnowflakeishOr[PartialGuild],
) -> Optional[GatewayGuild]
Get the object of an available guild from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GatewayGuild]
|
The object of the guild if found, else |
get_available_guilds_view
abstractmethod
#
get_available_guilds_view() -> CacheView[Snowflake, GatewayGuild]
Get a view of the available guild objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GatewayGuild]
|
A view of guild IDs to the guild objects found in the cache. |
get_dm_channel_id
abstractmethod
#
get_dm_channel_id(user: SnowflakeishOr[PartialUser]) -> Optional[Snowflake]
Get the DM channel ID for a user.
PARAMETER | DESCRIPTION |
---|---|
user |
Object or ID of the user to get the DM channel ID for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Snowflake]
|
ID of the DM channel which was found cached for the supplied user or
|
get_dm_channel_ids_view
abstractmethod
#
get_emoji
abstractmethod
#
get_emoji(emoji: SnowflakeishOr[CustomEmoji]) -> Optional[KnownCustomEmoji]
Get a known custom emoji from the cache.
PARAMETER | DESCRIPTION |
---|---|
emoji |
Object or ID of the emoji to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[KnownCustomEmoji]
|
The object of the emoji that was found in the cache or |
get_emojis_view
abstractmethod
#
get_emojis_view() -> CacheView[Snowflake, KnownCustomEmoji]
Get a view of the known custom emoji objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, KnownCustomEmoji]
|
A view of emoji IDs to objects of the known custom emojis found in the cache. |
get_emojis_view_for_guild
abstractmethod
#
get_emojis_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, KnownCustomEmoji]
Get a view of the known custom emojis cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached emoji objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, KnownCustomEmoji]
|
A view of emoji IDs to objects of emojis found in the cache for the specified guild. |
get_guild
abstractmethod
#
get_guild(guild: SnowflakeishOr[PartialGuild]) -> Optional[GatewayGuild]
Get a guild from the cache.
Warning
This will return a guild regardless of whether it is available or
not. To only query available guilds, use hikari.api.cache.Cache.get_available_guild
instead. Likewise, to only query unavailable guilds, use
hikari.api.cache.Cache.get_unavailable_guild
.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GatewayGuild]
|
The object of the guild if found, else |
get_guild_channel
abstractmethod
#
get_guild_channel(
channel: SnowflakeishOr[PartialChannel],
) -> Optional[PermissibleGuildChannel]
Get a guild channel from the cache.
PARAMETER | DESCRIPTION |
---|---|
channel |
Object or ID of the guild channel to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[PermissibleGuildChannel]
|
The object of the guild channel that was found in the cache or
|
get_guild_channels_view
abstractmethod
#
get_guild_channels_view() -> CacheView[Snowflake, PermissibleGuildChannel]
Get a view of the guild channels in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, PermissibleGuildChannel]
|
A view of channel IDs to objects of the guild channels found in the cache. |
get_guild_channels_view_for_guild
abstractmethod
#
get_guild_channels_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, PermissibleGuildChannel]
Get a view of the guild channels in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached channels for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, PermissibleGuildChannel]
|
A view of channel IDs to objects of the guild channels found in the cache for the specified guild. |
get_guilds_view
abstractmethod
#
get_guilds_view() -> CacheView[Snowflake, GatewayGuild]
Get a view of all the guild objects in the cache regardless if availability.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GatewayGuild]
|
A view of guild IDs to the guild objects found in the cache. |
get_invite
abstractmethod
#
get_invite(code: Union[InviteCode, str]) -> Optional[InviteWithMetadata]
Get an invite object from the cache.
PARAMETER | DESCRIPTION |
---|---|
code |
The object or string code of the invite to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[InviteWithMetadata]
|
The object of the invite that was found in the cache or |
get_invites_view
abstractmethod
#
get_invites_view() -> CacheView[str, InviteWithMetadata]
Get a view of the invite objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of string codes to objects of the invites that were found in the cache. |
get_invites_view_for_channel
abstractmethod
#
get_invites_view_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[str, InviteWithMetadata]
Get a view of the invite objects in the cache for a specified channel.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get invite objects for.
TYPE:
|
channel |
Object or ID of the channel to get invite objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of string codes to objects of the invites there were found in the cache for the specified channel. |
get_invites_view_for_guild
abstractmethod
#
get_invites_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[str, InviteWithMetadata]
Get a view of the invite objects in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get invite objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[str, InviteWithMetadata]
|
A view of string code to objects of the invites that were found in the cache for the specified guild. |
get_me
abstractmethod
#
get_member
abstractmethod
#
get_member(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[Member]
Get a member object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get a cached member for.
TYPE:
|
user |
Object or ID of the user to get a cached member for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Member]
|
The object of the member found in the cache, else |
get_members_view
abstractmethod
#
get_members_view_for_guild
abstractmethod
#
get_members_view_for_guild(
guild_id: Snowflakeish,
) -> CacheView[Snowflake, Member]
Get a view of the members cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild_id |
The ID of the guild to get the cached member view for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, Member]
|
The view of user IDs to the members cached for the specified guild. |
get_message
abstractmethod
#
get_message(message: SnowflakeishOr[PartialMessage]) -> Optional[Message]
Get a message object from the cache.
PARAMETER | DESCRIPTION |
---|---|
message |
Object or ID of the message to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Message]
|
The object of the message found in the cache or |
get_messages_view
abstractmethod
#
get_presence
abstractmethod
#
get_presence(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[MemberPresence]
Get a presence object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get a presence for.
TYPE:
|
user |
Object or ID of the user to get a presence for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[MemberPresence]
|
The object of the presence that was found in the cache or
|
get_presences_view
abstractmethod
#
get_presences_view() -> (
CacheView[Snowflake, CacheView[Snowflake, MemberPresence]]
)
get_presences_view_for_guild
abstractmethod
#
get_presences_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, MemberPresence]
Get a view of the presence objects in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached presence objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, MemberPresence]
|
A view of user IDs to objects of the presence found in the cache for the specified guild. |
get_role
abstractmethod
#
get_role(role: SnowflakeishOr[PartialRole]) -> Optional[Role]
Get a role object from the cache.
PARAMETER | DESCRIPTION |
---|---|
role |
Object or ID of the role to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Role]
|
The object of the role found in the cache or |
get_roles_view
abstractmethod
#
get_roles_view_for_guild
abstractmethod
#
get_roles_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, Role]
Get a view of the roles in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached roles for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, Role]
|
A view of role IDs to objects of the roles that were found in the cache for the specified guild. |
get_sticker
abstractmethod
#
get_sticker(sticker: SnowflakeishOr[GuildSticker]) -> Optional[GuildSticker]
Get a sticker from the cache.
PARAMETER | DESCRIPTION |
---|---|
sticker |
Object or ID of the sticker to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GuildSticker]
|
The object of the sticker that was found in the cache or |
get_stickers_view
abstractmethod
#
get_stickers_view() -> CacheView[Snowflake, GuildSticker]
Get a view of the sticker objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildSticker]
|
A view of sticker IDs to objects of the stickers found in the cache. |
get_stickers_view_for_guild
abstractmethod
#
get_stickers_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, GuildSticker]
Get a view of the known custom emojis cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached sticker objects for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildSticker]
|
A view of sticker IDs to objects of stickers found in the cache for the specified guild. |
get_thread
abstractmethod
#
get_thread(
thread: SnowflakeishOr[PartialChannel],
) -> Optional[GuildThreadChannel]
Get a thread channel from the cache.
PARAMETER | DESCRIPTION |
---|---|
thread |
Object or ID of the thread to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GuildThreadChannel]
|
The object of the thread that was found in the cache
or |
get_threads_view
abstractmethod
#
get_threads_view() -> CacheView[Snowflake, GuildThreadChannel]
Get a view of the thread channels in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels found in the cache. |
get_threads_view_for_channel
abstractmethod
#
get_threads_view_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[Snowflake, GuildThreadChannel]
Get a view of the thread channels in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached thread channels for.
TYPE:
|
channel |
Object or ID of the channel to get the cached thread channels for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels found in the cache for the specified channel. |
get_threads_view_for_guild
abstractmethod
#
get_threads_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, GuildThreadChannel]
Get a view of the thread channels in the cache for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached thread channels for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GuildThreadChannel]
|
A view of channel IDs to objects of the thread channels found in the cache for the specified guild. |
get_unavailable_guild
abstractmethod
#
get_unavailable_guild(
guild: SnowflakeishOr[PartialGuild],
) -> Optional[GatewayGuild]
Get the object of an unavailable guild from the cache.
Note
Unlike hikari.api.cache.Cache.get_available_guild
, the objects returned by this
method will likely be out of date and inaccurate as they are
considered unavailable, meaning that we are not receiving gateway
events for this guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[GatewayGuild]
|
The object of the guild if found, else |
get_unavailable_guilds_view
abstractmethod
#
get_unavailable_guilds_view() -> CacheView[Snowflake, GatewayGuild]
Get a view of the unavailable guild objects in the cache.
Note
Unlike hikari.api.cache.Cache.get_available_guilds_view
, the objects returned by
this method will likely be out of date and inaccurate as they are
considered unavailable, meaning that we are not receiving gateway
events for this guild.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, GatewayGuild]
|
A view of guild IDs to the guild objects found in the cache. |
get_user
abstractmethod
#
get_user(user: SnowflakeishOr[PartialUser]) -> Optional[User]
Get a user object from the cache.
PARAMETER | DESCRIPTION |
---|---|
user |
Object or ID of the user to get from the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[User]
|
The object of the user that was found in the cache, else
|
get_users_view
abstractmethod
#
get_voice_state
abstractmethod
#
get_voice_state(
guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Optional[VoiceState]
Get a voice state object from the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get a voice state for.
TYPE:
|
user |
Object or ID of the user to get a voice state for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[VoiceState]
|
The object of the voice state that was found in the cache, or
|
get_voice_states_view
abstractmethod
#
get_voice_states_view() -> (
CacheView[Snowflake, CacheView[Snowflake, VoiceState]]
)
Get a view of all the voice state objects in the cache.
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, CacheView[Snowflake, VoiceState]]
|
A view of guild IDs to views of user IDs to objects of the voice states that were found in the cache. |
get_voice_states_view_for_channel
abstractmethod
#
get_voice_states_view_for_channel(
guild: SnowflakeishOr[PartialGuild], channel: SnowflakeishOr[PartialChannel]
) -> CacheView[Snowflake, VoiceState]
Get a view of the voice states cached for a specific channel.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached voice states for.
TYPE:
|
channel |
Object or ID of the channel to get the cached voice states for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, VoiceState]
|
A view of user IDs to objects of the voice states found cached for the specified channel. |
get_voice_states_view_for_guild
abstractmethod
#
get_voice_states_view_for_guild(
guild: SnowflakeishOr[PartialGuild],
) -> CacheView[Snowflake, VoiceState]
Get a view of the voice states cached for a specific guild.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to get the cached voice states for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CacheView[Snowflake, VoiceState]
|
A view of user IDs to objects of the voice states found cached for the specified guild. |
set_dm_channel_id
abstractmethod
#
set_dm_channel_id(
user: SnowflakeishOr[PartialUser], channel: SnowflakeishOr[PartialChannel]
) -> None
Add a DM channel ID to the cache.
PARAMETER | DESCRIPTION |
---|---|
user |
Object or ID of the user to add a DM channel ID to the cache for.
TYPE:
|
channel |
Object or ID of the DM channel to add to the cache.
TYPE:
|
set_emoji
abstractmethod
#
set_emoji(emoji: KnownCustomEmoji) -> None
Add a known custom emoji to the cache.
PARAMETER | DESCRIPTION |
---|---|
emoji |
The object of the known custom emoji to add to the cache.
TYPE:
|
set_guild
abstractmethod
#
set_guild(guild: GatewayGuild) -> None
Add a guild object to the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
The object of the guild to add to the cache.
TYPE:
|
set_guild_availability
abstractmethod
#
set_guild_availability(
guild: SnowflakeishOr[PartialGuild], is_available: bool
) -> None
Set whether a cached guild is available or not.
PARAMETER | DESCRIPTION |
---|---|
guild |
Object or ID of the guild to set the availability for.
TYPE:
|
is_available |
The availability to set for the guild.
TYPE:
|
set_guild_channel
abstractmethod
#
set_guild_channel(channel: PermissibleGuildChannel) -> None
Add a guild channel to the cache.
PARAMETER | DESCRIPTION |
---|---|
channel |
The guild channel based object to add to the cache.
TYPE:
|
set_invite
abstractmethod
#
set_invite(invite: InviteWithMetadata) -> None
Add an invite object to the cache.
PARAMETER | DESCRIPTION |
---|---|
invite |
The object of the invite to add to the cache.
TYPE:
|
set_me
abstractmethod
#
set_me(user: OwnUser) -> None
Set the own user object in the cache.
PARAMETER | DESCRIPTION |
---|---|
user |
The own user object to set in the cache.
TYPE:
|
set_member
abstractmethod
#
set_member(member: Member) -> None
Add a member object to the cache.
PARAMETER | DESCRIPTION |
---|---|
member |
The object of the member to add to the cache.
TYPE:
|
set_message
abstractmethod
#
set_message(message: Message) -> None
Add a message object to the cache.
PARAMETER | DESCRIPTION |
---|---|
message |
The object of the message to add to the cache.
TYPE:
|
set_presence
abstractmethod
#
set_presence(presence: MemberPresence) -> None
Add a presence object to the cache.
PARAMETER | DESCRIPTION |
---|---|
presence |
The object of the presence to add to the cache.
TYPE:
|
set_role
abstractmethod
#
set_role(role: Role) -> None
Add a role object to the cache.
PARAMETER | DESCRIPTION |
---|---|
role |
The object of the role to add to the cache.
TYPE:
|
set_sticker
abstractmethod
#
set_sticker(sticker: GuildSticker) -> None
Add a sticker to the cache.
PARAMETER | DESCRIPTION |
---|---|
sticker |
The object of the sticker to add to the cache.
TYPE:
|
set_thread
abstractmethod
#
set_thread(channel: GuildThreadChannel) -> None
Add a thread channel to the cache.
PARAMETER | DESCRIPTION |
---|---|
channel |
The thread channel based object to add to the cache.
TYPE:
|
set_voice_state
abstractmethod
#
set_voice_state(voice_state: VoiceState) -> None
Add a voice state object to the cache.
PARAMETER | DESCRIPTION |
---|---|
voice_state |
The object of the voice state to add to the cache.
TYPE:
|
update_emoji
abstractmethod
#
update_emoji(
emoji: KnownCustomEmoji,
) -> Tuple[Optional[KnownCustomEmoji], Optional[KnownCustomEmoji]]
Update an emoji object in the cache.
PARAMETER | DESCRIPTION |
---|---|
emoji |
The object of the emoji to update in the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Optional[KnownCustomEmoji], Optional[KnownCustomEmoji]]
|
update_guild
abstractmethod
#
update_guild(
guild: GatewayGuild,
) -> Tuple[Optional[GatewayGuild], Optional[GatewayGuild]]
Update a guild in the cache.
PARAMETER | DESCRIPTION |
---|---|
guild |
The object of the guild to update in the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Optional[GatewayGuild], Optional[GatewayGuild]]
|
update_guild_channel
abstractmethod
#
update_guild_channel(
channel: PermissibleGuildChannel,
) -> Tuple[
Optional[PermissibleGuildChannel], Optional[PermissibleGuildChannel]
]
Update a guild channel in the cache.
PARAMETER | DESCRIPTION |
---|---|
channel |
The object of the channel to update in the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Optional[PermissibleGuildChannel], Optional[PermissibleGuildChannel]]
|
update_invite
abstractmethod
#
update_invite(
invite: InviteWithMetadata,
) -> Tuple[Optional[InviteWithMetadata], Optional[InviteWithMetadata]]
Update an invite in the cache.
PARAMETER | DESCRIPTION |
---|---|
invite |
The object of the invite to update in the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Optional[InviteWithMetadata], Optional[InviteWithMetadata]]
|
update_me
abstractmethod
#
update_member
abstractmethod
#
update_message
abstractmethod
#
update_message(
message: Union[PartialMessage, Message]
) -> Tuple[Optional[Message], Optional[Message]]
update_presence
abstractmethod
#
update_presence(
presence: MemberPresence,
) -> Tuple[Optional[MemberPresence], Optional[MemberPresence]]
Update a presence object in the cache.
PARAMETER | DESCRIPTION |
---|---|
presence |
The object of the presence to update in the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Optional[MemberPresence], Optional[MemberPresence]]
|
update_role
abstractmethod
#
update_thread
abstractmethod
#
update_thread(
thread: GuildThreadChannel,
) -> Tuple[Optional[GuildThreadChannel], Optional[GuildThreadChannel]]
Update a thread channel in the cache.
PARAMETER | DESCRIPTION |
---|---|
thread |
The object of the thread channel to update in the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Optional[GuildThreadChannel], Optional[GuildThreadChannel]]
|
update_voice_state
abstractmethod
#
update_voice_state(
voice_state: VoiceState,
) -> Tuple[Optional[VoiceState], Optional[VoiceState]]
Update a voice state object in the cache.
PARAMETER | DESCRIPTION |
---|---|
voice_state |
The object of the voice state to update in the cache.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Optional[VoiceState], Optional[VoiceState]]
|