Class Client

The Discord client.

Hierarchy

  • Client

Constructors

Properties

DISTYPE_VERSION: "1.2.1" = DistypeConstants.VERSION

The version of Distype being used.

cache: Cache

The client's cache.

gateway: Gateway

The client's gateway manager.

The log callback used by the client.

options: {
    cache: Required<CacheOptions>;
    gateway: Required<GatewayOptions> & {
        intents: number;
    };
    rest: Required<RestOptions> & RestRequestOptions;
}

Options for the client. Note that any options not specified are set to a default value.

Type declaration

rest: Rest

The client's rest manager.

system: "Client" = ...

The system string used for logging.

Methods

  • Tries to ensure channel data. Fetches data from the cache, then if data isn't found a rest request is made.

    Type Parameters

    • T extends ("type" | "id" | "name" | "position" | "guild_id" | "icon" | "owner_id" | "application_id" | "topic" | "bitrate" | "permission_overwrites" | "nsfw" | "rate_limit_per_user" | "user_limit" | "default_auto_archive_duration" | "last_message_id" | "last_pin_timestamp" | "flags" | "recipients" | "default_thread_rate_limit_per_user" | "parent_id" | "rtc_region" | "video_quality_mode" | "thread_metadata" | "message_count" | "member_count" | "total_message_sent" | "applied_tags" | "available_tags" | "default_reaction_emoji" | "default_sort_order" | "default_forum_layout" | "managed")[]

    Parameters

    • id: string

      The channel's ID.

    • Rest ...keys: T

      Properties to ensure.

    Returns Promise<Pick<CachedChannel, T[number]>>

  • Tries to ensure guild data. Fetches data from the cache, then if data isn't found a rest request is made.

    Type Parameters

    Parameters

    • id: string

      The guild's ID.

    • Rest ...keys: T

      Properties to ensure.

    Returns Promise<Pick<CachedGuild, T[number]>>

  • Tries to ensure member data. Fetches data from the cache, then if data isn't found a rest request is made.

    Type Parameters

    Parameters

    • guildId: string

      The member's guild ID.

    • userId: string

      The member's user ID.

    • Rest ...keys: T

      Properties to ensure.

    Returns Promise<Pick<CachedMember, T[number]>>

  • Tries to ensure presence data.

    Type Parameters

    Parameters

    • guildId: string

      The presence's guild ID.

    • userId: string

      The presence's user ID.

    • Rest ...keys: T

      Properties to ensure.

    Returns Pick<CachedPresence, T[number]>

  • Tries to ensure role data. Fetches data from the cache, then if data isn't found a rest request is made.

    Type Parameters

    Parameters

    • id: string

      The role's ID.

    • guildId: string

      The role's guild's ID.

    • Rest ...keys: T

      Properties to ensure.

    Returns Promise<Pick<CachedRole, T[number]>>

  • Gets the bot's self permissions. For no requests to the API to be made, the following must be cached:

    const cacheOptions = {
    channels: [`permission_overwrites`], // Only necessary if channelId is specified
    guilds: [`owner_id`, `roles`],
    members: [`communication_disabled_until`, `roles`],
    roles: [`permissions`]
    }

    Parameters

    • guildId: string

      The guild to get the bot's permissions in.

    • Optional channelId: string

      The channel to get the bot's permissions in.

    Returns Promise<bigint>

    The bot's permission flags.

  • Tries to ensure user data. Fetches data from the cache, then if data isn't found a rest request is made.

    Type Parameters

    Parameters

    • id: string

      The user's ID.

    • Rest ...keys: T

      Properties to ensure.

    Returns Promise<Pick<CachedUser, T[number]>>

  • Tries to ensure presence data.

    Type Parameters

    Parameters

    • guildId: string

      The presence's guild ID.

    • userId: string

      The presence's user ID.

    • Rest ...keys: T

      Properties to ensure.

    Returns Pick<CachedVoiceState, T[number]>

Generated using TypeDoc