You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN');
85
-
// or initialize with botan.io tracker api key
86
-
// $bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
87
-
88
85
89
86
//Handle /ping command
90
87
$bot->command('ping', function ($message) use ($bot) {
@@ -107,45 +104,26 @@ try {
107
104
}
108
105
```
109
106
110
-
### Botan SDK (not supported more)
111
-
112
-
[Botan](http://botan.io) is a telegram bot analytics system based on [Yandex.Appmetrica](http://appmetrica.yandex.com/).
113
-
In this document you can find how to setup Yandex.Appmetrica account, as well as examples of Botan SDK usage.
114
-
115
-
### Creating an account
116
-
* Register at http://appmetrica.yandex.com/
117
-
* After registration you will be prompted to create Application. Please use @YourBotName as a name.
118
-
* Save an API key from settings page, you will use it as a token for Botan API calls.
119
-
* Download lib for your language, and use it as described below. Don`t forget to insert your token!
120
-
121
-
Since we are only getting started, you may discover that some existing reports in AppMetriсa aren't properly working for Telegram bots, like Geography, Gender, Age, Library, Devices, Traffic sources and Network sections. We will polish that later.
122
-
123
-
## SDK usage
124
-
125
-
#### Standalone
107
+
#### Local Bot API Server
126
108
127
-
```php
128
-
$tracker = new \TelegramBot\Api\Botan('YOUR_BOTAN_TRACKER_API_KEY');
129
-
130
-
$tracker->track($message, $eventName);
131
-
```
109
+
For using custom [local bot API server](https://core.telegram.org/bots/api#using-a-local-bot-api-server)
132
110
133
-
#### API Wrapper
134
111
```php
135
-
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
136
-
137
-
$bot->track($message, $eventName);
112
+
use TelegramBot\Api\Client;
113
+
$token = 'YOUR_BOT_API_TOKEN';
114
+
$bot = new Client($token, null, null, 'http://localhost:8081');
138
115
```
139
116
140
-
You can use method 'getUpdates()'and all incoming messages will be automatically tracked as `Message`-event.
117
+
#### Third-party Http Client
141
118
142
-
#### Client
143
119
```php
144
-
$bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
120
+
use Symfony\Component\HttpClient\HttpClient;
121
+
use TelegramBot\Api\BotApi;
122
+
use TelegramBot\Api\Http\SymfonyHttpClient;
123
+
$token = 'YOUR_BOT_API_TOKEN';
124
+
$bot = new Client($token, null, new SymfonyHttpClient(HttpClient::create()););
145
125
```
146
126
147
-
_All registered commands are automatically tracked as command name_
148
-
149
127
## Change log
150
128
151
129
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
0 commit comments