Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KlasaMessage

Klasa's Extended Message

Hierarchy

Index

Constructors

constructor

Properties

Private #responses

#responses: Message[]

All of the responses to this message.

Readonly activity

activity: APIMessageActivityData | null

Sent with Rich Presence-related chat embeds.

since

0.0.1

Readonly application

application: APIMessageApplicationData | null

Sent with Rich Presence-related chat embeds.

since

0.0.1

Readonly attachments

attachments: Cache<string, MessageAttachment>

The attached files.

since

0.0.1

Readonly author

author: User

Author of this message.

since

0.0.1

Readonly channel

channel: TextBasedChannel

The channel the message was sent in.

since

0.0.1

Readonly client

client: Client

command

command: Command | null

The command being ran.

commandText

commandText: string | null

The name of the command being ran.

content

content: string

Contents of the message.

since

0.0.1

deleted

deleted: boolean

Whether the message is deleted.

since

0.0.1

editedTimestamp

editedTimestamp: number | null

When this message was edited (or null if never).

since

0.0.1

embeds

embeds: Embed[]

The embedded data.

since

0.0.1

flags

flags: MessageFlags

Describes extra features of the message.

since

0.0.1

see

https://discord.com/developers/docs/resources/channel#message-object-message-flags

Readonly guild

guild: Guild | null

The guild the message was sent in.

since

0.0.1

guildSettings

guildSettings: Settings

The guild level settings for this context (guild || default)

Readonly id

id: string

Id of the message.

since

0.0.1

language

language: Language

The language for this message.

Readonly member

member: GuildMember | null

The author's member data, always null if {@link Message#guild} is null.

since

0.0.1

Readonly mentions

mentions: MessageMentions

The mentions.

since

0.0.1

Optional Readonly nonce

nonce: string | null

Used for validating a message was sent.

since

0.0.1

pinned

pinned: boolean

Whether or not this message is pinned.

since

0.0.1

prefix

prefix: RegExp | null

The prefix used.

prefixLength

prefixLength: number | null

The length of the prefix used.

prompter

prompter: CommandPrompt | null

A command prompt/argument handler.

Readonly reactions

reactions: MessageReactionStore

Reactions to the message.

since

0.0.1

Readonly reference

reference: APIMessageReferenceData | null

Reference data sent with crossposted messages.

since

0.0.1

tts

tts: boolean

Whether or not this was a TTS message.

since

0.0.1

Readonly type

type: MessageType

Optional Readonly webhookID

webhookID: string | null

If the message is generated by a webhook, this is the webhook's id.

since

0.0.1

Static Private prefixes

prefixes: Map<any, any> = new Map()

Cache of RegExp prefixes

since

0.5.0

Accessors

args

  • get args(): (undefined | null | string)[]

createdAt

  • get createdAt(): Date
  • When this message was sent.

    since

    0.0.1

    Returns Date

createdTimestamp

  • get createdTimestamp(): number
  • The time when this object was created at

    Returns number

deletable

  • get deletable(): boolean | null
  • If the client can delete this message.

    since

    0.0.1

    Returns boolean | null

editable

  • get editable(): boolean
  • If the client can edit this message.

    since

    0.0.1

    Returns boolean

editedAt

  • get editedAt(): Date | null
  • When this message was edited (or null if never).

    since

    0.0.1

    Returns Date | null

flagArgs

  • get flagArgs(): Record<string, string>

link

  • get link(): string
  • The link to this message

    since

    0.0.4

    Returns string

params

  • get params(): unknown[]

pinnable

  • get pinnable(): boolean | null
  • If the client can pin this message.

    since

    0.0.1

    Returns boolean | null

reactable

  • get reactable(): boolean | null
  • If the client can react to this message.

    since

    0.0.1

    Returns boolean | null

reprompted

  • get reprompted(): boolean

responses

Methods

Private _customPrefix

Private _mentionPrefix

