Commit 0294f6ed authored by MBoretto's avatar MBoretto

Readme

parent 970ec947
......@@ -21,11 +21,12 @@ Bot aims to provide a platform where one could simply write a plugin
and have interactions in a matter of minutes.
The Bot can:
- retrive update with webhook and getUpdate methods.
- supports all types and methods according to Telegram API (2015 November).
- supports all types and methods according to Telegram API (20 January 2016).
- supports supergroups.
- handle commands in chat with other bots.
- manage Channel from the bot admin interface
- Starting support for **inline bots** (under developing, checkout the InlinequeryCommand **new!**)
- Full support for **inline bots** (**new!**)
- Messages, InlineQuery and ChosenInlineQuery are stored in the Database (**new!**)
## Instructions
### Create your first bot
......@@ -208,10 +209,13 @@ then run
./getUpdateCLI.php
```
### Types
All types implemented according to Telegram API (2015 November).
All types implemented according to Telegram API (20 January 2016).
#### Inline Query
Full support for inline query according to Telegram API (20 January 2016).
### Methods
All methods implemented according to Telegram API (2015 November).
All methods implemented according to Telegram API (20 January 2016).
####Send Message
Message longer than 4096 characters are splitted in more message.
......@@ -282,7 +286,7 @@ You can set a custom prefix to all the tables while you are enabling Mysql:
$telegram->enableMySQL($credentials, $BOT_NAME.'_');
```
Consider to use the utf8mb4 branch if you find some special characters problems.
You can also store inline query and chosen inline query in the database.
### Channels Support
All methods implemented can be used to manage channels.
(**new!**) With admin interface you can manage your channel directly with your bot private chat.
......@@ -298,6 +302,9 @@ It can execute command triggering a chat event. Here's the list:
- Group chat created (**GroupchatcreatedCommand.php**)
- Super group chat created (**SupergroupchatcreatedCommand.php**)
- Channel chat created (**ChannelchatcreatedCommand.php**)
- Inline query (**InlinequeryCommand.php**)
- Chosen inline result (**ChoseninlineresultCommand.php**)
**GenericCommand.php** let you handle commands that don't exist or to
use commands as a variable:
......@@ -337,7 +344,7 @@ Telegram user id can be retrieved with the command **/whoami**.
Admin commands are stored in *src/Admin/* folder.
To know all the commands avaiable type **/help**.
#### Channel Administration (NEW!)
#### Channel Administration
To enable this feature follow those steps:
- Add your bot as channel administrator, this can be done with any telegram client.
- Enable admin interface for your user as explained in the admin section above.
......@@ -365,7 +372,7 @@ $telegram->setLogRequests(true);
$telegram->setLogPath($BOT_NAME.'.log');
```
(New!) Set verbosity to 3, to log also curl requests and responses from the bot to Telegram:
Set verbosity to 3, to log also curl requests and responses from the bot to Telegram:
```php
$telegram->setLogRequests(true);
......@@ -377,6 +384,13 @@ $telegram->setLogVerbosity(3);
This code is available on
[Github](https://github.com/akalongman/php-telegram-bot). Pull requests are welcome.
##Documentation
Take a look at the repo [Wiki](https://github.com/akalongman/php-telegram-bot/wiki) for further information and tutorial!
Feel free to improve!
##Project with this library
Here's a list of projects that feats this library, feel free to add yours!
- [Super-Dice-Roll](https://github.com/RafaelDelboni/Super-Dice-Roll) [@superdiceroll_bot](https://telegram.me/superdiceroll_bot)
## Troubleshooting
......
......@@ -538,7 +538,7 @@ class DB
$video = $message->getVideo();
$voice = $message->getVoice();
$caption = $message->getCaption();
$contanc = $message->getContact();
$contact = $message->getContact();
$location = $message->getLocation();
$new_chat_title = $message->getNewChatTitle();
$delete_chat_photo = $message->getDeleteChatPhoto();
......@@ -574,7 +574,7 @@ class DB
$sth->bindParam(':video', $video, \PDO::PARAM_STR);
$sth->bindParam(':voice', $voice, \PDO::PARAM_STR);
$sth->bindParam(':caption', $caption, \PDO::PARAM_STR);
$sth->bindParam(':contact', $contanct, \PDO::PARAM_STR);
$sth->bindParam(':contact', $contact, \PDO::PARAM_STR);
$sth->bindParam(':location', $location, \PDO::PARAM_STR);
$sth->bindParam(':new_chat_participant', $new_chat_paticipant, \PDO::PARAM_INT);
$sth->bindParam(':left_chat_participant', $left_chat_paticipant, \PDO::PARAM_INT);
......
......@@ -12,14 +12,9 @@ namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InlineQueryResultArticle extends Entity
class InlineQueryResultArticle extends InlineQueryResult
{
protected $type;
protected $id;
protected $title;
protected $message_text;
protected $parse_mode;
protected $disable_web_page_preview;
protected $url;
protected $hide_url;
protected $description;
......@@ -29,26 +24,15 @@ class InlineQueryResultArticle extends Entity
public function __construct(array $data)
{
parent::__construct($data);
$this->type = 'article';
$this->id = isset($data['id']) ? $data['id'] : null;
if (empty($this->id)) {
throw new TelegramException('id is empty!');
}
$this->title = isset($data['title']) ? $data['title'] : null;
if (empty($this->title)) {
throw new TelegramException('title is empty!');
}
$this->message_text = isset($data['message_text']) ? $data['message_text'] : null;
if (empty($this->message_text)) {
throw new TelegramException('message_text is empty!');
}
$this->parse_mode = isset($data['parse_mode']) ? $data['parse_mode'] : null;
$this->disable_web_page_preview = isset($data['disable_webpage_preview']) ? $data['disable_webpage_preview'] : null;
$this->url = isset($data['url']) ? $data['url'] : null;
$this->hide_url = isset($data['hide_url']) ? $data['hide_url'] : null;
$this->description = isset($data['description']) ? $data['description'] : null;
......@@ -58,35 +42,11 @@ class InlineQueryResultArticle extends Entity
}
public function getType()
{
return $this->type;
}
public function getId()
{
return $this->id;
}
public function getTitle()
{
return $this->title;
}
public function getMessageText()
{
return $this->message_text;
}
public function getParseMode()
{
return $this->parse_mode;
}
public function getDisableWebPagePreview()
{
return $this->disable_web_page_preview;
}
public function getUrl()
{
return $this->url;
......
......@@ -29,7 +29,7 @@ class Telegram
*
* @var string
*/
protected $version = '0.26.0';
protected $version = '0.27.0';
/**
* Telegram API key
......
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