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

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    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>

  • Add a user to a group

    Requires

    Group

    Parameters

    • user_id: string

      ID of the target user

    Returns Promise<undefined>

  • Create an invite to the channel

    Requires

    TextChannel, VoiceChannel

    Returns

    Newly created invite code

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

  • Delete or leave a channel

    Requires

    DirectMessage, Group, TextChannel, VoiceChannel

    Parameters

    • Optional leaveSilently: boolean

      Whether to not send a message on leave

    Returns Promise<void>

  • Delete many messages by their IDs

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    Parameters

    • ids: string[]

      List of message IDs

    Returns Promise<void>

  • 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")[]

    Returns Promise<void>

  • Fetch a channel's members.

    Requires

    Group

    Returns

    An array of the channel's members.

    Returns Promise<User[]>

  • Fetch a message by its ID

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    Returns

    Message

    Parameters

    • messageId: string

      ID of the target message

    Returns Promise<Message>

  • Fetch multiple messages from a channel

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    Returns

    Messages

    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[]>

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

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    Returns

    Object including messages and users

    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[];
    }>

  • Fetch a channel's webhooks

    Requires

    TextChannel, Group

    Returns

    Webhooks

    Returns Promise<ChannelWebhook[]>

  • Check whether we have a given permission in a channel

    Returns

    Whether we have this permission

    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

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

    Returns

    Whether we have one of the permissions

    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

  • Remove a user from a group

    Requires

    Group

    Parameters

    • user_id: string

      ID of the target user

    Returns Promise<undefined>

  • Search for messages

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    Returns

    Messages

    Parameters

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

      Message searching route data

    Returns Promise<Message[]>

  • Search for messages including the users that sent them

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    Returns

    Object including messages and users

    Parameters

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

      Message searching route data

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

  • Send a message

    Requires

    SavedMessages, DirectMessage, Group, TextChannel

    Returns

    Sent 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;
          }[];
          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>

  • Set role permissions

    Requires

    Group, TextChannel, VoiceChannel

    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;
        analytics?: boolean;
        banner?: 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;
        };
        categories?: null | {
            channels: string[];
            id: string;
            title: string;
        }[];
        channels: string[];
        default_permissions: number;
        description?: null | string;
        discoverable?: boolean;
        flags?: number;
        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;
        owner: string;
        roles?: {
            [key: string]: components["schemas"]["Role"];
        };
        system_messages?: null | {
            user_banned?: null | string;
            user_joined?: null | string;
            user_kicked?: null | string;
            user_left?: null | string;
        };
    }>

  • Start typing in this channel

    Requires

    DirectMessage, Group, TextChannel

    Returns void

  • Stop typing in this channel

    Requires

    DirectMessage, Group, TextChannel

    Returns void

  • Write to string as a channel mention

    Returns

    Formatted String

    Returns string

Generated using TypeDoc