distype - v3.0.1
    Preparing search index...

    Class Client

    The Discord client.

    Index

    Constructors

    Properties

    cache: Cache

    The client's cache.

    DISTYPE_VERSION: "3.0.1" = DistypeConstants.VERSION

    The version of Distype being used.

    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 & { version: number };
    }

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

    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 (
            | "name"
            | "type"
            | "id"
            | "position"
            | "managed"
            | "flags"
            | "applied_tags"
            | "thread_metadata"
            | "message_count"
            | "member_count"
            | "owner_id"
            | "total_message_sent"
            | "last_message_id"
            | "rate_limit_per_user"
            | "guild_id"
            | "permission_overwrites"
            | "parent_id"
            | "nsfw"
            | "last_pin_timestamp"
            | "recipients"
            | "application_id"
            | "icon"
            | "default_forum_layout"
            | "topic"
            | "default_auto_archive_duration"
            | "available_tags"
            | "default_thread_rate_limit_per_user"
            | "default_reaction_emoji"
            | "default_sort_order"
            | "bitrate"
            | "user_limit"
            | "rtc_region"
            | "video_quality_mode"
        )[]

      Parameters

      • id: string

        The channel's ID.

      • ...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.

      • ...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.

      • ...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.

      • ...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.

      • ...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.

      • OptionalchannelId: 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.

      • ...keys: T

        Properties to ensure.

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