Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Channel

Index

Constructors

constructor

  • new Channel(client: Client, 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?: {}; 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?: {}; server: string }): Channel
  • Parameters

    • client: Client
    • 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?: {}; 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?: {}; server: string }

    Returns Channel

Properties

_id

_id: string

Private Optional ackLimit

ackLimit: number

Private Optional ackTimeout

ackTimeout: number

active

active: Nullable<boolean> = null

Whether this DM is active.

requires

DirectMessage

channel_type

channel_type: "Group" | "SavedMessages" | "DirectMessage" | "TextChannel" | "VoiceChannel"

client

client: Client

default_permissions

default_permissions: Nullable<{ a: number; d: number }> = null

Default server channel permissions.

requires

TextChannel, VoiceChannel

description

description: Nullable<string> = null

Channel description.

requires

Group, TextChannel, VoiceChannel

icon

icon: Nullable<{ _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 }> = null

Channel icon.

requires

Group, TextChannel, VoiceChannel

last_message_id

last_message_id: Nullable<string> = null

Id of last message in channel.

requires

Group, DM, TextChannel, VoiceChannel

name

name: Nullable<string> = null

Channel name.

requires

Group, TextChannel, VoiceChannel

nsfw

nsfw: Nullable<boolean> = null

Channel is not safe for work.

requires

Group, TextChannel, VoiceChannel

owner_id

owner_id: Nullable<string> = null

The ID of the group owner.

requires

Group

permissions

permissions: Nullable<number> = null

Permissions for group members.

requires

Group

recipient_ids

recipient_ids: Nullable<string[]> = null

Group / DM members.

requires

Group, DM

role_permissions

role_permissions: Nullable<{}> = null

Channel permissions for each role.

requires

TextChannel, VoiceChannel

server_id

server_id: Nullable<string> = null

The ID of the server this channel is in.

requires

TextChannel, VoiceChannel

typing_ids

typing_ids: Set<string> = ...

Users typing in channel.

Accessors

createdAt

  • get createdAt(): number

last_message

  • get last_message(): undefined | Message

last_message_id_or_past

  • get last_message_id_or_past(): string

mentions

  • get mentions(): string[]

owner

  • get owner(): undefined | User

path

  • get path(): string

permission

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

    Returns number

recipient

  • get recipient(): undefined | User

recipients

  • get recipients(): undefined | (undefined | User)[]

server

  • get server(): undefined | Server

typing

  • get typing(): (undefined | User)[]

unread

  • get unread(): boolean

url

  • get url(): string

Methods

ack

  • ack(message?: string | Message, skipRateLimiter?: boolean): Promise<void>
  • 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

    Returns Promise<void>

addMember

  • addMember(user_id: string): Promise<undefined>
  • Add a user to a group

    Parameters

    • user_id: string

      ID of the target user

    Returns Promise<undefined>

createInvite

  • createInvite(): Promise<{ _id: string; channel: string; creator: string; server: string; type: "Server" } | { _id: string; channel: string; creator: string; type: "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

delete

  • delete(avoidReq?: boolean): Promise<void>
  • Delete a channel

    requires

    DM, Group, TextChannel, VoiceChannel

    Parameters

    • Optional avoidReq: boolean

    Returns Promise<void>

deleteMessages

  • deleteMessages(ids: string[]): Promise<void>

edit

  • edit(data: { description?: null | string; icon?: null | string; name?: null | string; nsfw?: null | boolean; owner?: null | string; remove?: null | ("Description" | "Icon" | "DefaultPermissions")[] }): Promise<void>
  • Edit a channel

    Parameters

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

      Edit data

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

fetchMembers

  • fetchMembers(): Promise<User[]>

fetchMessage

  • fetchMessage(message_id: string): Promise<Message>
  • Fetch a message by its ID

    Parameters

    • message_id: string

      ID of the target message

    Returns Promise<Message>

    The message

fetchMessages

  • fetchMessages(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">): Promise<Message[]>
  • 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[]>

    The messages

fetchMessagesWithUsers

  • fetchMessagesWithUsers(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">): Promise<{ members: undefined | Member[]; messages: Message[]; users: User[] }>
  • 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 | Member[]; messages: Message[]; users: User[] }>

    Object including messages and users

fetchStale

  • fetchStale(ids: string[]): Promise<{ deprecated: string[] }>
  • Fetch stale messages

    Parameters

    • ids: string[]

      IDs of the target messages

    Returns Promise<{ deprecated: string[] }>

    The stale messages

generateIconURL

  • generateIconURL(...args: FileArgs): undefined | string
  • Generate URL to icon for this channel

    Parameters

    • Rest ...args: FileArgs

      File parameters

    Returns undefined | string

    File URL

getMentions

  • Find all message IDs of unread messages

    Parameters

    • permit: INotificationChecker

      Callback function to determine whether a channel has certain properties

    Returns string[]

    Array of message IDs which are unread

havePermission

  • havePermission(...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")[]): boolean
  • 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

isUnread

  • Check whether the channel is currently unread

    Parameters

    • permit: INotificationChecker

      Callback function to determine whether a channel has certain properties

    Returns boolean

    Whether the channel is unread

joinCall

  • joinCall(): Promise<{ token: string }>
  • Join a call in a channel

    Returns Promise<{ token: string }>

    Join call response data

removeMember

  • removeMember(user_id: string): Promise<undefined>
  • Remove a user from a group

    Parameters

    • user_id: string

      ID of the target user

    Returns Promise<undefined>

search

  • search(params: Omit<{ after?: null | string; before?: null | string; include_users?: null | boolean; limit?: null | number; query: string; sort?: "Relevance" | "Latest" | "Oldest" }, "include_users">): Promise<Message[]>
  • Search for 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[]>

    The messages

searchWithUsers

  • searchWithUsers(params: Omit<{ after?: null | string; before?: null | string; include_users?: null | boolean; limit?: null | number; query: string; sort?: "Relevance" | "Latest" | "Oldest" }, "include_users">): Promise<{ members: undefined | Member[]; messages: Message[]; users: User[] }>
  • 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; query: string; sort?: "Relevance" | "Latest" | "Oldest" }, "include_users">

      Message searching route data

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

    The messages

sendMessage

  • sendMessage(data: string | (Omit<{ 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 }[] }, "nonce"> & { nonce?: string })): Promise<Message>
  • Send a message

    Parameters

    • data: string | (Omit<{ 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 }[] }, "nonce"> & { nonce?: string })

      Either the message as a string or message sending route data

    Returns Promise<Message>

    The message

setPermissions

  • setPermissions(role_id?: string, permissions: { allow: number; deny: number }): 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?: null | 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?: {}; system_messages?: null | { user_banned?: null | string; user_joined?: null | string; user_kicked?: null | string; user_left?: null | string } }>
  • 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; 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?: null | 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?: {}; system_messages?: null | { user_banned?: null | string; user_joined?: null | string; user_kicked?: null | string; user_left?: null | string } }>

startTyping

  • startTyping(): void

stopTyping

  • stopTyping(): void

update

  • update(data: Partial<{ _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?: {}; 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?: {}; server: string }>, clear?: ("Description" | "Icon" | "DefaultPermissions")[]): void
  • Parameters

    • data: Partial<{ _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?: {}; 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?: {}; server: string }>
    • clear: ("Description" | "Icon" | "DefaultPermissions")[] = []

    Returns void

updateGroupJoin

  • updateGroupJoin(user: string): void

updateGroupLeave

  • updateGroupLeave(user: string): void

updateStartTyping

  • updateStartTyping(id: string): void

updateStopTyping

  • updateStopTyping(id: string): void

Generated using TypeDoc