CompactModeHelper

Helper singleton for attaching single-use, expiring reaction buttons to Messages, to be used by the Client when compact mode is active

Methods

(static) .createInstance(client: Client) → void

Create the CompactModeHelper singleton instance

Note: This is called automatically by the Client. You do not need to create your own instance

Parameters:
Name Type Description
client
Client

YAMDBF Client instance

Source:
Returns:
void

(static) .registerButton(message: Message, emoji: string, action: function, lifespan?: number) → Promise<void>

Register a single-use reaction button on a Message that will execute the given action when clicked by the Message author.

Buttons remain clickable for the given lifespan (30 seconds by default), or until consumed via click by the Message author

If the Client doesn't have permissions to add reactions the given action function will be invoked immediately

Parameters:
Name Type Attributes Default Description
message
Message

Message to register a button for

emoji
string

A unicode emoji, custom emoji ID, or a button key from Client#buttons

action
function

Function to execute when the reaction button is clicked

lifespan
number
<optional>
30000

Lifespan of the button in MS

Source:
Returns:
Promise<void>