Skip to content

Commit ee17c51

Browse files
committed
Pass correct message text to commands run via Telegram::runCommands
1 parent 7981421 commit ee17c51

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
1515
### Removed
1616
### Fixed
1717
- `getUpdates` method wrongly sends only 1 Update when a limit of 0 is passed.
18+
- `Telegram::runCommands()` now passes the correct message text to the commands.
1819
### Security
1920

2021
## [0.70.1] - 2020-12-25

src/Telegram.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,15 +1036,14 @@ public function runCommands(array $commands): void
10361036
]);
10371037
};
10381038

1039-
// Required for isAdmin() check inside getCommandObject()
1040-
$this->update = $newUpdate();
1041-
1042-
// Load up-to-date commands list
1043-
$this->commands_objects = $this->getCommandsList();
1044-
10451039
foreach ($commands as $command) {
10461040
$this->update = $newUpdate($command);
10471041

1042+
// Load up-to-date commands list
1043+
if (empty($this->commands_objects)) {
1044+
$this->commands_objects = $this->getCommandsList();
1045+
}
1046+
10481047
$this->executeCommand($this->update->getMessage()->getCommand());
10491048
}
10501049
}

0 commit comments

Comments
 (0)