Basically it helps with creating messages that dynamically change their contents based on how ppl react on it. Aka, the message content acts as a screen, and the reactions act as input buttons.
This is the base class of the library, every dynamic message must extend this class.
Every class that extends this DynamicMessage must implement a render method.
The volatile config option determines wether or not errors should be thrown, or passed to the error handler.
The render method is used to determine the contents of the corresponding "discord text message".
Attaches an existing message to the DynamicMessage instance, then call render on the instance and overwrite the content of the existing message.
classFooextendsDynamicMessage{
publicrender(){
return'stuff';
}
}
client.on('message',(msg)=>{
constreply=msg.reply('tmp');
// Attach in the same way as DynamicMessage#sendTo
newFoo().attachTo(reply);
// Attach in the same way as DynamicMessage#replyTo
newFoo().attachTo(reply,msg.author);
})
OnInit
typeOnInit=Decorator<()=>void>
OnInit is a decorator that tells the dynamic message what functions to call when a discord text message is attached to the dynamic message. Note that if the dynamic message is reused (aka attached to another discord text message after the first one) the init function will fire again.
OnReaction is a decorator that tells the dynamic message what functions to call in response to what emoji when a reaction is made on the corresponding "discord text message".
interfaceIReactionConfig{
// (default: false) when false the bot will react with the given emoji to show the users what emoji the message is prepared to react to.
hidden?:boolean;
// (default: true) when true the bot will call the render method of the dynamic message after the reaction callback have executed.
triggerRender?:boolean;
// (default: true) when true the bot will remove user reactions after the callback have executed.
removeWhenDone?:boolean;
// (default: true) should reactions from bots trigger this callback?
ignoreBots?:boolean;
// (default: false) should reactions from humans trigger this callback?
ignoreHumans?:boolean;
// (default: true) should reactions made while the bot was offline / not setup trigger this callback
OnReactionRemoved is a decorator that tells the dynamic message what functions to call in response to what emoji when a reaction removed from the corresponding "discord text message".
interfaceIReactionRemovedConfig{
// (default: true) when true the bot will call the render method of the dynamic message after the reaction callback have executed.
triggerRender?:boolean;
// (default: true) should reactions from bots trigger this callback?
ignoreBots?:boolean;
// (default: false) should reactions from humans trigger this callback?
OnAnyReaction is a decorator that tells the dynamic message what functions to call when any reaction is made on the corresponding "discord text message".
interfaceICatchAllConfig{
// (default: true) when true the bot will call the render method of the dynamic message after the reaction callback have executed.
triggerRender?:boolean;
// (default: true) should reactions from bots trigger this callback?
ignoreBots?:boolean;
// (default: false) should reactions from humans trigger this callback?
OnAnyReaction is a decorator that tells the dynamic message what functions to call when any reaction is removed from the corresponding "discord text message".
interfaceICatchAllConfig{
// (default: true) when true the bot will call the render method of the dynamic message after the reaction callback have executed.
triggerRender?:boolean;
// (default: true) should reactions from bots trigger this callback?
ignoreBots?:boolean;
// (default: false) should reactions from humans trigger this callback?