Skip to main content

Prompt Timeout Class Spec

Description

A utility class managing timeouts for prompts and reprompts.

Properties

    this.client = client;
this.activePrompts = new Map();
this.repromptTimeouts = new Map();
  • client: The Discord.js client instance.
  • activePrompts: The prompts that have been sent in the channel.
  • repromptTimeouts: The duration before a prompt is resent.

Methods

setupPrompt(channelId, message, user, originalPrompt)

setupPrompt(channelId, message, user, originalPrompt) → {void}

Description:

This method sets up the timeout and message for a prompt.

Parameters:
NameTypeDescription
channelIdstringThe ID of the Discord channel.
messagestringThe message content for the prompt.
userObjectThe Discord user associated with the prompt.
originalPromptstringThe original prompt content.
Parameters:
NameTypeDescription
channelIdstringThe ID of the Discord channel.
messagestringThe message content for the prompt.
userObjectThe Discord user associated with the prompt.
originalPromptstringThe original prompt content.

setPromptTimeout(promptId, duration, message, expiredContent, user, originalPrompt, channelId)

setPromptTimeout(promptId, duration, message, expiredContent, user, originalPrompt, channelId) → {void}

Sets a timeout for a prompt identified by promptId.

Parameters:
NameTypeDescription
promptIdanyIdentifier for the prompt.
durationnumberDuration of the timeout in milliseconds.
messageObjectDiscord message object associated with the prompt.
expiredContentstringContent to display when the prompt expires.
userObjectDiscord user object associated with the prompt.
originalPromptanyOriginal prompt content.
channelIdstringID of the Discord channel where the prompt is active.

handleReprompt(user, originalPrompt, channelId, originalMessage)

handleReprompt(user, originalPrompt, channelId, originalMessage)

Handles reprompting the user.

Parameters:
NameTypeDescription
userObjectThe user object.
originalPromptstringThe original prompt message.
channelIdstringThe ID of the channel where the reprompt message will be sent.
originalMessageObjectThe original message that triggered the reprompt.