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 theEvogram
class.
Properties
commands
: A static property that contains an array of all registeredCommand
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 registeredCommand
objects. It is used automatically when adding a command.getCommand(message: UserMessageContext)
: A static method that takes aUserMessageContext
object and returns the correspondingCommand
object if it exists in thecommands
array. Otherwise, it returnsundefined
.