Add Request and validation

This commit is contained in:
2024-08-07 17:46:01 +02:00
parent 1aa26c836a
commit e25502f4f8
4 changed files with 72 additions and 33 deletions

View File

@@ -9,18 +9,21 @@ class Help implements Icommands
public static function getMessage(Bot $bot, array $data): void
{
$message = 'Voici la liste de mes commandes : '."\n";
$bot->replyPolitely('Voici la liste de mes commandes');
$message = '|Nom|Description|Pattern|'."\n";
$message .= '|---|---|---|'."\n";
foreach ($bot->listCommands() as $command) {
$message .= sprintf(
'%s : %s (%s)%s',
$command,
'|%s|%s|`%s`|%s',
end(explode('\\', $command)),
call_user_func([$command, 'getDescription']),
call_user_func([$command, 'getPattern']),
str_replace('|', '\|', call_user_func([$command, 'getPattern'])),
"\n"
);
}
$bot->replyPolitely($message);
$bot->reply($message);
}
public static function getDescription(): string