revbot.js
    Preparing search index...

    Class Message

    Represents a message in a channel.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new Message instance.

      Parameters

      • client: client

        The client instance.

      • data: {
            _id: string;
            attachments?:
                | 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;
                }[];
            author: string;
            channel: string;
            content?: null
            | string;
            edited?: null | string;
            embeds?:
                | null
                | (
                    | {
                        colour?: null
                        | string;
                        description?: null | string;
                        icon_url?: null | string;
                        image?:
                            | null
                            | {
                                height: number;
                                size: "Large"
                                | "Preview";
                                url: string;
                                width: number;
                            };
                        original_url?: null
                        | string;
                        site_name?: null | string;
                        special?:
                            | null
                            | { type: "None" }
                            | { type: "GIF" }
                            | { id: string; timestamp?: null | string; type: "YouTube" }
                            | { content_type: "Channel"; id: string; type: "Lightspeed" }
                            | {
                                content_type: "Channel" | "Video" | "Clip";
                                id: string;
                                type: "Twitch";
                            }
                            | { content_type: string; id: string; type: "Spotify" }
                            | { type: "Soundcloud" }
                            | { content_type: "Album" | "Track"; id: string; type: "Bandcamp" }
                            | { album_id: string; track_id?: null | string; type: "AppleMusic" }
                            | { id: string; type: "Streamable" };
                        title?: null | string;
                        type: "Website";
                        url?: null | string;
                        video?: null | { height: number; url: string; width: number };
                    }
                    | {
                        height: number;
                        size: "Large"
                        | "Preview";
                        type: "Image";
                        url: string;
                        width: number;
                    }
                    | { height: number; type: "Video"; url: string; width: number }
                    | {
                        colour?: null | string;
                        description?: null | string;
                        icon_url?: null | string;
                        media?:
                            | 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;
                            };
                        title?: null
                        | string;
                        type: "Text";
                        url?: null | string;
                    }
                    | { type: "None" }
                )[];
            flags?: number;
            interactions?: {
                reactions?: null | string[];
                restrict_reactions?: boolean;
            };
            masquerade?: | null
            | { avatar?: null
            | string; colour?: null | string; name?: null | string };
            member?:
                | null
                | {
                    _id: { server: string; user: string };
                    avatar?:
                        | 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;
                        };
                    joined_at: string;
                    nickname?: null
                    | string;
                    roles?: string[];
                    timeout?: null | string;
                };
            mentions?: null
            | string[];
            nonce?: null | string;
            pinned?: null | boolean;
            reactions?: { [key: string]: string[] };
            replies?: null | string[];
            system?:
                | null
                | { content: string; type: "text" }
                | { by: string; id: string; type: "user_added" }
                | { by: string; id: string; type: "user_remove" }
                | { id: string; type: "user_joined" }
                | { id: string; type: "user_left" }
                | { id: string; type: "user_kicked" }
                | { id: string; type: "user_banned" }
                | { by: string; name: string; type: "channel_renamed" }
                | { by: string; type: "channel_description_changed" }
                | { by: string; type: "channel_icon_changed" }
                | { from: string; to: string; type: "channel_ownership_changed" }
                | { by: string; id: string; type: "message_pinned" }
                | { by: string; id: string; type: "message_unpinned" };
            user?:
                | null
                | {
                    _id: string;
                    avatar?: | 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;
                    };
                    badges?: number;
                    bot?: null
                    | { owner: string };
                    discriminator: string;
                    display_name?: null | string;
                    flags?: number;
                    online: boolean;
                    privileged?: boolean;
                    relations?: {
                        _id: string;
                        status:
                            | "User"
                            | "None"
                            | "Friend"
                            | "Outgoing"
                            | "Incoming"
                            | "Blocked"
                            | "BlockedOther";
                    }[];
                    relationship: | "User"
                    | "None"
                    | "Friend"
                    | "Outgoing"
                    | "Incoming"
                    | "Blocked"
                    | "BlockedOther";
                    status?: | null
                    | {
                        presence?: null
                        | "Online"
                        | "Idle"
                        | "Focus"
                        | "Busy"
                        | "Invisible";
                        text?: null | string;
                    };
                    username: string;
                };
            webhook?: null
            | { avatar?: null | string; name: string };
        }

        The raw data for the message from the API.

        • _id: string

          Unique Id

        • Optionalattachments?:
              | 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;
              }[]

          Array of attachments

        • author: string

          Id of the user or webhook that sent this message

        • channel: string

          Id of the channel this message was sent in

        • Optionalcontent?: null | string

          Message content

        • Optionaledited?: null | string

          Time at which this message was last edited

        • Optionalembeds?:
              | null
              | (
                  | {
                      colour?: null
                      | string;
                      description?: null | string;
                      icon_url?: null | string;
                      image?:
                          | null
                          | {
                              height: number;
                              size: "Large"
                              | "Preview";
                              url: string;
                              width: number;
                          };
                      original_url?: null
                      | string;
                      site_name?: null | string;
                      special?:
                          | null
                          | { type: "None" }
                          | { type: "GIF" }
                          | { id: string; timestamp?: null | string; type: "YouTube" }
                          | { content_type: "Channel"; id: string; type: "Lightspeed" }
                          | {
                              content_type: "Channel" | "Video" | "Clip";
                              id: string;
                              type: "Twitch";
                          }
                          | { content_type: string; id: string; type: "Spotify" }
                          | { type: "Soundcloud" }
                          | { content_type: "Album" | "Track"; id: string; type: "Bandcamp" }
                          | { album_id: string; track_id?: null | string; type: "AppleMusic" }
                          | { id: string; type: "Streamable" };
                      title?: null | string;
                      type: "Website";
                      url?: null | string;
                      video?: null | { height: number; url: string; width: number };
                  }
                  | {
                      height: number;
                      size: "Large"
                      | "Preview";
                      type: "Image";
                      url: string;
                      width: number;
                  }
                  | { height: number; type: "Video"; url: string; width: number }
                  | {
                      colour?: null | string;
                      description?: null | string;
                      icon_url?: null | string;
                      media?:
                          | 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;
                          };
                      title?: null
                      | string;
                      type: "Text";
                      url?: null | string;
                  }
                  | { type: "None" }
              )[]

          Attached embeds to this message

        • Optionalflags?: number

          Format: uint32

        • Optionalinteractions?: { reactions?: null | string[]; restrict_reactions?: boolean }

          Information about how this message should be interacted with

          • Optionalreactions?: null | string[]

            Reactions which should always appear and be distinct

          • Optionalrestrict_reactions?: boolean

            Whether reactions should be restricted to the given list

            Can only be set to true if reactions list is of at least length 1

        • Optionalmasquerade?: null | { avatar?: null | string; colour?: null | string; name?: null | string }

          Name and / or avatar overrides for this message

        • Optionalmember?:
              | null
              | {
                  _id: { server: string; user: string };
                  avatar?:
                      | 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;
                      };
                  joined_at: string;
                  nickname?: null
                  | string;
                  roles?: string[];
                  timeout?: null | string;
              }

          The member that sent this message

        • Optionalmentions?: null | string[]

          Array of user ids mentioned in this message

        • Optionalnonce?: null | string

          Unique value generated by client sending this message

        • Optionalpinned?: null | boolean

          Whether or not the message in pinned

        • Optionalreactions?: { [key: string]: string[] }

          Hashmap of emoji IDs to array of user IDs

        • Optionalreplies?: null | string[]

          Array of message ids this message is replying to

        • Optionalsystem?:
              | null
              | { content: string; type: "text" }
              | { by: string; id: string; type: "user_added" }
              | { by: string; id: string; type: "user_remove" }
              | { id: string; type: "user_joined" }
              | { id: string; type: "user_left" }
              | { id: string; type: "user_kicked" }
              | { id: string; type: "user_banned" }
              | { by: string; name: string; type: "channel_renamed" }
              | { by: string; type: "channel_description_changed" }
              | { by: string; type: "channel_icon_changed" }
              | { from: string; to: string; type: "channel_ownership_changed" }
              | { by: string; id: string; type: "message_pinned" }
              | { by: string; id: string; type: "message_unpinned" }

          System message

        • Optionaluser?:
              | null
              | {
                  _id: string;
                  avatar?: | 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;
                  };
                  badges?: number;
                  bot?: null
                  | { owner: string };
                  discriminator: string;
                  display_name?: null | string;
                  flags?: number;
                  online: boolean;
                  privileged?: boolean;
                  relations?: {
                      _id: string;
                      status:
                          | "User"
                          | "None"
                          | "Friend"
                          | "Outgoing"
                          | "Incoming"
                          | "Blocked"
                          | "BlockedOther";
                  }[];
                  relationship: | "User"
                  | "None"
                  | "Friend"
                  | "Outgoing"
                  | "Incoming"
                  | "Blocked"
                  | "BlockedOther";
                  status?: | null
                  | {
                      presence?: null
                      | "Online"
                      | "Idle"
                      | "Focus"
                      | "Busy"
                      | "Invisible";
                      text?: null | string;
                  };
                  username: string;
              }

          The user that sent this message

        • Optionalwebhook?: null | { avatar?: null | string; name: string }

          The webhook that sent this message

      Returns Message

    Properties

    attachments: {
        _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;
    }[] = []

    An array of file attachments included in the message.

    Type declaration

    • _id: string

      Unique Id

    • content_type: string

      Raw content type of this file

    • Optionaldeleted?: null | boolean

      Whether this file was deleted

    • filename: string

      Original filename

    • Optionalmessage_id?: null | string
    • metadata:
          | { type: "File" }
          | { type: "Text" }
          | { height: number; type: "Image"; width: number }
          | { height: number; type: "Video"; width: number }
          | { type: "Audio" }

      Parsed metadata of this file

    • Optionalobject_id?: null | string

      Id of the object this file is associated with

    • Optionalreported?: null | boolean

      Whether this file was reported

    • Optionalserver_id?: null | string
    • size: number

      Format: int

      Size of this file (in bytes)

    • tag: string

      Tag / bucket this file was uploaded to

    • Optionaluser_id?: null | string
    authorId: string

    The ID of the user who authored the message.

    channelId: string

    The ID of the channel where the message was sent.

    client: client

    The client instance.

    content: string = ""

    The content of the message.

    editedTimestamp: null | number = null

    The timestamp of when the message was last edited, or null if not edited.

    embeds: (
        | {
            colour?: null
            | string;
            description?: null | string;
            icon_url?: null | string;
            image?:
                | null
                | {
                    height: number;
                    size: "Large"
                    | "Preview";
                    url: string;
                    width: number;
                };
            original_url?: null
            | string;
            site_name?: null | string;
            special?:
                | null
                | { type: "None" }
                | { type: "GIF" }
                | { id: string; timestamp?: null | string; type: "YouTube" }
                | { content_type: "Channel"; id: string; type: "Lightspeed" }
                | {
                    content_type: "Channel" | "Video" | "Clip";
                    id: string;
                    type: "Twitch";
                }
                | { content_type: string; id: string; type: "Spotify" }
                | { type: "Soundcloud" }
                | { content_type: "Album" | "Track"; id: string; type: "Bandcamp" }
                | { album_id: string; track_id?: null | string; type: "AppleMusic" }
                | { id: string; type: "Streamable" };
            title?: null | string;
            type: "Website";
            url?: null | string;
            video?: null | { height: number; url: string; width: number };
        }
        | {
            height: number;
            size: "Large"
            | "Preview";
            type: "Image";
            url: string;
            width: number;
        }
        | { height: number; type: "Video"; url: string; width: number }
        | {
            colour?: null | string;
            description?: null | string;
            icon_url?: null | string;
            media?:
                | 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;
                };
            title?: null
            | string;
            type: "Text";
            url?: null | string;
        }
        | { type: "None" }
    )[] = []

    An array of embeds included in the message.

    Type declaration

    • {
          colour?: null | string;
          description?: null | string;
          icon_url?: null | string;
          image?:
              | null
              | {
                  height: number;
                  size: "Large"
                  | "Preview";
                  url: string;
                  width: number;
              };
          original_url?: null
          | string;
          site_name?: null | string;
          special?:
              | null
              | { type: "None" }
              | { type: "GIF" }
              | { id: string; timestamp?: null | string; type: "YouTube" }
              | { content_type: "Channel"; id: string; type: "Lightspeed" }
              | {
                  content_type: "Channel" | "Video" | "Clip";
                  id: string;
                  type: "Twitch";
              }
              | { content_type: string; id: string; type: "Spotify" }
              | { type: "Soundcloud" }
              | { content_type: "Album" | "Track"; id: string; type: "Bandcamp" }
              | { album_id: string; track_id?: null | string; type: "AppleMusic" }
              | { id: string; type: "Streamable" };
          title?: null | string;
          type: "Website";
          url?: null | string;
          video?: null | { height: number; url: string; width: number };
      }
      • Optionalcolour?: null | string

        CSS Colour

      • Optionaldescription?: null | string

        Description of website

      • Optionalicon_url?: null | string

        URL to site icon

      • Optionalimage?: null | { height: number; size: "Large" | "Preview"; url: string; width: number }

        Embedded image

      • Optionaloriginal_url?: null | string

        Original direct URL

      • Optionalsite_name?: null | string

        Site name

      • Optionalspecial?:
            | null
            | { type: "None" }
            | { type: "GIF" }
            | { id: string; timestamp?: null | string; type: "YouTube" }
            | { content_type: "Channel"; id: string; type: "Lightspeed" }
            | {
                content_type: "Channel" | "Video" | "Clip";
                id: string;
                type: "Twitch";
            }
            | { content_type: string; id: string; type: "Spotify" }
            | { type: "Soundcloud" }
            | { content_type: "Album" | "Track"; id: string; type: "Bandcamp" }
            | { album_id: string; track_id?: null | string; type: "AppleMusic" }
            | { id: string; type: "Streamable" }

        Remote content

      • Optionaltitle?: null | string

        Title of website

      • type: "Website"
      • Optionalurl?: null | string

        Direct URL to web page

      • Optionalvideo?: null | { height: number; url: string; width: number }

        Embedded video

    • {
          height: number;
          size: "Large" | "Preview";
          type: "Image";
          url: string;
          width: number;
      }
      • height: number

        Format: uint

        Height of the image

      • size: "Large" | "Preview"

        Positioning and size

      • type: "Image"
      • url: string

        URL to the original image

      • width: number

        Format: uint

        Width of the image

    • { height: number; type: "Video"; url: string; width: number }
      • height: number

        Format: uint

        Height of the video

      • type: "Video"
      • url: string

        URL to the original video

      • width: number

        Format: uint

        Width of the video

    • {
          colour?: null | string;
          description?: null | string;
          icon_url?: null | string;
          media?:
              | 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;
              };
          title?: null
          | string;
          type: "Text";
          url?: null | string;
      }
      • Optionalcolour?: null | string

        CSS Colour

      • Optionaldescription?: null | string

        Description of text embed

      • Optionalicon_url?: null | string

        URL to icon

      • Optionalmedia?:
            | 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;
            }

        ID of uploaded autumn file

      • Optionaltitle?: null | string

        Title of text embed

      • type: "Text"
      • Optionalurl?: null | string

        URL for title

    • { type: "None" }
    id: string

    The unique identifier for the object.

    mentions: Mentions = ...

    Mentions included in the message.

    reactions: Map<string, string[]> = ...

    the reactions and count on a message

    type:
        | "TEXT"
        | "USER_ADDED"
        | "USER_REMOVE"
        | "USER_JOINED"
        | "USER_LEFT"
        | "USER_KICKED"
        | "USER_BANNED"
        | "CHANNEL_RENAMED"
        | "CHANNEL_DESCRIPTION_CHANGED"
        | "CHANNEL_ICON_CHANGED"
        | "CHANNEL_OWNERSHIP_CHANGED"
        | "MESSAGE_PINNED"
        | "MESSAGE_UNPINNED" = "TEXT"

    The type of the message (e.g., TEXT, SYSTEM).

    Accessors

    Methods

    • Updates the object with new data and returns a clone of the object.

      Parameters

      • data: PartialObject

        The data to update the object with.

      • Optionalclear: string[]

        Fields to clear in the object.

      Returns this

      A clone of the updated object.

    • Removes a reaction from the message.

      Parameters

      • emoji: string

        The emoji to remove the reaction for.

      • Optionaloptions: { remove_all?: boolean; user_id?: string }

        Options for removing the reaction.

        • Optionalremove_all?: boolean

          Whether to remove all of the specified reaction for the message.

        • Optionaluser_id?: string

          The user ID to remove the reaction for. If not provided, removes the reaction for the current user.

      Returns Promise<void>

      A promise that resolves when the reaction is removed.