Skip to main content

Class: MessagePrompterMessageStrategy

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterMessageStrategy.ts:9

Extends​

Implements​

Constructors​

Constructor​

new MessagePrompterMessageStrategy(message: string | MessagePayload | MessageCreateOptions, options: IMessagePrompterStrategyOptions): MessagePrompterMessageStrategy

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterMessageStrategy.ts:15

Constructor for the MessagePrompterBaseStrategy class

Parameters​

ParameterTypeDescription
messagestring | MessagePayload | MessageCreateOptionsThe message instance for this MessagePrompter
optionsIMessagePrompterStrategyOptionsOverrideable options if needed.

Returns​

MessagePrompterMessageStrategy

Overrides​

MessagePrompterBaseStrategy.constructor

Properties​

appliedMessage​

appliedMessage: null | Message<boolean> = null

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:27

The message that has been sent in MessagePrompter.run

Inherited from​

MessagePrompterBaseStrategy.appliedMessage


editMessage​

editMessage: undefined | Message<boolean>

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:37

The message the bot will edit to send its prompt in MessagePrompter.run

Implementation of​

IMessagePrompterStrategyOptions.editMessage

Inherited from​

MessagePrompterBaseStrategy.editMessage


explicitReturn​

explicitReturn: boolean

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:22

Whether to return an explicit object with data, or the strategies' default

Implementation of​

IMessagePrompterStrategyOptions.explicitReturn

Inherited from​

MessagePrompterBaseStrategy.explicitReturn


message​

message: string | MessagePayload | MessageCreateOptions

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:32

The message that will be sent in MessagePrompter.run

Inherited from​

MessagePrompterBaseStrategy.message


timeout​

timeout: number

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:17

The timeout that was used in the collector

Implementation of​

IMessagePrompterStrategyOptions.timeout

Inherited from​

MessagePrompterBaseStrategy.timeout


type​

type: string

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:12

The type of strategy that was used

Inherited from​

MessagePrompterBaseStrategy.type


defaultStrategyOptions​

static defaultStrategyOptions: IMessagePrompterStrategyOptions

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:129

The default strategy options

Inherited from​

MessagePrompterBaseStrategy.defaultStrategyOptions

Methods​

collectReactions()​

protected collectReactions(channel: MessagePrompterChannelTypes, authorOrFilter: User | CollectorFilter<[MessageReaction, User]>, reactions: string[] | EmojiIdentifierResolvable[]): Promise<IMessagePrompterExplicitReturnBase>

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:55

Parameters​

ParameterType
channelMessagePrompterChannelTypes
authorOrFilterUser | CollectorFilter<[MessageReaction, User]>
reactionsstring[] | EmojiIdentifierResolvable[]

Returns​

Promise<IMessagePrompterExplicitReturnBase>

Inherited from​

MessagePrompterBaseStrategy.collectReactions


createMessagePromptFilter()​

private createMessagePromptFilter(authorOrFilter: User | CollectorFilter<[Message<boolean>]>): CollectorOptions<[Message<boolean>]>

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterMessageStrategy.ts:66

Creates a filter for the collector to filter on

Parameters​

ParameterType
authorOrFilterUser | CollectorFilter<[Message<boolean>]>

Returns​

CollectorOptions<[Message<boolean>]>

The filter for awaitMessages function


createReactionPromptFilter()​

protected createReactionPromptFilter(reactions: string[] | EmojiIdentifierResolvable[], authorOrFilter: User | CollectorFilter<[MessageReaction, User]>): CollectorOptions<[MessageReaction, User]>

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterBaseStrategy.ts:114

Creates a filter for the collector to filter on

Parameters​

ParameterType
reactionsstring[] | EmojiIdentifierResolvable[]
authorOrFilterUser | CollectorFilter<[MessageReaction, User]>

Returns​

CollectorOptions<[MessageReaction, User]>

The filter for awaitReactions function

Inherited from​

MessagePrompterBaseStrategy.createReactionPromptFilter


run()​

run(channel: MessagePrompterChannelTypes, authorOrFilter: User | CollectorFilter<[Message<boolean>]>): Promise<Message<boolean> | IMessagePrompterExplicitMessageReturn>

Defined in: projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/strategies/MessagePrompterMessageStrategy.ts:26

This executes the MessagePrompter and sends the message if IMessagePrompterOptions.type equals message. The handler will wait for one (1) message.

Parameters​

ParameterTypeDescription
channelMessagePrompterChannelTypesThe channel to use.
authorOrFilterUser | CollectorFilter<[Message<boolean>]>An author object to validate or a CollectorFilter predicate callback.

Returns​

Promise<Message<boolean> | IMessagePrompterExplicitMessageReturn>

A promise that resolves to the message object received.

Overrides​

MessagePrompterBaseStrategy.run