Skip to content

Commit 999fed8

Browse files
committed
feat: add resetCommandsPaths
Solve the problem that the default command cannot be removed
1 parent feba9d7 commit 999fed8

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)