Commit b83f848d authored by sabas's avatar sabas

Fix GenericCommand and minor spelling errors

parent 235fd820
......@@ -90,14 +90,14 @@ And run composer update
composer require longman/telegram-bot
```
###### bot token
###### Bot token
You will notice that the Telegram Bot wants a value for `API_KEY`. This token may be obtained via a telegram client for your bot. See [this](https://core.telegram.org/bots#botfather) link if you are unsure of how to so this.
## Usage
You must set [WebHook](https://core.telegram.org/bots/api#setwebhook)
You must set a [WebHook](https://core.telegram.org/bots/api#setwebhook)
Create set.php and put:
Create set.php and put into it:
```php
<?php
$loader = require __DIR__.'/vendor/autoload.php';
......@@ -154,7 +154,7 @@ $telegram->enableMySQL($credentials, $BOT_NAME.'_');
```
Commads
Commands
--------------
The bot is able to recognise commands in chat with multiple bot.
It can execute command triggering a chat event. Here's the list:
......@@ -165,7 +165,7 @@ It can execute command triggering a chat event. Here's the list:
- New chat title (**NewchattitleCommand.php**)
- Left chat participant (**LeftchatparticipantCommand.php**)
**GenericCommand.php** let you handle commands that non exist or use commands as var:
**GenericCommand.php** lets you handle commands that don't exist or to use commands as a variable:
Favourite colour? **/black /red**
Favourite number? **/1 /134**
......@@ -179,7 +179,6 @@ $telegram->addCommandsPath($COMMANDS_FOLDER);
```
Send message to all active chats (new!)
---------------------------------------
To do this you have to enable the mysql connection.
......
......@@ -17,7 +17,7 @@ use Longman\TelegramBot\Entities\Update;
class GenericCommand extends Command
{
protected $name = 'Generic';
protected $description = 'Handle genric commands or is executed by defaul when a command is not found';
protected $description = 'Handle genric commands or is executed by default when a command is not found';
protected $usage = '/';
protected $version = '1.0.0';
protected $enabled = true;
......@@ -29,6 +29,11 @@ class GenericCommand extends Command
//you can use $command as param
$command = $message->getCommand();
$chat_id = $message->getChat()->getId();
$text = $message->getText(true);
$data = array();
$data['chat_id'] = $chat_id;
$data['text'] = 'Command: '.$command.' not found.. :(';
$result = Request::sendMessage($data);
return $result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment