Options
All
  • Public
  • Public/Protected
  • All
Menu

discordjs-prompter

Index

Functions

Object literals

Functions

Const choice

  • choice(channel: TextChannel | DMChannel, options: object): Promise<string | ReactionEmoji | Emoji>
  • Prompt for a user reaction in a certain channel.

    Parameters

    • channel: TextChannel | DMChannel

      The channel to send the prompt to.

    • options: object

      The configuration for the prompt.

      • Optional acceptEarly?: boolean

        Should the prompt wait until all reactions were sent before accepting a response? Note: this is faster but the reactions wont be sent in order. Default: false

      • choices: Array<string | ReactionEmoji | Emoji>

        The emojis to serve as choice options.

      • Optional deleteMessage?: boolean

        Should the message be deleted after the prompt is done? Default: true

      • question: string

        The message to be sent along with the prompt.

      • Optional timeout?: number

        The duration of the prompt Default: 30000.

      • Optional userId?: string

        The id of the user you want to prompt, if not defined the prompt will accept an answer from anyone.

    Returns Promise<string | ReactionEmoji | Emoji>

    A promise that resolves to the emoji the user reacts to or null if the user times out.

Const message

  • message(channel: TextChannel | DMChannel, options: object): Promise<false | Collection<string, Message>>
  • Prompt for a user response in a certain channel.

    Parameters

    • channel: TextChannel | DMChannel

      The channel to send the prompt to.

    • options: object

      The configuration for the prompt.

      • Optional failIfTimeout?: boolean

        By default, the promise will resolve with a list of messages regardless of reaching or not the max criteria. If this is set to true, the promise will resolve to false.

      • Optional max?: number

        How many messages to wait for. Default: 1

      • Optional prefix?: string

        If this is set, the prompt will only accept messages starting with this prefix.

      • question: string

        The question to be asked.

      • Optional timeout?: number

        How long to wait for a response in ms. Default: 30000

      • Optional userId?: string

        The id of the user you want to prompt, if not defined the prompt will accept an answer from anyone.

    Returns Promise<false | Collection<string, Message>>

    A promise that resolves to a collection of messages (or false if you set failIfTimeout to true).

Const reaction

  • reaction(channel: TextChannel | DMChannel, options?: object): Promise<false | "yes" | "no">
  • Prompt for a user reaction in a certain channel.

    Parameters

    • channel: TextChannel | DMChannel

      The channel to send the prompt to.

    • Default value options: object = {question: 'Yes or no?',confirm: '✅',cancel: '❌',timeout: 30000,}

      The configuration for the prompt.

      • Optional cancel?: string | ReactionEmoji | Emoji

        The emoji for the cancel option. Default:

      • Optional confirm?: string | ReactionEmoji | Emoji

        The emoji for the confirm option. Default:

      • question: string

        The question to ask the user. Default: Yes or No?

      • Optional timeout?: number

        How long to wait for a response in ms. Default: 30000

      • Optional userId?: string

        The id of the user you want to prompt, if not defined the prompt will accept an answer from anyone.

    Returns Promise<false | "yes" | "no">

    A promise that resolves to 'yes' if the user confirms, to 'no' if the user cancels or false if the user times out.

Const vote

  • vote(channel: TextChannel | DMChannel, options: object): Promise<object>
  • Prompt for a user response in a certain channel.

    Parameters

    • channel: TextChannel | DMChannel

      The channel to send the prompt to.

    • options: object

      The configuration for the prompt.

      • choices: Array<string | ReactionEmoji | Emoji>

        The emojis to serve as voting options.

      • Optional deleteMessage?: boolean

        Should the vote message be deleted after the vote is done? Default: false

      • question: string

        The message to be sent along with the vote.

      • Optional timeout?: number

        The duration of the vote Default: 30000.

    Returns Promise<object>

    This promise resolves to the following object:

       {emojis: [{emoji: 'An emoji from choices[]', count: 0}, ...otherEmojisFromChoices]}

Object literals

Const Prompter

Prompter: object

Main Prompter object

choice

choice: choice

The choice function See choice

message

message: message

The message function See message

reaction

reaction: reaction

The reaction function See reaction

vote

vote: vote

The vote function See vote

Generated using TypeDoc