Skip to main content

Class: MessagePrompterNumberStrategy

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

Extends

Implements

Constructors

new MessagePrompterNumberStrategy()

new MessagePrompterNumberStrategy(message: string | MessagePayload | MessageCreateOptions, options: IMessagePrompterNumberStrategyOptions): MessagePrompterNumberStrategy

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

Constructor for the MessagePrompterBaseStrategy class

Parameters

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

Returns

MessagePrompterNumberStrategy

Overrides

MessagePrompterBaseStrategy.constructor

Properties

appliedMessage

appliedMessage: null | Message = 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

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

IMessagePrompterNumberStrategyOptions.editMessage

Inherited from

MessagePrompterBaseStrategy.editMessage


end

end: number

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

The available number emojis

Implementation of

IMessagePrompterNumberStrategyOptions.end


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

IMessagePrompterNumberStrategyOptions.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


numberEmojis

numberEmojis: EmojiIdentifierResolvable[]

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

The available number emojis

Implementation of

IMessagePrompterNumberStrategyOptions.numberEmojis


start

start: number

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

The available number emojis

Implementation of

IMessagePrompterNumberStrategyOptions.start


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

IMessagePrompterNumberStrategyOptions.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


numberEmojis

static numberEmojis: string[]

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

The default available number emojis

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


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<[MessageReaction, User]>): Promise<number | IMessagePrompterExplicitNumberReturn>

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

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

Parameters

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

Returns

Promise<number | IMessagePrompterExplicitNumberReturn>

A promise that resolves to the selected number within the range.

Overrides

MessagePrompterBaseStrategy.run