Skip to content

Channels


channels

GuildChannelCacheAddon

Bases: Addon


              flowchart TD
              scurrypy.ext.cache.channels.GuildChannelCacheAddon[GuildChannelCacheAddon]
              scurrypy.bases.addon.Addon[Addon]

                              scurrypy.bases.addon.Addon --> scurrypy.ext.cache.channels.GuildChannelCacheAddon
                


              click scurrypy.ext.cache.channels.GuildChannelCacheAddon href "" "scurrypy.ext.cache.channels.GuildChannelCacheAddon"
              click scurrypy.bases.addon.Addon href "" "scurrypy.bases.addon.Addon"
            

Defines caching channels and lookup.

bot = client instance-attribute

channels: dict[Snowflake, dict[Snowflake, ChannelModel]] = {} instance-attribute

channel_index: dict[Snowflake, ChannelModel] = {} instance-attribute

on_guild_create async

Append new guild channels to cache. Also add channels to index.

Parameters:

on_guild_delete async

Remove guild channels from cache. Also remove channels from index

Parameters:

on_channel_create async

Append channel to guild key. Also append channel to index.

Raises:

Parameters:

  • event (GuildChannelCreateEvent) –

    the CHANNEL_CREATE event

on_channel_update async

Replace channel in guild key. Also replace channel in index.

Raises:

Parameters:

  • event (GuildChannelUpdateEvent) –

    the CHANNEL_UPDATE event

on_channel_delete async

Remove channel from guild key. Also remove channel from index.

Raises:

Parameters:

  • event (GuildChannelDeleteEvent) –

    the CHANNEL_DELETE event

get_channel async

Fetch a guild channel. If not found, request and store it.

Parameters:

Returns:

  • ChannelModel | None

    hydrated channel object or None if fetch failed

put

Put a new channel into the cache.

Parameters:

Raises: