Skip to content

~.query

BaseQuery dataclass

BaseQuery(_cache: Cache)

Base backend query blueprint.

ChannelQuery

ChannelQuery(cache: Cache)

Bases: BaseQuery

Channel backend query.

all

Retrieve all results.

RETURNS DESCRIPTION
CacheIterator[hikari.GuildChannel]

An asynchronous iterator providing lazy access to the results.

get async

get(
    *, id: hikari.Snowflake, fetch_if_missing: bool = False
) -> hikari.GuildChannel | None

Fetch a channel directly from its ID.

PARAMETER DESCRIPTION
id

The ID of the channel to fetch.

TYPE: hikari.Snowflake

fetch_if_missing

If not found in cache, automatically fetch it from REST.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
hikari.GuildChannel | None

The fetched channel from cache or REST, if found.

Note

The listed exceptions are only raised when fetch_if_missing=True.

RAISES DESCRIPTION
hikari.ForbiddenError

Missing hikari.Permissions.VIEW_CHANNEL in the channel.

hikari.InternalServerError

Discord had an issue while handling the request.

hikari.NotFoundError

Channel wasn't found.

hikari.RateLimitTooLongError

Rate limit occurred longer than bot max_rate_limit upon request.

hikari.UnauthorizedError

Request unauthorized (invalid/missing token).

where

where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_TEXT],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildTextChannel]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_VOICE],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildVoiceChannel]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_CATEGORY],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildCategory]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_NEWS],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildNewsChannel]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_NEWS_THREAD],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildNewsThread]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_PUBLIC_THREAD],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildPublicThread]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_PRIVATE_THREAD],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildPrivateThread]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_STAGE],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildStageChannel]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_FORUM],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildForumChannel]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: Literal[hikari.ChannelType.GUILD_MEDIA],
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildMediaChannel]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: hikari.ChannelType | None = None,
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildChannel]
where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    type: hikari.ChannelType | None = None,
    guild_id: hikari.Snowflake | None = None,
    parent_id: hikari.Snowflake | None = None,
    position: int | None = None,
    is_nsfw: bool | None = None
) -> CacheIterator[hikari.GuildChannel]

Filter the results using various metadata options.

RETURNS DESCRIPTION
CacheIterator[hikari.GuildChannel]

An asynchronous iterator providing lazy access to the results.

GuildQuery

GuildQuery(cache: Cache)

Bases: BaseQuery

Guild backend query.

all

Retrieve all results.

RETURNS DESCRIPTION
CacheIterator[hikari.Guild]

An asynchronous iterator providing lazy access to the results.

get async

get(
    *, id: hikari.Snowflake, fetch_if_missing: bool = False
) -> hikari.Guild | None

Fetch a guild directly from its ID.

PARAMETER DESCRIPTION
id

The ID of the guild to fetch.

TYPE: hikari.Snowflake

fetch_if_missing

If not found in cache, automatically fetch it from REST.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
hikari.Guild | None

The fetched guild from cache or REST, if found.

Note

The listed exceptions are only raised when fetch_if_missing=True.

RAISES DESCRIPTION
hikari.ForbiddenError

Not in the guild.

hikari.InternalServerError

Discord had an issue while handling the request.

hikari.NotFoundError

Guild wasn't found.

hikari.RateLimitTooLongError

Rate limit occurred longer than bot max_rate_limit upon request.

hikari.UnauthorizedError

Request unauthorized (invalid/missing token).

where

where(
    *,
    id: hikari.Snowflake | None = None,
    icon_hash: str | None = None,
    name: str | None = None,
    application_id: hikari.Snowflake | None = None,
    afk_channel_id: hikari.Snowflake | None = None,
    afk_timeout: timedelta | None = None,
    banner_hash: str | None = None,
    default_message_notifications: (
        hikari.GuildMessageNotificationsLevel | None
    ) = None,
    description: str | None = None,
    discovery_splash_hash: str | None = None,
    explicit_content_filter: (
        hikari.GuildExplicitContentFilterLevel | None
    ) = None,
    is_widget_enabled: bool | None = None,
    max_video_channel_users: int | None = None,
    mfa_level: hikari.GuildMFALevel | None = None,
    owner_id: hikari.Snowflake | None = None,
    preferred_locale: hikari.Locale | None = None,
    premium_subscription_count: int | None = None,
    premium_tier: hikari.GuildPremiumTier | None = None,
    public_updates_channel_id: (
        hikari.Snowflake | None
    ) = None,
    rules_channel_id: hikari.Snowflake | None = None,
    splash_hash: str | None = None,
    system_channel_flags: (
        hikari.GuildSystemChannelFlag | None
    ) = None,
    system_channel_id: hikari.Snowflake | None = None,
    vanity_url_code: str | None = None,
    verification_level: (
        hikari.GuildVerificationLevel | None
    ) = None,
    widget_channel_id: hikari.Snowflake | None = None,
    nsfw_level: hikari.GuildNSFWLevel | None = None
) -> CacheIterator[hikari.Guild]

Filter the results using various metadata options.

RETURNS DESCRIPTION
CacheIterator[hikari.Guild]

An asynchronous iterator providing lazy access to the results.

MemberQuery

MemberQuery(cache: Cache)

Bases: BaseQuery

Member backend query.

all

Retrieve all results.

RETURNS DESCRIPTION
CacheIterator[hikari.Member]

An asynchronous iterator providing lazy access to the results.

get async

get(
    *,
    guild_id: hikari.Snowflake,
    member_id: hikari.Snowflake,
    fetch_if_missing: bool = False
) -> hikari.Member | None

Fetch a member directly from their ID.

PARAMETER DESCRIPTION
guild_id

The ID of the guild the member is in.

TYPE: hikari.Snowflake

member_id

The ID of the member to fetch.

TYPE: hikari.Snowflake

fetch_if_missing

If not found in cache, automatically fetch it from REST.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
hikari.Member | None

The fetched member from cache or REST, if found.

Note

The listed exceptions are only raised when fetch_if_missing=True.

RAISES DESCRIPTION
hikari.InternalServerError

Discord had an issue while handling the request.

hikari.NotFoundError

Guild or member weren't found.

hikari.RateLimitTooLongError

Rate limit occurred longer than bot max_rate_limit upon request.

hikari.UnauthorizedError

Request unauthorized (invalid/missing token).

where

where(
    *,
    guild_id: hikari.Snowflake | None = None,
    member_id: hikari.Snowflake | None = None,
    nickname: str | None = None,
    guild_avatar_hash: str | None = None,
    guild_banner_hash: str | None = None,
    guild_flags: hikari.GuildMemberFlags | None = None
) -> CacheIterator[hikari.Member]

Filter the results using various metadata options.

RETURNS DESCRIPTION
CacheIterator[hikari.Member]

An asynchronous iterator providing lazy access to the results.

RoleQuery

RoleQuery(cache: Cache)

Bases: BaseQuery

Role backend query.

all

Retrieve all results.

RETURNS DESCRIPTION
CacheIterator[hikari.Role]

An asynchronous iterator providing lazy access to the results.

get async

get(
    *,
    id: hikari.Snowflake,
    guild_id_if_missing: hikari.Snowflake | None = None
) -> hikari.Role | None

Fetch a role directly from its ID.

PARAMETER DESCRIPTION
id

The ID of the role to fetch.

TYPE: hikari.Snowflake

guild_id_if_missing

If not found in cache, use the guild ID to automatically fetch it from REST.

TYPE: hikari.Snowflake | None DEFAULT: None

RETURNS DESCRIPTION
hikari.Role | None

The fetched role from cache or REST, if found.

Note

The listed exceptions are only raised when guild_id_if_missing is given.

RAISES DESCRIPTION
hikari.InternalServerError

Discord had an issue while handling the request.

hikari.NotFoundError

Guild or role wasn't found.

hikari.RateLimitTooLongError

Rate limit occurred longer than bot max_rate_limit upon request.

hikari.UnauthorizedError

Request unauthorized (invalid/missing token).

where

where(
    *,
    id: hikari.Snowflake | None = None,
    name: str | None = None,
    color: hikari.Color | None = None,
    guild_id: hikari.Snowflake | None = None,
    is_hoisted: bool | None = None,
    icon_hash: str | None = None,
    unicode_emoji: hikari.UnicodeEmoji | None = None,
    is_managed: bool | None = None,
    is_mentionable: bool | None = None,
    permissions: hikari.Permissions | None = None,
    position: int | None = None,
    bot_id: hikari.Snowflake | None = None,
    integration_id: hikari.Snowflake | None = None,
    is_premium_subscriber_role: bool | None = None,
    is_available_for_purchase: bool | None = None,
    is_guild_linked_role: bool | None = None
) -> CacheIterator[hikari.Role]

Filter the results using various metadata options.

RETURNS DESCRIPTION
CacheIterator[hikari.Role]

An asynchronous iterator providing lazy access to the results.