hikari.impl.cache#
Basic implementation of a cache for general bots and gateway apps.
CacheImpl #
CacheImpl(app: RESTAware, settings: CacheSettings)
Bases: MutableCache
In-memory cache implementation.
| PARAMETER | DESCRIPTION |
|---|---|
app | The object of the REST aware app this is bound to. TYPE: |
settings | The cache settings to use. TYPE: |
clear_dm_channel_ids #
clear_emojis #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
clear_members_for_guild #
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 #
clear_presences #
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 #
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 #
clear_roles_for_guild #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
delete_dm_channel_id(
user: SnowflakeishOr[PartialUser],
) -> Snowflake | None
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 #
delete_emoji(
emoji: SnowflakeishOr[CustomEmoji],
) -> KnownCustomEmoji | None
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 #
delete_guild(
guild: SnowflakeishOr[PartialGuild],
) -> GatewayGuild | None
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 #
delete_guild_channel(
channel: SnowflakeishOr[PartialChannel],
) -> PermissibleGuildChannel | None
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 #
delete_invite(
code: InviteCode | str,
) -> InviteWithMetadata | None
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_member #
delete_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> Member | None
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 #
delete_message(
message: SnowflakeishOr[PartialMessage],
) -> Message | None
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 #
delete_presence(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> MemberPresence | None
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 #
delete_role(
role: SnowflakeishOr[PartialRole],
) -> Role | None
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 #
delete_sticker(
sticker: SnowflakeishOr[GuildSticker],
) -> GuildSticker | None
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 #
delete_thread(
thread: SnowflakeishOr[PartialChannel],
) -> GuildThreadChannel | None
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 #
delete_voice_state(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> VoiceState | None
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 #
get_available_guild(
guild: SnowflakeishOr[PartialGuild],
) -> GatewayGuild | None
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 #
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 #
get_dm_channel_id(
user: SnowflakeishOr[PartialUser],
) -> Snowflake | None
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 #
get_emoji #
get_emoji(
emoji: SnowflakeishOr[CustomEmoji],
) -> KnownCustomEmoji | None
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 #
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 #
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 #
get_guild(
guild: SnowflakeishOr[PartialGuild],
) -> GatewayGuild | None
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 #
get_guild_channel(
channel: SnowflakeishOr[PartialChannel],
) -> PermissibleGuildChannel | None
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 #
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 #
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 #
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 #
get_invite(
code: InviteCode | str,
) -> InviteWithMetadata | None
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 #
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 #
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 #
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_member #
get_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> Member | None
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 #
get_members_view_for_guild #
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 #
get_message(
message: SnowflakeishOr[PartialMessage],
) -> Message | None
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 #
get_presence #
get_presence(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> MemberPresence | None
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 #
get_presences_view() -> CacheView[
Snowflake, CacheView[Snowflake, MemberPresence]
]
get_presences_view_for_guild #
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 #
get_role(role: SnowflakeishOr[PartialRole]) -> Role | None
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 #
get_roles_view_for_guild #
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 #
get_sticker(
sticker: SnowflakeishOr[GuildSticker],
) -> GuildSticker | None
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 #
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 #
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 #
get_thread(
thread: SnowflakeishOr[PartialChannel],
) -> GuildThreadChannel | None
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 #
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 #
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 #
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 #
get_unavailable_guild(
guild: SnowflakeishOr[PartialGuild],
) -> GatewayGuild | None
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 #
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 #
get_user(user: SnowflakeishOr[PartialUser]) -> User | None
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 #
get_voice_state #
get_voice_state(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> VoiceState | None
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
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 #
set_thread(thread: 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 #
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 #
update_emoji(
emoji: KnownCustomEmoji,
) -> tuple[
KnownCustomEmoji | None, KnownCustomEmoji | None
]
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 #
update_guild(
guild: GatewayGuild,
) -> tuple[GatewayGuild | None, GatewayGuild | None]
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 #
update_guild_channel(
channel: PermissibleGuildChannel,
) -> tuple[
PermissibleGuildChannel | None,
PermissibleGuildChannel | None,
]
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 #
update_invite(
invite: InviteWithMetadata,
) -> tuple[
InviteWithMetadata | None, InviteWithMetadata | None
]
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 #
update_member #
update_message #
update_message(
message: PartialMessage | Message,
) -> tuple[Message | None, Message | None]
update_presence #
update_presence(
presence: MemberPresence,
) -> tuple[MemberPresence | None, MemberPresence | None]
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 #
update_thread #
update_thread(
thread: GuildThreadChannel,
) -> tuple[
GuildThreadChannel | None, GuildThreadChannel | None
]
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 #
update_voice_state(
voice_state: VoiceState,
) -> tuple[VoiceState | None, VoiceState | None]
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]] |