Class Message<T>

Represents a guild message.

Type Parameters

Hierarchy (view full)

Constructors

  • Type Parameters

    Parameters

    • data: {
          channelId: string;
          content?: string;
          createdAt: string;
          createdBy: string;
          createdByWebhookId?: string;
          embeds?: {
              author?: {
                  icon_url?: string;
                  name?: string;
                  url?: string;
              };
              color?: number;
              description?: string;
              fields?: {
                  inline: boolean;
                  name: string;
                  value: string;
              }[];
              footer?: {
                  icon_url?: string;
                  text: string;
              };
              image?: {
                  url?: string;
              };
              thumbnail?: {
                  url?: string;
              };
              timestamp?: string;
              title?: string;
              url?: string;
          }[];
          groupId?: string;
          hiddenLinkPreviewUrls?: string[];
          id: string;
          isPinned: boolean;
          isPrivate?: boolean;
          isSilent: boolean;
          mentions?: {
              channels?: {
                  id: string;
              }[];
              everyone?: boolean;
              here?: boolean;
              roles?: {
                  id: number;
              }[];
              users?: {
                  id: string;
              }[];
          };
          replyMessageIds?: string[];
          serverId?: string;
          type: ChatMessageType;
          updatedAt?: string;
      }
      • channelId: string

        Channel ID Format: uuid

        The ID of the channel

      • Optionalcontent?: string

        Content Format: chat markdown

        The content of the message

      • createdAt: string

        Created at Format: date-time

        The ISO 8601 timestamp that the message was created at

      • createdBy: string

        Created by

        The ID of the user who created this message (Note: If this event has createdByWebhookId present, this field will still be populated, but can be ignored. In this case, the value of this field will always be Ann6LewA)

      • OptionalcreatedByWebhookId?: string

        Created by Webhook ID

        The ID of the webhook who created this message, if it was created by a webhook

      • Optionalembeds?: {
            author?: {
                icon_url?: string;
                name?: string;
                url?: string;
            };
            color?: number;
            description?: string;
            fields?: {
                inline: boolean;
                name: string;
                value: string;
            }[];
            footer?: {
                icon_url?: string;
                text: string;
            };
            image?: {
                url?: string;
            };
            thumbnail?: {
                url?: string;
            };
            timestamp?: string;
            title?: string;
            url?: string;
        }[]
      • OptionalgroupId?: string

        Group ID

        The ID of the group

      • OptionalhiddenLinkPreviewUrls?: string[]

        Hidden content link preview URLs

        Links in content to prevent unfurling as a link preview when displaying in Guilded

      • id: string

        Message ID Format: uuid

        The ID of the message

      • isPinned: boolean

        Is pinned

        false
        
      • OptionalisPrivate?: boolean

        Is private

        If set, this message will only be seen by those mentioned or replied to

      • isSilent: boolean

        Is silent

        If set, this message did not notify mention or reply recipients

        false
        
      • Optionalmentions?: {
            channels?: {
                id: string;
            }[];
            everyone?: boolean;
            here?: boolean;
            roles?: {
                id: number;
            }[];
            users?: {
                id: string;
            }[];
        }
        • Optionalchannels?: {
              id: string;
          }[]

          Channels

          Info on mentioned channels

        • Optionaleveryone?: boolean

          Everyone

          If

          was mentioned

        • Optionalhere?: boolean

          Here

          If

          was mentioned

        • Optionalroles?: {
              id: number;
          }[]

          Roles

          Info on mentioned roles

        • Optionalusers?: {
              id: string;
          }[]

          Users

          Info on mentioned users

      • OptionalreplyMessageIds?: string[]

        Message IDs that were replied to

      • OptionalserverId?: string

        Server ID

        The ID of the server

      • type: ChatMessageType

        Type

        The type of chat message. "system" messages are generated by Guilded, while "default" messages are user or bot-generated.

      • OptionalupdatedAt?: string

        Updated at Format: date-time

        The ISO 8601 timestamp that the message was updated at, if relevant

    • client: Client
    • Optionalparams: MessageConstructorParams

    Returns Message<T>

Properties

_lastMessageID: null | string

ID of the last message created with the message itself.

acknowledged: boolean

Message acknowledgement.

channelID: string

ID of the channel on which the message was sent.

client: Client

App's client.

Message components

content: null | string

Content of the message.

createdAt: Date

When the message was created.

deletedAt: null | Date

When the message was deleted.

editedTimestamp: null | Date

Timestamp at which this message was last edited.

embeds?: [] | {
    author?: {
        icon_url?: string;
        name?: string;
        url?: string;
    };
    color?: number;
    description?: string;
    fields?: {
        inline: boolean;
        name: string;
        value: string;
    }[];
    footer?: {
        icon_url?: string;
        text: string;
    };
    image?: {
        url?: string;
    };
    thumbnail?: {
        url?: string;
    };
    timestamp?: string;
    title?: string;
    url?: string;
}[]

Array of message embed.

guildID: null | string

ID of the server on which the message was sent.

