hikari.impl.cache#
Basic implementation of a cache for general bots and gateway apps.
Module Contents#
- class hikari.impl.cache.CacheImpl(app, settings)[source]#
Bases:
hikari.api.cache.MutableCache
In-memory cache implementation.
- Parameters
- app
hikari.traits.RESTAware
The object of the REST aware app this is bound to.
- settings
hikari.impl.config.CacheSettings
The cache settings to use.
- app
- property settings: hikari.impl.config.CacheSettings[source]#
Get the configured settings for this cache.
- clear_dm_channel_ids()[source]#
Remove all the cached DM channel IDs.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.snowflakes.Snowflake
]Cache view of user IDs to DM channel IDs which were cleared from the cache.
- delete_dm_channel_id(user, /)[source]#
Remove a DM channel ID from the cache.
- Parameters
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to remove the cached DM channel ID for.
- user
- Returns
typing.Optional
[hikari.snowflakes.Snowflake
]The DM channel ID which was removed from the cache if found, else
None
.
- get_dm_channel_id(user, /)[source]#
Get the DM channel ID for a user.
- Parameters
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to get the DM channel ID for.
- user
- Returns
typing.Optional
[hikari.snowflakes.Snowflake
]ID of the DM channel which was found cached for the supplied user or
None
.
- get_dm_channel_ids_view()[source]#
Get a view of the cached DM channel IDs.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.snowflakes.Snowflake
]Cache view of user IDs to DM channel IDs.
- set_dm_channel_id(user, channel, /)[source]#
Add a DM channel ID to the cache.
- Parameters
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to add a DM channel ID to the cache for.
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the DM channel to add to the cache.
- user
- clear_emojis()[source]#
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
CacheView
[hikari.snowflakes.Snowflake
,hikari.emojis.KnownCustomEmoji
]A cache view of emoji IDs to objects of the emojis that were removed from the cache.
- clear_emojis_for_guild(guild, /)[source]#
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.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove the cached emoji objects for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.emojis.KnownCustomEmoji
]A view of emoji IDs to objects of the emojis that were removed from the cache.
- delete_emoji(emoji, /)[source]#
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.
- Parameters
- emoji
hikari.snowflakes.SnowflakeishOr
[hikari.emojis.CustomEmoji
] Object or ID of the emoji to remove from the cache.
- emoji
- Returns
typing.Optional
[hikari.emojis.KnownCustomEmoji
]The object of the emoji that was removed from the cache or
None
.
- get_emoji(emoji, /)[source]#
Get a known custom emoji from the cache.
- Parameters
- emoji
hikari.snowflakes.SnowflakeishOr
[hikari.emojis.CustomEmoji
] Object or ID of the emoji to get from the cache.
- emoji
- Returns
typing.Optional
[hikari.emojis.KnownCustomEmoji
]The object of the emoji that was found in the cache or
None
.
- get_emojis_view()[source]#
Get a view of the known custom emoji objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.emojis.KnownCustomEmoji
]A view of emoji IDs to objects of the known custom emojis found in the cache.
- get_emojis_view_for_guild(guild, /)[source]#
Get a view of the known custom emojis cached for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached emoji objects for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.emojis.KnownCustomEmoji
]A view of emoji IDs to objects of emojis found in the cache for the specified guild.
- set_emoji(emoji, /)[source]#
Add a known custom emoji to the cache.
- Parameters
- emoji
hikari.emojis.KnownCustomEmoji
The object of the known custom emoji to add to the cache.
- emoji
- update_emoji(emoji, /)[source]#
Update an emoji object in the cache.
- Parameters
- emoji
hikari.emojis.KnownCustomEmoji
The object of the emoji to update in the cache.
- emoji
- Returns
typing.Tuple
[typing.Optional
[hikari.emojis.KnownCustomEmoji
],typing.Optional
[hikari.emojis.KnownCustomEmoji
]]A tuple of the old cached emoji object if found (else
None
) and the new cached emoji object if it could be cached (elseNone
).
- clear_stickers()[source]#
Remove all the sticker objects from the cache.
Note
This will skip stickers that are being kept alive by a reference.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.stickers.GuildSticker
]A cache view of sticker IDs to objects of the stickers that were removed from the cache.
- clear_stickers_for_guild(guild, /)[source]#
Remove the known custom emoji objects cached for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove the cached sticker objects for.
- .. note::
This will skip stickers that are being kept alive by a reference.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.stickers.GuildSticker
]A view of sticker IDs to objects of the stickers that were removed from the cache.
- get_sticker(sticker, /)[source]#
Get a sticker from the cache.
- Parameters
- sticker
hikari.snowflakes.SnowflakeishOr
[hikari.stickers.GuildSticker
] Object or ID of the sticker to get from the cache.
- sticker
- Returns
typing.Optional
[hikari.stickers.GuildSticker
]The object of the sticker that was found in the cache or
None
.
- get_stickers_view()[source]#
Get a view of the sticker objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.stickers.GuildSticker
]A view of sticker IDs to objects of the stickers found in the cache.
- get_stickers_view_for_guild(guild, /)[source]#
Get a view of the known custom emojis cached for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached sticker objects for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.stickers.GuildSticker
]A view of sticker IDs to objects of stickers found in the cache for the specified guild.
- delete_sticker(sticker, /)[source]#
Remove a sticker from the cache.
Note
This will not delete stickers that are being kept alive by a reference.
- Parameters
- sticker
hikari.snowflakes.SnowflakeishOr
[hikari.stickers.GuildSticker
] Object or ID of the sticker to remove from the cache.
- sticker
- Returns
typing.Optional
[hikari.stickers.GuildSticker
]The object of the sticker that was removed from the cache or
None
.
- set_sticker(sticker, /)[source]#
Add a sticker to the cache.
- Parameters
- sticker
hikari.stickers.GuildSticker
The object of the sticker to add to the cache.
- sticker
- clear_guilds()[source]#
Remove all the guild objects from the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.GatewayGuild
]The cache view of guild IDs to guild objects that were removed from the cache.
- delete_guild(guild, /)[source]#
Remove a guild object from the cache.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove from the cache.
- guild
- Returns
typing.Optional
[hikari.guilds.GatewayGuild
]The object of the guild that was removed from the cache, will be
None
if not found.
- get_guild(guild, /)[source]#
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
get_available_guild
instead. Likewise, to only query unavailable guilds, useget_unavailable_guild
.- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get from the cache.
- guild
- Returns
typing.Optional
[hikari.guilds.GatewayGuild
]The object of the guild if found, else
None
.
- get_available_guild(guild, /)[source]#
Get the object of an available guild from the cache.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get from the cache.
- guild
- Returns
typing.Optional
[hikari.guilds.GatewayGuild
]The object of the guild if found, else
None
.
Get the object of a unavailable guild from the cache.
Note
Unlike
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.- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get from the cache.
- guild
- Returns
typing.Optional
[hikari.guilds.GatewayGuild
]The object of the guild if found, else
None
.
- get_guilds_view()[source]#
Get a view of all the guild objects in the cache regardless if availability.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.GatewayGuild
]A view of guild IDs to the guild objects found in the cache.
- get_available_guilds_view()[source]#
Get a view of the available guild objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.GatewayGuild
]A view of guild IDs to the guild objects found in the cache.
Get a view of the unavailable guild objects in the cache.
Note
Unlike
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
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.GatewayGuild
]A view of guild IDs to the guild objects found in the cache.
- set_guild(guild, /)[source]#
Add a guild object to the cache.
- Parameters
- guild
hikari.guilds.GatewayGuild
The object of the guild to add to the cache.
- guild
- set_guild_availability(guild, is_available, /)[source]#
Set whether a cached guild is available or not.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to set the availability for.
- is_availablebool
The availability to set for the guild.
- guild
- update_guild(guild, /)[source]#
Update a guild in the cache.
- Parameters
- guild
hikari.guilds.GatewayGuild
The object of the guild to update in the cache.
- guild
- Returns
typing.Tuple
[typing.Optional
[hikari.guilds.GatewayGuild
],typing.Optional
[hikari.guilds.GatewayGuild
]]A tuple of the old cached guild object if found (else
None
) and the object of the guild that was added to the cache if it could be added (elseNone
).
- clear_threads()[source]#
Remove all thread channels from the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.GuildThreadChannel
]A view of channel IDs to objects of the thread channels that were removed from the cache.
- clear_threads_for_guild(guild, /)[source]#
Remove thread channels from the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove cached threads for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.GuildThreadChannel
]A view of channel IDs to objects of the thread channels that were removed from the cache.
- clear_threads_for_channel(guild, channel, /)[source]#
Remove thread channels from the cache for a specific channel.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove cached threads for.
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the channel to remove cached threads for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.GuildThreadChannel
]A view of channel IDs to objects of the thread channels that were removed from the cache.
- delete_thread(thread, /)[source]#
Remove a thread channel from the cache.
- Parameters
- thread
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the thread to remove from the cache.
- thread
- Returns
typing.Optional
[hikari.channels.GuildThreadChannel
]The object of the thread that was removed from the cache if found, else
builtins.None
.
- get_thread(thread, /)[source]#
Get a thread channel from the cache.
- Parameters
- thread
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the thread to get from the cache.
- thread
- Returns
typing.Optional
[hikari.channels.GuildThreadChannel
]The object of the thread that was found in the cache or
builtins.None
.
- get_threads_view()[source]#
Get a view of the thread channels in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.GuildThreadChannel
]A view of channel IDs to objects of the thread channels found in the cache.
- get_threads_view_for_guild(guild, /)[source]#
Get a view of the thread channels in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached thread channels for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.GuildThreadChannel
]A view of channel IDs to objects of the thread channels found in the cache for the specified guild.
- get_threads_view_for_channel(guild, channel, /)[source]#
Get a view of the thread channels in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached thread channels for.
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the channel to get the cached thread channels for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.GuildThreadChannel
]A view of channel IDs to objects of the thread channels found in the cache for the specified channel.
- set_thread(thread, /)[source]#
Add a thread channel to the cache.
- Parameters
- channel
hikari.channels.GuildThreadChannel
The thread channel based object to add to the cache.
- channel
- update_thread(thread, /)[source]#
Update a thread channel in the cache.
- Parameters
- thread
hikari.channels.GuildThreadChannel
The object of the thread channel to update in the cache.
- thread
- Returns
typing.Tuple
[typing.Optional
[hikari.channels.GuildThreadChannel
],typing.Optional
[hikari.channels.GuildThreadChannel
]]A tuple of the old cached thread channel if found (else
builtins.None
) and the new cached thread channel if it could be cached (elsebuiltins.None
).
- clear_guild_channels()[source]#
Remove all guild channels from the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.PermissibleGuildChannel
]A view of channel IDs to objects of the guild channels that were removed from the cache.
- clear_guild_channels_for_guild(guild, /)[source]#
Remove guild channels from the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove cached channels for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.PermissibleGuildChannel
]A view of channel IDs to objects of the guild channels that were removed from the cache.
- delete_guild_channel(channel, /)[source]#
Remove a guild channel from the cache.
- Parameters
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the guild channel to remove from the cache.
- channel
- Returns
typing.Optional
[hikari.channels.PermissibleGuildChannel
]The object of the guild channel that was removed from the cache if found, else
None
.
- get_guild_channel(channel, /)[source]#
Get a guild channel from the cache.
- Parameters
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the guild channel to get from the cache.
- channel
- Returns
typing.Optional
[hikari.channels.PermissibleGuildChannel
]The object of the guild channel that was found in the cache or
None
.
- get_guild_channels_view()[source]#
Get a view of the guild channels in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.PermissibleGuildChannel
]A view of channel IDs to objects of the guild channels found in the cache.
- get_guild_channels_view_for_guild(guild, /)[source]#
Get a view of the guild channels in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached channels for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.channels.PermissibleGuildChannel
]A view of channel IDs to objects of the guild channels found in the cache for the specified guild.
- set_guild_channel(channel, /)[source]#
Add a guild channel to the cache.
- Parameters
- channel
hikari.channels.PermissibleGuildChannel
The guild channel based object to add to the cache.
- channel
- update_guild_channel(channel, /)[source]#
Update a guild channel in the cache.
- Parameters
- channel
hikari.channels.PermissibleGuildChannel
The object of the channel to update in the cache.
- channel
- Returns
typing.Tuple
[typing.Optional
[hikari.channels.PermissibleGuildChannel
],typing.Optional
[hikari.channels.PermissibleGuildChannel
]]A tuple of the old cached guild channel if found (else
None
) and the new cached guild channel if it could be cached (elseNone
).
- clear_invites()[source]#
Remove all the invite objects from the cache.
- Returns
CacheView
[str
,hikari.invites.InviteWithMetadata
]A view of invite code strings to objects of the invites that were removed from the cache.
- clear_invites_for_guild(guild, /)[source]#
Remove the invite objects in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove invite objects for.
- guild
- Returns
CacheView
[str
,hikari.invites.InviteWithMetadata
]A view of invite code strings to objects of the invites that were removed from the cache for the specified guild.
- clear_invites_for_channel(guild, channel, /)[source]#
Remove the invite objects in the cache for a specific channel.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove invite objects for.
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the channel to remove invite objects for.
- guild
- Returns
CacheView
[str
,hikari.invites.InviteWithMetadata
]A view of invite code strings to objects of the invites that were removed from the cache for the specified channel.
- delete_invite(code, /)[source]#
Remove an invite object from the cache.
- Parameters
- code
typing.Union
[hikari.invites.InviteCode
,str
] Object or string code of the invite to remove from the cache.
- code
- Returns
typing.Optional
[hikari.invites.InviteWithMetadata
]The object of the invite that was removed from the cache if found, else
None
.
- get_invite(code, /)[source]#
Get an invite object from the cache.
- Parameters
- code
typing.Union
[hikari.invites.InviteCode
,str
] The object or string code of the invite to get from the cache.
- code
- Returns
typing.Optional
[hikari.invites.InviteWithMetadata
]The object of the invite that was found in the cache or
None
.
- get_invites_view()[source]#
Get a view of the invite objects in the cache.
- Returns
CacheView
[str
,hikari.invites.InviteWithMetadata
]A view of string codes to objects of the invites that were found in the cache.
- get_invites_view_for_guild(guild, /)[source]#
Get a view of the invite objects in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get invite objects for.
- guild
- Returns
CacheView
[str
,hikari.invites.InviteWithMetadata
]A view of string code to objects of the invites that were found in the cache for the specified guild.
- get_invites_view_for_channel(guild, channel, /)[source]#
Get a view of the invite objects in the cache for a specified channel.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get invite objects for.
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the channel to get invite objects for.
- guild
- Returns
CacheView
[str
,invites.InviteWithMetadata
]A view of string codes to objects of the invites there were found in the cache for the specified channel.
- set_invite(invite, /)[source]#
Add an invite object to the cache.
- Parameters
- invite
hikari.invites.InviteWithMetadata
The object of the invite to add to the cache.
- invite
- update_invite(invite, /)[source]#
Update an invite in the cache.
- Parameters
- invite
hikari.invites.InviteWithMetadata
The object of the invite to update in the cache.
- invite
- Returns
typing.Tuple
[typing.Optional
[hikari.invites.InviteWithMetadata
],typing.Optional
[hikari.invites.InviteWithMetadata
]]A tuple of the old cached invite object if found (else
None
) and the new cached invite object if it could be cached (elseNone
).
- delete_me()[source]#
Remove the own user object from the cache.
- Returns
typing.Optional
[hikari.users.OwnUser
]The own user object that was removed from the cache if found, else
None
.
- get_me()[source]#
Get the own user object from the cache.
- Returns
typing.Optional
[hikari.users.OwnUser
]The own user object that was found in the cache, else
None
.
- set_me(user, /)[source]#
Set the own user object in the cache.
- Parameters
- user
hikari.users.OwnUser
The own user object to set in the cache.
- user
- update_me(user, /)[source]#
Update the own user entry in the cache.
- Parameters
- user
hikari.users.OwnUser
The own user object to update in the cache.
- user
- Returns
typing.Tuple
[typing.Optional
[hikari.users.OwnUser
],typing.Optional
[hikari.users.OwnUser
]]A tuple of the old cached own user object if found (else
None
) and the new cached own user object if it could be cached, elseNone
.
- clear_members()[source]#
Remove all the guild members in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Member
]]A view of guild IDs to views of user IDs to objects of the members that were removed from the cache.
- clear_members_for_guild(guild, /)[source]#
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.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove cached members for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Member
]The view of user IDs to the member objects that were removed from the cache.
- delete_member(guild, user, /)[source]#
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.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove a member from the cache for.
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to remove a member from the cache for.
- guild
- Returns
typing.Optional
[hikari.guilds.Member
]The object of the member that was removed from the cache if found, else
None
.
- get_member(guild, user, /)[source]#
Get a member object from the cache.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get a cached member for.
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to get a cached member for.
- guild
- Returns
typing.Optional
[hikari.guilds.Member
]The object of the member found in the cache, else
None
.
- get_members_view()[source]#
Get a view of all the members objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Member
]]A view of guild IDs to views of user IDs to objects of the members that were found from the cache.
- get_members_view_for_guild(guild_id, /)[source]#
Get a view of the members cached for a specific guild.
- Parameters
- guild_id
hikari.snowflakes.Snowflakeish
The ID of the guild to get the cached member view for.
- guild_id
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Member
]The view of user IDs to the members cached for the specified guild.
- set_member(member, /)[source]#
Add a member object to the cache.
- Parameters
- member
hikari.guilds.Member
The object of the member to add to the cache.
- member
- update_member(member, /)[source]#
Update a member in the cache.
- Parameters
- member
hikari.guilds.Member
The object of the member to update in the cache.
- member
- Returns
typing.Tuple
[typing.Optional
[hikari.guilds.Member
],typing.Optional
[hikari.guilds.Member
]]A tuple of the old cached member object if found (else
None
) and the new cached member object if it could be cached (elseNone
).
- clear_presences()[source]#
Remove all the presences in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,CacheView
[hikari.snowflakes.Snowflake
,hikari.presences.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(guild, /)[source]#
Remove the presences in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove presences for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.presences.MemberPresence
]A view of user IDs to objects of the presences that were removed from the cache for the specified guild.
- delete_presence(guild, user, /)[source]#
Remove a presence from the cache.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove a presence for.
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to remove a presence for.
- guild
- Returns
typing.Optional
[hikari.presences.MemberPresence
]The object of the presence that was removed from the cache if found, else
None
.
- get_presence(guild, user, /)[source]#
Get a presence object from the cache.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get a presence for.
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to get a presence for.
- guild
- Returns
typing.Optional
[hikari.presences.MemberPresence
]The object of the presence that was found in the cache or
None
.
- get_presences_view()[source]#
Get a view of all the presence objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,CacheView
[hikari.snowflakes.Snowflake
]]A view of guild IDs to views of user IDs to objects of the presences found in the cache.
- get_presences_view_for_guild(guild, /)[source]#
Get a view of the presence objects in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached presence objects for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.presences.MemberPresence
]A view of user IDs to objects of the presence found in the cache for the specified guild.
- set_presence(presence, /)[source]#
Add a presence object to the cache.
- Parameters
- presence
hikari.presences.MemberPresence
The object of the presence to add to the cache.
- presence
- update_presence(presence, /)[source]#
Update a presence object in the cache.
- Parameters
- presence
hikari.presences.MemberPresence
The object of the presence to update in the cache.
- presence
- Returns
typing.Tuple
[typing.Optional
[hikari.presences.MemberPresence
],typing.Optional
[hikari.presences.MemberPresence
]]A tuple of the old cached invite object if found (else
None
and the new cached invite object if it could be cached ( elseNone
).
- clear_roles()[source]#
Remove all role objects from the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Role
]A view of role IDs to objects of the roles that were removed from the cache.
- clear_roles_for_guild(guild, /)[source]#
Remove role objects from the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove roles for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Role
]A view of role IDs to objects of the roles that were removed from the cache for the specific guild.
- delete_role(role, /)[source]#
Remove a role object form the cache.
- Parameters
- role
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialRole
] Object or ID of the role to remove from the cache.
- role
- Returns
typing.Optional
[hikari.guilds.Role
]The object of the role that was removed from the cache if found, else
None
.
- get_role(role, /)[source]#
Get a role object from the cache.
- Parameters
- role
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialRole
] Object or ID of the role to get from the cache.
- role
- Returns
typing.Optional
[hikari.guilds.Role
]The object of the role found in the cache or
None
.
- get_roles_view()[source]#
Get a view of all the role objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Role
]A view of role IDs to objects of the roles found in the cache.
- get_roles_view_for_guild(guild, /)[source]#
Get a view of the roles in the cache for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached roles for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.guilds.Role
]A view of role IDs to objects of the roles that were found in the cache for the specified guild.
- set_role(role, /)[source]#
Add a role object to the cache.
- Parameters
- role
hikari.guilds.Role
The object of the role to add to the cache.
- role
- update_role(role, /)[source]#
Update a role in the cache.
- Parameters
- role
hikari.guilds.Role
The object of the role to update in the cache.
- role
- Returns
typing.Tuple
[typing.Optional
[hikari.guilds.Role
],typing.Optional
[hikari.guilds.Role
]]A tuple of the old cached role object if found (else
None
and the new cached role object if it could be cached (elseNone
).
- get_user(user, /)[source]#
Get a user object from the cache.
- Parameters
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to get from the cache.
- user
- Returns
typing.Optional
[hikari.users.User
]The object of the user that was found in the cache, else
None
.
- get_users_view()[source]#
Get a view of the user objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.users.User
]The view of user IDs to the users found in the cache.
- clear_voice_states()[source]#
Remove all voice state objects from the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,CacheView
[hikari.snowflakes.Snowflake
,hikari.voices.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(guild, channel, /)[source]#
Remove the voice state objects cached for a specific channel.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove voice states for.
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the channel to remove voice states for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.voices.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(guild, /)[source]#
Clear the voice state objects cached for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to remove cached voice states for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.voices.VoiceState
]A view of user IDs to the voice state objects that were removed from the cache.
- delete_voice_state(guild, user, /)[source]#
Remove a voice state object from the cache.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild the voice state to remove is related to.
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user who the voice state to remove belongs to.
- guild
- Returns
typing.Optional
[hikari.voices.VoiceState
]The object of the voice state that was removed from the cache if found, else
None
.
- get_voice_state(guild, user, /)[source]#
Get a voice state object from the cache.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get a voice state for.
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] Object or ID of the user to get a voice state for.
- guild
- Returns
typing.Optional
[hikari.voices.VoiceState
]The object of the voice state that was found in the cache, or
None
.
- get_voice_states_view()[source]#
Get a view of all the voice state objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,CacheView
[hikari.snowflakes.Snowflake
,hikari.voices.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(guild, channel, /)[source]#
Get a view of the voice states cached for a specific channel.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached voice states for.
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] Object or ID of the channel to get the cached voice states for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.voices.VoiceState
]A view of user IDs to objects of the voice states found cached for the specified channel.
- get_voice_states_view_for_guild(guild, /)[source]#
Get a view of the voice states cached for a specific guild.
- Parameters
- guild
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialGuild
] Object or ID of the guild to get the cached voice states for.
- guild
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.voices.VoiceState
]A view of user IDs to objects of the voice states found cached for the specified guild.
- set_voice_state(voice_state, /)[source]#
Add a voice state object to the cache.
- Parameters
- voice_state
hikari.voices.VoiceState
The object of the voice state to add to the cache.
- voice_state
- update_voice_state(voice_state, /)[source]#
Update a voice state object in the cache.
- Parameters
- voice_state
hikari.voices.VoiceState
The object of the voice state to update in the cache.
- voice_state
- Returns
typing.Tuple
[typing.Optional
[hikari.voices.VoiceState
],typing.Optional
[hikari.voices.VoiceState
]]A tuple of the old cached voice state if found (else
None
) and the new cached voice state object if it could be cached (elseNone
).
- clear_messages()[source]#
Remove all message objects from the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.messages.Message
]A view of message objects that were removed from the cache.
- delete_message(message, /)[source]#
Remove a message object from the cache.
- Parameters
- message
hikari.snowflakes.SnowflakeishOr
[hikari.messages.PartialMessage
] Object or ID of the messages to remove the cache.
- message
- Returns
typing.Optional
[hikari.messages.Message
]The object of the message that was removed from the cache if found, else
None
.
- get_message(message, /)[source]#
Get a message object from the cache.
- Parameters
- message
hikari.snowflakes.SnowflakeishOr
[hikari.messages.PartialMessage
] Object or ID of the message to get from the cache.
- message
- Returns
typing.Optional
[hikari.messages.Message
]The object of the message found in the cache or
None
.
- get_messages_view()[source]#
Get a view of all the message objects in the cache.
- Returns
CacheView
[hikari.snowflakes.Snowflake
,hikari.messages.Message
]A view of message objects found in the cache.
- set_message(message, /)[source]#
Add a message object to the cache.
- Parameters
- message
hikari.messages.Message
The object of the message to add to the cache.
- message
- update_message(message, /)[source]#
Update a message in the cache.
- Parameters
- message
typing.Union
[hikari.messages.PartialMessage
,hikari.messages.Message
] The object of the message to update in the cache.
- message
- Returns
typing.Tuple
[typing.Optional
[hikari.messages.Message
],typing.Optional
[hikari.messages.Message
]]A tuple of the old cached message object if found (else
None
) and the new cached message object if it could be cached (elseNone
).