Button
Provides api for a new button with custom name.
Button API is similar as for Node.js EventEmitter class, but provides only on
, once
, emit
functions.
import { Button } from "@tlgr/button";
const button = new Button(options);
extends​
constructor(bot, name, [options])
​
added in 1.0.0 bot
- <Object>. Telegraf instance.name
- <string>. Button name, or text which user will see.options?
- <Object>prefix
- <string>. Name of the control. Default is@tlgr/button
disableUUID
- <boolean>. Enable/Disable uuid generation for button control. It guarantee about button has be unique name. Default isfalse
payloadDivider
-<string>. Payload divider between name and payload. Default is-
alert
- <Object>. Alert options. Default isundefined
methods​
render([payload])
​
added in 1.0.0 payload
- <string> - payload name. Default isundefined
. Acceptsnumber
,string
,boolean
orsymbol
types.
properties​
uuid
​
added in 1.0.0modifiers​
- readonly
description​
Random generated hash. Returns undefined
in case if options.disableUUID=true
name
​
added in 1.0.0modifiers​
- readonly
- getter
description​
Resolved button name. This property consist of options.prefix
and options.disableUUID
.
payload
​
added in 1.0.0modifiers​
- readonly
- getter
description​
Called payload. Payload sets after render([payload])
function