hiddenLinkPreviewURLs?: string[]

Links in content to prevent unfurling as a link preview when displaying in Guilded (min items 1; must have unique items true)

id: string

Item ID

isPrivate: boolean

If true, the message appears as private.

isSilent: boolean

If true, the message didn't mention anyone.

memberID: string

ID of the message author.

mentions: {
    channels?: {
        id: string;
    }[];
    everyone?: boolean;
    here?: boolean;
    roles?: {
        id: number;
    }[];
    users?: {
        id: string;
    }[];
}

object containing all mentioned users.

Type declaration

  • Optionalchannels?: {
        id: string;
    }[]

    Channels

    Info on mentioned channels

  • Optionaleveryone?: boolean

    Everyone

    If

    was mentioned

  • Optionalhere?: boolean

    Here

    If

    was mentioned

  • Optionalroles?: {
        id: number;
    }[]

    Roles

    Info on mentioned roles

  • Optionalusers?: {
        id: string;
    }[]

    Users

    Info on mentioned users

originals: {
    responseID: null | string;
    triggerID: null | string;
}

Message Originals

Type declaration

  • responseID: null | string

    ID of the message's original message.

  • triggerID: null | string

    ID of the message sent by a user, triggering the original response.

replyMessageIDs: string[]

The IDs of the message replied by the message.

type: string

Message type.

webhookID?: null | string

ID of the webhook used to send this message. (if sent by a webhook)

Accessors

  • get attachmentURLs(): string[]
  • Get attachment URLs from this Message (works for embedded content such as images).

    Returns string[]

  • get channel(): T extends TextChannel
        ? T<T>
        : undefined
  • The channel this message was created in.

    Returns T extends TextChannel
        ? T<T>
        : undefined

  • get guild(): T extends Guild
        ? Guild
        : null | Guild
  • The guild the message is in. This will throw an error if the guild isn't cached.

    Returns T extends Guild
        ? Guild
        : null | Guild

  • get isOriginal(): false | "trigger" | "response"
  • Get to know if this Message is original.

    It is Original when:

    • it is a user message that is the original trigger of a response (returns: "trigger")
    • it is a response to a trigger message (returns: "response")

    If not, this getter returns the boolean state: false.

    Returns false | "trigger" | "response"

  • get member(): T extends Guild
        ? Member
        : undefined | Member | Promise<Member>
  • Retrieve message's member.

    Make sure to await this property (getter) to still get results even if the member is not cached.

    Returns T extends Guild
        ? Member
        : undefined | Member | Promise<Member>

    The API does not provide member information, that's why you might need to await this property.

Methods

  • Create a follow-up message that replies to the trigger message and original response. (use Message#createMessage if the message has not been acknowledged).

    Note: The trigger message and original response are automatically replied, use Client.rest.channels#createMessage to create an independent message.

    Parameters

    Returns Promise<Message<T>>

  • This method is used to create a message following this message (use Message#createFollowup on already acknowledged messages).

    Note: The trigger message is automatically replied and acknowledged, use Client.rest.channels#createMessage to create an independent message.

    Parameters

    Returns Promise<Message<T>>

  • Add a reaction to this message.

    Parameters

    • reaction: number

      ID of a reaction/emote.

    Returns Promise<void>

  • This method is used to delete the current message.

    Returns Promise<void>

  • Delete followup message.

    Returns Promise<void>

  • Delete the last message sent with the message itself.

    Returns Promise<void>

  • Delete the message's original response message (prioritizes parent).

    Parameters

    • Optionaltarget: "trigger" | "response"

      (optional) Delete specifically the trigger or the response.

    Returns Promise<void>

  • Remove a reaction from this message.

    Parameters

    • reaction: number

      ID of a reaction/emote.

    • OptionaltargetUserID: string

      ID of the user to remove reaction from. (works only on Channel Messages | default: @me)

    Returns Promise<void>

  • This method is used to edit the current message.

    Parameters

    Returns Promise<Message<T>>

  • Edit followup message.

    Parameters

    Returns Promise<Message<T>>

  • Edit the last message sent with the message itself.

    Parameters

    Returns Promise<Message<T>>

  • Edit the message's original response message.

    Parameters

    • newMessage: {
          content?: string;
          embeds?: Embed[];
      }

      New message's options.

      • Optionalcontent?: string
      • Optionalembeds?: Embed[]

    Returns Promise<Message<T>>

  • Get attachments from this Message (using REST) (works for embedded content such as images).

    Returns Promise<MessageAttachment[]>

  • Get followup message.

    Returns Promise<Message<T>>

  • Get the latest message sent with this Message.

    Returns Promise<Message<T>>

  • Get original message response or trigger (prioritizes parent, the original response).

    Parameters

    • Optionaltarget: "trigger" | "response"

      (optional) Get either the trigger or the response.

    Returns Promise<Message<T>>

  • Get original messages (the one triggering the response, and the original response message)

    Returns Promise<MessageOriginals>

  • Pin this message

    Returns Promise<void>

  • Unpin this message

    Returns Promise<void>