Class ChannelCollection

Collection of Channels

Hierarchy (View Summary)

Constructors

Properties

client: Client
getUnderlyingObject: (id: string) => HydratedChannel
updateUnderlyingObject: SetStoreFunction<Record<string, HydratedChannel>>

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: Channel

      Instance

    • context: unknown

      Context

    • Optionaldata: unknown

      Data

    Returns void

  • Get or create

    Parameters

    • id: string

      Id

    • data:
          | { _id: string; channel_type: "SavedMessages"; user: string }
          | {
              _id: string;
              active: boolean;
              channel_type: "DirectMessage";
              last_message_id?: null | string;
              recipients: string[];
          }
          | {
              _id: string;
              channel_type: "Group";
              description?: null
              | string;
              icon?:
                  | null
                  | {
                      _id: string;
                      content_type: string;
                      deleted?: null
                      | boolean;
                      filename: string;
                      message_id?: null | string;
                      metadata:
                          | { type: "File" }
                          | { type: "Text" }
                          | { height: number; type: "Image"; width: number }
                          | { height: number; type: "Video"; width: number }
                          | { type: "Audio" };
                      object_id?: null | string;
                      reported?: null | boolean;
                      server_id?: null | string;
                      size: number;
                      tag: string;
                      user_id?: null | string;
                  };
              last_message_id?: null
              | string;
              name: string;
              nsfw?: boolean;
              owner: string;
              permissions?: null | number;
              recipients: string[];
          }
          | {
              _id: string;
              channel_type: "TextChannel";
              default_permissions?: null
              | { a: number; d: number };
              description?: null | string;
              icon?:
                  | null
                  | {
                      _id: string;
                      content_type: string;
                      deleted?: null
                      | boolean;
                      filename: string;
                      message_id?: null | string;
                      metadata:
                          | { type: "File" }
                          | { type: "Text" }
                          | { height: number; type: "Image"; width: number }
                          | { height: number; type: "Video"; width: number }
                          | { type: "Audio" };
                      object_id?: null | string;
                      reported?: null | boolean;
                      server_id?: null | string;
                      size: number;
                      tag: string;
                      user_id?: null | string;
                  };
              last_message_id?: null
              | string;
              name: string;
              nsfw?: boolean;
              role_permissions?: { [key: string]: { a: number; d: number } };
              server: string;
          }
          | {
              _id: string;
              channel_type: "VoiceChannel";
              default_permissions?: null
              | { a: number; d: number };
              description?: null | string;
              icon?:
                  | null
                  | {
                      _id: string;
                      content_type: string;
                      deleted?: null
                      | boolean;
                      filename: string;
                      message_id?: null | string;
                      metadata:
                          | { type: "File" }
                          | { type: "Text" }
                          | { height: number; type: "Image"; width: number }
                          | { height: number; type: "Video"; width: number }
                          | { type: "Audio" };
                      object_id?: null | string;
                      reported?: null | boolean;
                      server_id?: null | string;
                      size: number;
                      tag: string;
                      user_id?: null | string;
                  };
              name: string;
              nsfw?: boolean;
              role_permissions?: { [key: string]: { a: number; d: number } };
              server: string;
          }

      Data

      • { _id: string; channel_type: "SavedMessages"; user: string }
        • _id: string

          Unique Id

        • channel_type: "SavedMessages"
        • user: string

          Id of the user this channel belongs to

      • {
            _id: string;
            active: boolean;
            channel_type: "DirectMessage";
            last_message_id?: null | string;
            recipients: string[];
        }
        • _id: string

          Unique Id

        • active: boolean

          Whether this direct message channel is currently open on both sides

        • channel_type: "DirectMessage"
        • Optionallast_message_id?: null | string

          Id of the last message sent in this channel

        • recipients: string[]

          2-tuple of user ids participating in direct message

      • {
            _id: string;
            channel_type: "Group";
            description?: null | string;
            icon?:
                | null
                | {
                    _id: string;
                    content_type: string;
                    deleted?: null
                    | boolean;
                    filename: string;
                    message_id?: null | string;
                    metadata:
                        | { type: "File" }
                        | { type: "Text" }
                        | { height: number; type: "Image"; width: number }
                        | { height: number; type: "Video"; width: number }
                        | { type: "Audio" };
                    object_id?: null | string;
                    reported?: null | boolean;
                    server_id?: null | string;
                    size: number;
                    tag: string;
                    user_id?: null | string;
                };
            last_message_id?: null
            | string;
            name: string;
            nsfw?: boolean;
            owner: string;
            permissions?: null | number;
            recipients: string[];
        }
        • _id: string

          Unique Id

        • channel_type: "Group"
        • Optionaldescription?: null | string

          Channel description

        • Optionalicon?:
              | null
              | {
                  _id: string;
                  content_type: string;
                  deleted?: null
                  | boolean;
                  filename: string;
                  message_id?: null | string;
                  metadata:
                      | { type: "File" }
                      | { type: "Text" }
                      | { height: number; type: "Image"; width: number }
                      | { height: number; type: "Video"; width: number }
                      | { type: "Audio" };
                  object_id?: null | string;
                  reported?: null | boolean;
                  server_id?: null | string;
                  size: number;
                  tag: string;
                  user_id?: null | string;
              }

          Custom icon attachment

        • Optionallast_message_id?: null | string

          Id of the last message sent in this channel

        • name: string

          Display name of the channel

        • Optionalnsfw?: boolean

          Whether this group is marked as not safe for work

        • owner: string

          User id of the owner of the group

        • Optionalpermissions?: null | number

          Format: int64

          Permissions assigned to members of this group (does not apply to the owner of the group)

        • recipients: string[]

          Array of user ids participating in channel

      • {
            _id: string;
            channel_type: "TextChannel";
            default_permissions?: null | { a: number; d: number };
            description?: null | string;
            icon?:
                | null
                | {
                    _id: string;
                    content_type: string;
                    deleted?: null
                    | boolean;
                    filename: string;
                    message_id?: null | string;
                    metadata:
                        | { type: "File" }
                        | { type: "Text" }
                        | { height: number; type: "Image"; width: number }
                        | { height: number; type: "Video"; width: number }
                        | { type: "Audio" };
                    object_id?: null | string;
                    reported?: null | boolean;
                    server_id?: null | string;
                    size: number;
                    tag: string;
                    user_id?: null | string;
                };
            last_message_id?: null
            | string;
            name: string;
            nsfw?: boolean;
            role_permissions?: { [key: string]: { a: number; d: number } };
            server: string;
        }
        • _id: string

          Unique Id

        • channel_type: "TextChannel"
        • Optionaldefault_permissions?: null | { a: number; d: number }

          Default permissions assigned to users in this channel

        • Optionaldescription?: null | string

          Channel description

        • Optionalicon?:
              | null
              | {
                  _id: string;
                  content_type: string;
                  deleted?: null
                  | boolean;
                  filename: string;
                  message_id?: null | string;
                  metadata:
                      | { type: "File" }
                      | { type: "Text" }
                      | { height: number; type: "Image"; width: number }
                      | { height: number; type: "Video"; width: number }
                      | { type: "Audio" };
                  object_id?: null | string;
                  reported?: null | boolean;
                  server_id?: null | string;
                  size: number;
                  tag: string;
                  user_id?: null | string;
              }

          Custom icon attachment

        • Optionallast_message_id?: null | string

          Id of the last message sent in this channel

        • name: string

          Display name of the channel

        • Optionalnsfw?: boolean

          Whether this channel is marked as not safe for work

        • Optionalrole_permissions?: { [key: string]: { a: number; d: number } }

          Permissions assigned based on role to this channel

        • server: string

          Id of the server this channel belongs to

      • {
            _id: string;
            channel_type: "VoiceChannel";
            default_permissions?: null | { a: number; d: number };
            description?: null | string;
            icon?:
                | null
                | {
                    _id: string;
                    content_type: string;
                    deleted?: null
                    | boolean;
                    filename: string;
                    message_id?: null | string;
                    metadata:
                        | { type: "File" }
                        | { type: "Text" }
                        | { height: number; type: "Image"; width: number }
                        | { height: number; type: "Video"; width: number }
                        | { type: "Audio" };
                    object_id?: null | string;
                    reported?: null | boolean;
                    server_id?: null | string;
                    size: number;
                    tag: string;
                    user_id?: null | string;
                };
            name: string;
            nsfw?: boolean;
            role_permissions?: { [key: string]: { a: number; d: number } };
            server: string;
        }
        • _id: string

          Unique Id

        • channel_type: "VoiceChannel"
        • Optionaldefault_permissions?: null | { a: number; d: number }

          Default permissions assigned to users in this channel

        • Optionaldescription?: null | string

          Channel description

        • Optionalicon?:
              | null
              | {
                  _id: string;
                  content_type: string;
                  deleted?: null
                  | boolean;
                  filename: string;
                  message_id?: null | string;
                  metadata:
                      | { type: "File" }
                      | { type: "Text" }
                      | { height: number; type: "Image"; width: number }
                      | { height: number; type: "Video"; width: number }
                      | { type: "Audio" };
                  object_id?: null | string;
                  reported?: null | boolean;
                  server_id?: null | string;
                  size: number;
                  tag: string;
                  user_id?: null | string;
              }

          Custom icon attachment

        • name: string

          Display name of the channel

        • Optionalnsfw?: boolean

          Whether this channel is marked as not safe for work

        • Optionalrole_permissions?: { [key: string]: { a: number; d: number } }

          Permissions assigned based on role to this channel

        • server: string

          Id of the server this channel belongs to

    • isNew: boolean = false

      Whether this object is new

    Returns Channel