Skip to content

export Class

CommandsManager ​

extends ​

BaseManager

Constructor ​

ts
 new CommandsManager( client, pointer, defaults )
ParameterTypeDescription
clientClient
pointer?string
defaults?any

Properties ​

get defaults : Function ​

get isJson : Function ​

get nest : Function ​

readonly client : Client ​

readonly default? : any ​

readonly options : any ​

Methods ​

asyncdelete( scope, language_code ) ​

ParameterTypeDescription
scope?CommandScopeThe scope of the command.
language_code?stringThe language code of the command.

Delete the commands that are relevant w/o scope and language code.

Returns: Promise<boolean>

asyncget( scope, language_code ) ​

ParameterTypeDescription
scope?CommandScopeThe scope of the command.
language_code?stringThe language code of the command.

Get the commands that are relevant w/o scope and language code.

Returns: Promise<boolean | BotCommand[]>

asyncregister( commands, language_code, scope, chat_id, user_id ) ​

ParameterTypeDescription
commandsstring[]An array of the commands command as an id, they must be registered to the registry.
language_codestringThe language code scope of the current commands.
scopeCommandScopeTypeThe scope of the current commands.
chat_id?string | numberThe attached chat_id of the scope.
user_id?stringThe attached user_id of the scope.

Register the commands.

Returns: Promise<boolean>

asyncset( commands, language_code, scope ) ​

ParameterTypeDescription
commandsstring | CommandsBuilderThe list of commands that are relevant, must be a JSON-serialized object.
language_code?stringThe language code that are relevant to.
scope?string | CommandsScopeBuilderThe scope of the commands that are releaven to, must be a JSON-serialized object.

Set the commands.

Returns: Promise<boolean>

asyncupdate( ) ​

Updates all of the commands but filters ignored from the commands registry.

Returns: Promise<boolean>

A modern, powerful library for building your Telegram bots, with seamless support for both JavaScript and Typescript.