Class BotCollection

Collection of Bots

Hierarchy

Constructors

Properties

#objects: ReactiveMap<string, Bot> = ...
#storage: ObjectStorage<HydratedBot> = ...
client: Client
getUnderlyingObject: ((id: string) => HydratedBot)

Type declaration

    • (id: string): HydratedBot
    • Parameters

      • id: string

      Returns HydratedBot

updateUnderlyingObject: SetStoreFunction<Record<string, HydratedBot>>

Methods

  • Create a new instance of an object

    Parameters

    • id: string

      Id

    • type: "user" | "server" | "channel" | "bot" | "channelUnread" | "channelWebhook" | "emoji" | "message" | "serverMember" | "session"

      Type

    • instance: Bot

      Instance

    • context: unknown

      Context

    • Optional data: unknown

      Data

    Returns void

  • Filter the collection by a given predicate

    Parameters

    • predicate: ((value: Bot, key: string) => boolean)

      Predicate to satisfy

        • (value: Bot, key: string): boolean
        • Parameters

          • value: Bot
          • key: string

          Returns boolean

    Returns Bot[]

  • Find some value based on a predicate

    Parameters

    • predicate: ((value: Bot, key: string) => boolean)

      Predicate to satisfy

        • (value: Bot, key: string): boolean
        • Parameters

          • value: Bot
          • key: string

          Returns boolean

    Returns undefined | Bot

  • Execute a provided function over each key, value pair in the map

    Returns

    Iterable

    Parameters

    • cb: ((value: Bot, key: string, map: ReactiveMap<string, Bot>) => void)

      Callback for each pair

        • (value: Bot, key: string, map: ReactiveMap<string, Bot>): void
        • Parameters

          • value: Bot
          • key: string
          • map: ReactiveMap<string, Bot>

          Returns void

    Returns void

  • Get or create

    Returns

    Bot

    Parameters

    • id: string

      Id

    • data: {
          _id: string;
          analytics?: boolean;
          discoverable?: boolean;
          flags?: number;
          interactions_url?: string;
          owner: string;
          privacy_policy_url?: string;
          public: boolean;
          terms_of_service_url?: string;
          token: string;
      }

      Data

      • _id: string

        Description

        Bot Id

      • Optional analytics?: boolean

        Description

        Whether to enable analytics

      • Optional discoverable?: boolean

        Description

        Whether this bot should be publicly discoverable

      • Optional flags?: number

        Format: uint32

        Description

        Enum of bot flags

      • Optional interactions_url?: string

        Description

        Reserved; URL for handling interactions

      • owner: string

        Description

        User Id of the bot owner

      • Optional privacy_policy_url?: string

        Description

        URL for privacy policy

      • public: boolean

        Description

        Whether the bot is public (may be invited by anyone)

      • Optional terms_of_service_url?: string

        Description

        URL for terms of service

      • token: string

        Description

        Token used to authenticate requests for this bot

    Returns Bot

  • Map the collection using a given callback

    Type Parameters

    • O

    Parameters

    • cb: ((value: Bot, key: string) => O)

      Callback

        • (value: Bot, key: string): O
        • Parameters

          • value: Bot
          • key: string

          Returns O

    Returns O[]

Generated using TypeDoc