Class Channel

Channel Class

Hierarchy

  • Channel

Constructors

Properties

#ackLimit?: number
#ackTimeout?: number
#collection: ChannelCollection
#manuallyMarked?: boolean
id: string

Accessors

  • get animatedIconURL(): undefined | string
  • URL to the animated channel icon

    Returns undefined | string

  • get defaultPermissions(): undefined | {
        a: number;
        d: number;
    }
  • Default permissions for this server channel

    Returns undefined | {
        a: number;
        d: number;
    }

  • get lastMessageAt(): undefined | Date
  • Time when the last message was sent

    Returns undefined | Date

  • get lastMessageId(): undefined | string
  • ID of the last message sent in this channel

    Returns undefined | string

  • get mentions(): undefined | ReactiveSet<string>
  • Get mentions in this channel for user.

    Returns undefined | ReactiveSet<string>

  • get permission(): number
  • Permission the currently authenticated user has against this channel

    Returns number

  • get permissions(): undefined | number
  • Permissions allowed for users in this group

    Returns undefined | number

  • get potentiallyRestrictedChannel(): undefined | string | boolean
  • Whether this channel may be hidden to some users

    Returns undefined | string | boolean

  • get recipientIds(): ReactiveSet<string>
  • User ids of recipients of the group

    Returns ReactiveSet<string>

  • get rolePermissions(): undefined | Record<string, {
        a: number;
        d: number;
    }>
  • Role permissions for this server channel

    Returns undefined | Record<string, {
        a: number;
        d: number;
    }>

  • get smallIconURL(): undefined | string
  • URL to a small variant of the channel icon

    Returns undefined | string

  • get type(): "SavedMessages" | "DirectMessage" | "Group" | "TextChannel" | "VoiceChannel"
  • Channel type

    Returns "SavedMessages" | "DirectMessage" | "Group" | "TextChannel" | "VoiceChannel"

  • get typingIds(): ReactiveSet<string>
  • User ids of people currently typing in channel

    Returns ReactiveSet<string>

  • get updatedAt(): Date
  • Time when the channel was last updated (either created or a message was sent)

    Returns Date

