Skip to content
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

feat: add resetCommandsPaths #1252

Merged
merged 2 commits into from
Dec 11, 2021
Merged
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
18 changes: 18 additions & 0 deletions src/Telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,24 @@ public function addCommandsPath(string $path, bool $before = true): Telegram
return $this;
}

/**
* change Command folder path (other command folder about to invalid)
*
* @param string $path Custom commands path
* @author Wright <guan1992@gmail.com>
* @return Telegram
*/
public function resetCommandsPaths(string $path): Telegram
{
if (!is_dir($path)) {
TelegramLog::error('reset commands path "' . $path . '" does not exist.');
} elseif (!in_array($path, $this->commands_paths, true)) {
$this->commands_paths = [$path];
}

return $this;
}

/**
* Add multiple custom commands paths
*
Expand Down