Skip to content

Pass correct message text to commands run via Telegram::runCommands #1181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Removed
### Fixed
- `getUpdates` method wrongly sends only 1 Update when a limit of 0 is passed.
- `Telegram::runCommands()` now passes the correct message text to the commands.
### Security

## [0.70.1] - 2020-12-25
Expand Down
11 changes: 5 additions & 6 deletions src/Telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -1036,15 +1036,14 @@ public function runCommands(array $commands): void
]);
};

// Required for isAdmin() check inside getCommandObject()
$this->update = $newUpdate();

// Load up-to-date commands list
$this->commands_objects = $this->getCommandsList();

foreach ($commands as $command) {
$this->update = $newUpdate($command);

// Load up-to-date commands list
if (empty($this->commands_objects)) {
$this->commands_objects = $this->getCommandsList();
}

$this->executeCommand($this->update->getMessage()->getCommand());
}
}
Expand Down