-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTelegramBotApi.php
More file actions
39 lines (30 loc) · 876 Bytes
/
TelegramBotApi.php
File metadata and controls
39 lines (30 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Description of TelegramBotApi
*
* @author iman
*/
namespace Shaygan\TelegramBotApiBundle;
use Symfony\Component\DependencyInjection\Container;
use TelegramBot\Api\BotApi;
class TelegramBotApi
{
private $telegram;
private $old_api;
private $config;
public function __construct(Container $container)
{
$this->config = $container->getParameter('shaygan_telegram_bot_api.config');
if ($this->config['legacy'] === false) {
$this->telegram = new \Longman\TelegramBot\Telegram($this->config['token'], $this->config['bot_name']);
} else {
$this->old_api = new BotApi($this->config['token']);
}
}
public function __call($name, $arguments)
{
if ($this->config['legacy'] === true) {
call_user_method($name, $this->old_api, $arguments);
}
}
}