. * * @author Amir Hossein Jafari * @copyright 2016-2023 Amir Hossein Jafari * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\EventHandler; use danog\MadelineProto\MTProto; /** * The [command set](https://core.telegram.org/api/bots/commands) of a certain bot in a certain chat has changed. */ final class BotCommands extends Update { /** ID of the bot that changed its command set. */ public readonly int $botId; /** The affected chat. */ public readonly int $chatId; /** @var list New bot commands. */ public readonly array $commands; /** @internal */ public function __construct(MTProto $API, array $rawBotCommands) { parent::__construct($API); $this->botId = $rawBotCommands['bot_id']; $this->chatId = $API->getIdInternal($rawBotCommands['peer']); $this->commands = array_map( static fn (array $command): Command => new Command($command), $rawBotCommands['commands'] ); } }