Skip to content

Commit 07e2052

Browse files
committed
Pass correct message text to commands run via Telegram::runCommands
1 parent 4012ff0 commit 07e2052

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
@@ -13,6 +13,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
1313
### Deprecated
1414
### Removed
1515
### Fixed
16+
- `Telegram::runCommands()` now passes the correct message text to the commands.
1617
### Security
1718

1819
## [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)