Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Asker

Hierarchy

  • Asker

Index

Constructors

constructor

  • new Asker(questions: Question[], settings: Settings, channel: TextChannel | DMChannel, target: User): Asker
  • Parameters

    • questions: Question[]
    • settings: Settings
    • channel: TextChannel | DMChannel
    • target: User

    Returns Asker

Properties

Private channel

channel: TextChannel | DMChannel

Private currentQuestion

currentQuestion: Question

Private questions

questions: Question[]

Private settings

settings: Settings

Private target

target: User

Methods

addReactions

  • addReactions(msg: Message, question: Question): Promise<void>
  • Adds corresponding reactions for a single question.

    Parameters

    Returns Promise<void>

ask

  • Returns Promise<Answer[]>

Private askQuestion

  • askQuestion(channel: TextChannel | DMChannel, target: User, answers: Answer[], promiseResolve: any): Promise<void>
  • Parameters

    • channel: TextChannel | DMChannel
    • target: User
    • answers: Answer[]
    • promiseResolve: any

    Returns Promise<void>

Private controllerHandler

  • controllerHandler(channel: TextChannel | DMChannel, target: User, element: any, answers: Answer[], promiseResolve: any, question: Question, collector: MessageCollector | ReactionCollector): Promise<void>
  • Parameters

    • channel: TextChannel | DMChannel
    • target: User
    • element: any
    • answers: Answer[]
    • promiseResolve: any
    • question: Question
    • collector: MessageCollector | ReactionCollector

    Returns Promise<void>

Private getQuestionToSend

  • Shifts a question from the questions array, and returns it.

    Returns Question

getReactions

  • getReactions(question: Question): string[]
  • Get the reactions (unicode) for a given question.

    Parameters

    Returns string[]

Private handleMessageEvent

  • Handler for the message event.

    Parameters

    Returns Answer | null

Private handleReactionEvent

  • handleReactionEvent(reaction: MessageReaction, question: Question): Answer | null
  • Parameters

    • reaction: MessageReaction
    • question: Question

    Returns Answer | null

Static getPossibleAnswers

  • getPossibleAnswers(bracketStyle: boolean, question: Question): string
  • Returns possible answers for a question, if possible.

    Parameters

    • bracketStyle: boolean

      Whether to use the bracket style [Y/n] for the possible answers or newLine (false).

    • question: Question

      The question to get the possible answers for.

    Returns string

Generated using TypeDoc