core icon indicating copy to clipboard operation
core copied to clipboard

Provide further variables to *all* commands.

Open on7lds opened this issue 1 year ago • 0 comments

🎉 Feature Request

Provide further variables to all commands by using setCommandConfig() with an empty command name

Summary

in Telegram.php one could change function getCommandConfig() f.e. as follows :

    public function getCommandConfig($command)
    {
	$config=isset($this->commands_config[$command]) ? $this->commands_config[$command] : [];
	if (isset($this->commands_config[''])) $config=array_merge($this->commands_config[''],$config);
        return $config;
    }

then, using

$telegram->setCommandConfig('', [
    'key' => 'value',
]);

it is possible to add extra variables to all commands on top of variables for a particular command.

Existing 'general' keys are replaced by (if present) keys for a particular command.

on7lds avatar Apr 24 '24 14:04 on7lds