Methods

  • Mark a channel as read

    Parameters

    • Optional message: string | Message

      Last read message or its ID

    • Optional skipRateLimiter: boolean

      Whether to skip the internal rate limiter

    • Optional skipRequest: boolean

      For internal updates only

    • Optional skipNextMarking: boolean

      For internal usage only

    Returns Promise<void>

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Add a user to a group

    Parameters

    • user_id: string

      ID of the target user

    Returns Promise<undefined>

    Requires

    Group

  • Create an invite to the channel

    Returns Promise<{
        _id: string;
        channel: string;
        creator: string;
        server: string;
        type: "Server";
    } | {
        _id: string;
        channel: string;
        creator: string;
        type: "Group";
    }>

    Newly created invite code

    Requires

    TextChannel, VoiceChannel

  • Delete or leave a channel

    Parameters

    • Optional leaveSilently: boolean

      Whether to not send a message on leave

    Returns Promise<void>

    Requires

    DirectMessage, Group, TextChannel, VoiceChannel

  • Delete many messages by their IDs

    Parameters

    • ids: string[]

      List of message IDs

    Returns Promise<void>

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Edit a channel

    Parameters

    • data: {
          archived?: null | boolean;
          description?: null | string;
          icon?: null | string;
          name?: null | string;
          nsfw?: null | boolean;
          owner?: null | string;
          remove?: null | ("Description" | "Icon" | "DefaultPermissions")[];
      }

      Changes

      • Optional archived?: null | boolean

        Description

        Whether this channel is archived

      • Optional description?: null | string

        Description

        Channel description

      • Optional icon?: null | string

        Description

        Icon

        Provide an Autumn attachment Id.

      • Optional name?: null | string

        Description

        Channel name

      • Optional nsfw?: null | boolean

        Description

        Whether this channel is age-restricted

      • Optional owner?: null | string

        Description

        Group owner

      • Optional remove?: null | ("Description" | "Icon" | "DefaultPermissions")[]

        Description

        Fields to remove from channel

    Returns Promise<void>

  • Fetch a message by its ID

    Parameters

    • messageId: string

      ID of the target message

    Returns Promise<Message>

    Message

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Fetch multiple messages from a channel

    Parameters

    • Optional params: Omit<undefined | {
          after?: null | string;
          before?: null | string;
          include_users?: null | boolean;
          limit?: null | number;
          nearby?: null | string;
          sort?: null | "Relevance" | "Latest" | "Oldest";
      }, "include_users">

      Message fetching route data

    Returns Promise<Message[]>

    Messages

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Fetch multiple messages from a channel including the users that sent them

    Parameters

    • Optional params: Omit<undefined | {
          after?: null | string;
          before?: null | string;
          include_users?: null | boolean;
          limit?: null | number;
          nearby?: null | string;
          sort?: null | "Relevance" | "Latest" | "Oldest";
      }, "include_users">

      Message fetching route data

    Returns Promise<{
        members: undefined | ServerMember[];
        messages: Message[];
        users: User[];
    }>

    Object including messages and users

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Check whether we have a given permission in a channel

    Parameters

    • Rest ...permission: ("Video" | "Masquerade" | "ManageChannel" | "ManageServer" | "ManagePermissions" | "ManageRole" | "ManageCustomisation" | "KickMembers" | "BanMembers" | "TimeoutMembers" | "AssignRoles" | "ChangeNickname" | "ManageNicknames" | "ChangeAvatar" | "RemoveAvatars" | "ViewChannel" | "ReadMessageHistory" | "SendMessage" | "ManageMessages" | "ManageWebhooks" | "InviteOthers" | "SendEmbeds" | "UploadFiles" | "React" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "GrantAllSafe")[]

      Permission Names

    Returns boolean

    Whether we have this permission

  • Check whether we have at least one of the given permissions in a channel

    Parameters

    • Rest ...permission: ("Video" | "Masquerade" | "ManageChannel" | "ManageServer" | "ManagePermissions" | "ManageRole" | "ManageCustomisation" | "KickMembers" | "BanMembers" | "TimeoutMembers" | "AssignRoles" | "ChangeNickname" | "ManageNicknames" | "ChangeAvatar" | "RemoveAvatars" | "ViewChannel" | "ReadMessageHistory" | "SendMessage" | "ManageMessages" | "ManageWebhooks" | "InviteOthers" | "SendEmbeds" | "UploadFiles" | "React" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "GrantAllSafe")[]

      Permission Names

    Returns boolean

    Whether we have one of the permissions

  • Remove a user from a group

    Parameters

    • user_id: string

      ID of the target user

    Returns Promise<undefined>

    Requires

    Group

  • Search for messages

    Parameters

    • params: Omit<{
          after?: null | string;
          before?: null | string;
          include_users?: null | boolean;
          limit?: null | number;
          pinned?: null | boolean;
          query?: null | string;
          sort?: "Relevance" | "Latest" | "Oldest";
      }, "include_users">

      Message searching route data

    Returns Promise<Message[]>

    Messages

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Search for messages including the users that sent them

    Parameters

    • params: Omit<{
          after?: null | string;
          before?: null | string;
          include_users?: null | boolean;
          limit?: null | number;
          pinned?: null | boolean;
          query?: null | string;
          sort?: "Relevance" | "Latest" | "Oldest";
      }, "include_users">

      Message searching route data

    Returns Promise<{
        members: undefined | ServerMember[];
        messages: Message[];
        users: User[];
    }>

    Object including messages and users

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Send a message

    Parameters

    • data: string | {
          attachments?: null | string[];
          content?: null | string;
          embeds?: null | {
              colour?: null | string;
              description?: null | string;
              icon_url?: null | string;
              media?: null | string;
              title?: null | string;
              url?: null | string;
          }[];
          flags?: null | number;
          interactions?: null | {
              reactions?: null | string[];
              restrict_reactions?: boolean;
          };
          masquerade?: null | {
              avatar?: null | string;
              colour?: null | string;
              name?: null | string;
          };
          nonce?: null | string;
          replies?: null | {
              id: string;
              mention: boolean;
          }[];
      }

      Either the message as a string or message sending route data

    • idempotencyKey: string = ...

    Returns Promise<Message>

    Sent message

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

  • Set role permissions

    Parameters

    • role_id: string = "default"

      Role Id, set to 'default' to affect all users

    • permissions: {
          allow: number;
          deny: number;
      }

      Permission value

      • allow: number

        Format: uint64

        Description

        Allow bit flags

      • deny: number

        Format: uint64

        Description

        Disallow bit flags

    Returns Promise<{
        _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]: components["schemas"]["OverrideField"];
        };
        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]: components["schemas"]["OverrideField"];
        };
        server: string;
    }>

    Requires

    Group, TextChannel, VoiceChannel

  • Start typing in this channel

    Returns void

    Requires

    DirectMessage, Group, TextChannel

  • Stop typing in this channel

    Returns void

    Requires

    DirectMessage, Group, TextChannel

Generated using TypeDoc