~.base
Backend
Bases: ABC
Base persistent cache backend.
bulk_channels
abstractmethod
async
bulk_channels(
channels: Iterable[hikari.GuildChannel],
confirm: Literal[False],
) -> None
bulk_channels(
channels: Sequence[hikari.GuildChannel], confirm: bool
) -> asyncio.Future[None] | None
Insert or update channels in bulk.
| PARAMETER | DESCRIPTION |
|---|---|
channels
|
The channels to insert or update.
TYPE:
|
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
bulk_members
abstractmethod
async
Insert or update members in bulk.
| PARAMETER | DESCRIPTION |
|---|---|
members
|
The members to insert or update. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
bulk_roles
abstractmethod
async
Insert or update roles in bulk.
| PARAMETER | DESCRIPTION |
|---|---|
roles
|
The roles to insert or update. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
channel_create
abstractmethod
async
channel_create(
channel: hikari.GuildChannel, confirm: Literal[False]
) -> None
channel_create(
channel: hikari.GuildChannel, confirm: Literal[True]
) -> asyncio.Future[None]
channel_create(
channel: hikari.GuildChannel, confirm: bool
) -> asyncio.Future[None] | None
Store a created channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
The created channel to store.
TYPE:
|
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
channel_delete
abstractmethod
async
Remove a deleted channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel_id
|
The ID of the channel that was deleted. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
channel_update
abstractmethod
async
channel_update(
channel: hikari.GuildChannel, confirm: Literal[False]
) -> None
channel_update(
channel: hikari.GuildChannel, confirm: Literal[True]
) -> asyncio.Future[None]
channel_update(
channel: hikari.GuildChannel, confirm: bool
) -> asyncio.Future[None] | None
Update an updated channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
The updated channel to update.
TYPE:
|
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
clear
abstractmethod
async
connect
abstractmethod
async
Establish a connection with the backend database and initialize.
disconnect
abstractmethod
async
Save state and disconnect from a backend database.
guild_join
abstractmethod
async
guild_join(
guild: hikari.GatewayGuild, confirm: Literal[False]
) -> None
guild_join(
guild: hikari.GatewayGuild, confirm: Literal[True]
) -> asyncio.Future[None]
guild_join(
guild: hikari.GatewayGuild, confirm: bool
) -> asyncio.Future[None] | None
Store a joined guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild
|
The guild that was joined.
TYPE:
|
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
guild_leave
abstractmethod
async
Remove a left guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild_id
|
The ID of the guild that was left. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
guild_update
abstractmethod
async
guild_update(
guild: hikari.GatewayGuild, confirm: Literal[False]
) -> None
guild_update(
guild: hikari.GatewayGuild, confirm: Literal[True]
) -> asyncio.Future[None]
guild_update(
guild: hikari.GatewayGuild, confirm: bool
) -> asyncio.Future[None] | None
Update an updated guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild
|
The updated guild to update.
TYPE:
|
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
iter_channels
abstractmethod
async
iter_channels(
query: ChannelQuery | None,
) -> AsyncIterator[hikari.GuildChannel]
Iterate through all channels in a query.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
If provided, the channel query used in cache lookup for filtration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AsyncIterator[hikari.GuildChannel]
|
The async iterator containing the queried channels. |
iter_guilds
abstractmethod
async
iter_guilds(
query: GuildQuery | None,
) -> AsyncIterator[hikari.Guild]
Iterate through all guilds in a query.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
If provided, the guild query used in cache lookup for filtration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AsyncIterator[hikari.Guild]
|
The async iterator containing the queried guilds. |
iter_members
abstractmethod
async
iter_members(
query: MemberQuery | None,
) -> AsyncIterator[hikari.Member]
Iterate through all members in a query.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
If provided, the member query used in cache lookup for filtration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AsyncIterator[hikari.Member]
|
The async iterator containing the queried members. |
iter_roles
abstractmethod
async
iter_roles(
query: RoleQuery | None,
) -> AsyncIterator[hikari.Role]
Iterate through all roles in a query.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
If provided, the role query used in cache lookup for filtration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AsyncIterator[hikari.Role]
|
The async iterator containing the queried roles. |
member_create
abstractmethod
async
Store a created member.
| PARAMETER | DESCRIPTION |
|---|---|
member
|
The created member to store. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
member_delete
abstractmethod
async
member_delete(
user_id: hikari.Snowflake,
guild_id: hikari.Snowflake,
confirm: bool,
) -> asyncio.Future[None] | None
Remove a deleted member.
| PARAMETER | DESCRIPTION |
|---|---|
user_id
|
The ID of the user that left/was deleted. |
guild_id
|
The ID of the guild that the user left. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
member_update
abstractmethod
async
Update an updated member.
| PARAMETER | DESCRIPTION |
|---|---|
member
|
The updated member to update. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
prune
abstractmethod
async
prune() -> None
Prune all objects in cache that weren't updated on startup.
restore
abstractmethod
async
restore(path: Path) -> None
Restore the backend from a backed up file.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The path to the file to restore.
TYPE:
|
role_create
abstractmethod
async
Store a created role.
| PARAMETER | DESCRIPTION |
|---|---|
role
|
The created role to store. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
role_delete
abstractmethod
async
Remove a deleted role.
| PARAMETER | DESCRIPTION |
|---|---|
role_id
|
The ID of the role that was deleted. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |
role_update
abstractmethod
async
Update an updated role.
| PARAMETER | DESCRIPTION |
|---|---|
role
|
The updated role to update. |
confirm
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
asyncio.Future[None] | None
|
If |