alfred-nextcloud/bot/Commands/Help.php

35 lines
821 B
PHP
Raw Normal View History

2024-08-07 17:05:07 +02:00
<?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)$';
}
}