35 lines
821 B
PHP
35 lines
821 B
PHP
|
<?php
|
||
|
|
||
|
namespace Shikiryu\Bot\Commands;
|
||
|
|
||
|
use Shikiryu\Bot\Bot;
|
||
|
|
||
|
class Help implements Icommands
|
||
|
{
|
||
|
|
||
|
public static function getMessage(Bot $bot, array $data): void
|
||
|
{
|
||
|
$message = 'Voici la liste de mes commandes : '."\n";
|
||
|
foreach ($bot->listCommands() as $command) {
|
||
|
$message .= sprintf(
|
||
|
'%s : %s (%s)%s',
|
||
|
$command,
|
||
|
call_user_func([$command, 'getDescription']),
|
||
|
call_user_func([$command, 'getPattern']),
|
||
|
"\n"
|
||
|
);
|
||
|
}
|
||
|
|
||
|
$bot->replyPolitely($message);
|
||
|
}
|
||
|
|
||
|
public static function getDescription(): string
|
||
|
{
|
||
|
return 'Affiche les commandes à lancer';
|
||
|
}
|
||
|
|
||
|
public static function getPattern(): string
|
||
|
{
|
||
|
return '^(help|aide|liste des commandes)$';
|
||
|
}
|
||
|
}
|