Add Help command

This commit is contained in:
2024-08-07 17:05:07 +02:00
parent 60f18f2f76
commit 1aa26c836a
6 changed files with 66 additions and 16 deletions

View File

@@ -20,6 +20,7 @@ class Bot
$this->config = $config;
}
// TODO
public function isValid(Request $request): bool
{
$this->request = $request;
@@ -97,17 +98,25 @@ class Bot
curl_close($ch);
}
private function sanitizeStringForTalkMessage(string $text): string {
return str_replace(['@', 'http://', 'https://'], ['👤', '🔗', '🔗🔒'], $text);
}
public function reply(string $message): void
{
$this->sendChatMessage('', $message);
}
public function getConfig()
public function getConfig(): array
{
return $this->config;
}
public function listCommands(): \Generator
{
$commands_folder = __DIR__.DIRECTORY_SEPARATOR.'Commands';
foreach (scandir($commands_folder) as $command) {
if ($command === '.' || $command === '..' || $command === 'Icommands.php') {
continue;
}
$class_name = explode('.', $command)[0];
yield sprintf('Shikiryu\Bot\Commands\%s', $class_name);
}
}
}