Skip to content

Commit d4964d4

Browse files
authored
Merge pull request #1252 from wright-tw/develop
feat: add resetCommandsPaths
2 parents 5e2e3e5 + 3a1737b commit d4964d4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Telegram.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,24 @@ public function addCommandsPath(string $path, bool $before = true): Telegram
854854
return $this;
855855
}
856856

857+
/**
858+
* change Command folder path (other command folder about to invalid)
859+
*
860+
* @param string $path Custom commands path
861+
* @author Wright <guan1992@gmail.com>
862+
* @return Telegram
863+
*/
864+
public function resetCommandsPaths(string $path): Telegram
865+
{
866+
if (!is_dir($path)) {
867+
TelegramLog::error('reset commands path "' . $path . '" does not exist.');
868+
} elseif (!in_array($path, $this->commands_paths, true)) {
869+
$this->commands_paths = [$path];
870+
}
871+
872+
return $this;
873+
}
874+
857875
/**
858876
* Add multiple custom commands paths
859877
*

0 commit comments

Comments
 (0)