Private _parseCommand

  • _parseCommand(): void

Protected _patch

  • _patch(data: Partial<APIMessageData>): this
  • Extends the patch method from Message to attach and update the language to this instance

    since

    0.5.0

    Parameters

    • data: Partial<APIMessageData>

    Returns this

Private _prefixLess

awaitReactions

  • awaitReactions(options: ReactionCollectorOptions): Promise<Cache<string, MessageReaction>>
  • Awaits a group of messages.

    since

    0.0.1

    Parameters

    • options: ReactionCollectorOptions

      The options to control what you receive.

    Returns Promise<Cache<string, MessageReaction>>

clone

  • clone(): this
  • Basic clone method

    Returns this

crosspost

  • crosspost(): Promise<this>
  • Crosspost this message.

    since

    0.0.4

    Returns Promise<this>

delete

  • delete(requestOptions?: RequestOptions): Promise<this>

edit

  • edit(data: MessageOptions): Promise<Message>
  • edit(data: (message: MessageBuilder) => MessageBuilder | Promise<MessageBuilder>): Promise<Message>
  • Sends a message to the channel.

    since

    0.0.2

    see

    https://discord.com/developers/docs/resources/channel#edit-message

    example

    message.edit(new MessageBuilder() .setContent('Ping!') .setEmbed(new Embed().setDescription('From an embed!')));

    Parameters

    • data: MessageOptions

      The {@link MessageBuilder builder} to send.

    Returns Promise<Message>

  • Sends a message to the channel.

    since

    0.0.1

    see

    https://discord.com/developers/docs/resources/channel#edit-message

    example

    message.edit(builder => builder .setContent('Ping!') .setEmbed(embed => embed.setDescription('From an embed!')));

    Parameters

    • data: (message: MessageBuilder) => MessageBuilder | Promise<MessageBuilder>

      A callback with a {@link MessageBuilder builder} as an argument.

        • (message: MessageBuilder): MessageBuilder | Promise<MessageBuilder>
        • Parameters

          • message: MessageBuilder

          Returns MessageBuilder | Promise<MessageBuilder>

    Returns Promise<Message>

hasAtLeastPermissionLevel

  • hasAtLeastPermissionLevel(min: number): Promise<boolean>

pin

  • pin(): Promise<this>
  • Pins the message to the channel

    since

    0.0.4

    Returns Promise<this>

reply

  • reply(data: MessageOptions, options?: SplitOptions): Promise<Message[]>
  • reply(data: (message: MessageBuilder) => MessageBuilder | Promise<MessageBuilder>, options?: SplitOptions): Promise<Message[]>

replyLocale

  • replyLocale(key: string, options?: SplitOptions): Promise<Message[]>
  • replyLocale(key: string, localeArgs?: unknown[], options?: SplitOptions): Promise<Message[]>
  • Sends a message that will be editable via command editing (if nothing is attached)

    since

    0.5.0

    Parameters

    • key: string

      The Language key to send

    • Optional options: SplitOptions

      The split options

    Returns Promise<Message[]>

  • Sends a message that will be editable via command editing (if nothing is attached)

    since

    0.5.0

    Parameters

    • key: string

      The Language key to send

    • Optional localeArgs: unknown[]

      The language arguments to pass

    • Optional options: SplitOptions

      The split options

    Returns Promise<Message[]>

toJSON

  • toJSON(): Record<string, unknown>

toString

  • toString(): string
  • Defines the toString behavior of this structure.

    since

    0.0.4

    Returns string

unpin

  • unpin(): Promise<this>
  • Unpins the message to the channel

    since

    0.0.4

    Returns Promise<this>

usableCommands

  • usableCommands(): Promise<Cache<string, Command>>

valueOf

  • valueOf(): string
  • The basic value of this Structure

    Returns string

Static Private generateNewPrefix

  • generateNewPrefix(prefix: string, flags: string): CachedPrefix

Generated using TypeDoc