Skip to main content

Class CommandManager

The CommandManager class is responsible for managing commands and setting bot commands for the client. It is available in the Evogram instance object as commands.

Constructor

  • client: An instance of the Evogram class.

Properties

  • commands: A static property that contains an array of all registered Command objects.

Methods

  • setBotCommands(): A method that sets bot commands for the client using the setMyCommands API method from the Telegram Bot API based on descriptions provided by registered Command objects. It is used automatically when adding a command.

  • getCommand(message: UserMessageContext): A static method that takes a UserMessageContext object and returns the corresponding Command object if it exists in the commands array. Otherwise, it returns undefined.