✨ Add Help command
This commit is contained in:
19
bot/Bot.php
19
bot/Bot.php
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user