Command
in package
FinalYes
One registered command: its name, what it answers to, and what it does.
The callback is handed the Message that triggered it, the arguments after the command word, and the client - and may return a string, which the client sends back as a reply.
Tags
Table of Contents
Properties
- $aliases : array<string|int, mixed>
- $callback : Closure
- $description : string
- $listed : bool
- $name : string
Methods
- __construct() : mixed
- getAliases() : array<int, string>
- getDescription() : string
- getName() : string
- getTriggers() : array<string|int, mixed>
- Every word this command answers to.
- handle() : mixed
- Runs the command.
- isListed() : bool
- Whether the command belongs in the menu `setMyCommands` publishes.
Properties
$aliases read-only
private
array<string|int, mixed>
$aliases
= []
$callback read-only
private
Closure
$callback
$description read-only
private
string
$description
= ''
$listed read-only
private
bool
$listed
= true
$name read-only
private
string
$name
Methods
__construct()
public
__construct(string $name, callable(Message, array<int, string>, TelegramCommandClient): mixed $callback[, string $description = '' ][, array<int, string> $aliases = [] ][, bool $listed = true ]) : mixed
Parameters
- $name : string
- $callback : callable(Message, array<int, string>, TelegramCommandClient): mixed
- $description : string = ''
- $aliases : array<int, string> = []
- $listed : bool = true
getAliases()
public
getAliases() : array<int, string>
Return values
array<int, string>getDescription()
public
getDescription() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetTriggers()
Every word this command answers to.
public
getTriggers() : array<string|int, mixed>
Return values
array<string|int, mixed>handle()
Runs the command.
public
handle(Message $message, array<int, string> $args, TelegramCommandClient $client) : mixed
Parameters
- $message : Message
- $args : array<int, string>
- $client : TelegramCommandClient
isListed()
Whether the command belongs in the menu `setMyCommands` publishes.
public
isListed() : bool