Skip to content

Commit bd0c76d

Browse files
committed
Change bot_id to bot_token
1 parent c3c7f93 commit bd0c76d

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Installation
3131
* Copy Telegram.php into your server and include it in your new bot script
3232
```php
3333
include("Telegram.php");
34-
$telegram = new Telegram($bot_id);
34+
$telegram = new Telegram($bot_token);
3535
```
3636

3737
* To enable error log file, also copy TelegramErrorLogger.php in the same directory of Telegram.php file
@@ -47,22 +47,22 @@ Configuration (WebHook)
4747
---------
4848

4949
Navigate to
50-
https://api.telegram.org/bot(BOT_ID)/setWebhook?url=https://yoursite.com/your_update.php
50+
https://api.telegram.org/bot(BOT_TOKEN)/setWebhook?url=https://yoursite.com/your_update.php
5151
Or use the Telegram class setWebhook method.
5252

5353
Examples
5454
---------
5555

5656
```php
57-
$telegram = new Telegram($bot_id);
57+
$telegram = new Telegram($bot_token);
5858
$chat_id = $telegram->ChatID();
5959
$content = array('chat_id' => $chat_id, 'text' => "Test");
6060
$telegram->sendMessage($content);
6161
```
6262

6363
If you want to get some specific parameter from the Telegram response:
6464
```php
65-
$telegram = new Telegram($bot_id);
65+
$telegram = new Telegram($bot_token);
6666
$result = $telegram->getData();
6767
$text = $result["message"] ["text"];
6868
$chat_id = $result["message"] ["chat"]["id"];

Telegram.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ class Telegram
5656
*/
5757
const CONTACT = 'contact';
5858

59-
private $bot_id = '';
59+
private $bot_token = '';
6060
private $data = [];
6161
private $updates = [];
6262

6363
/// Class constructor
6464

6565
/**
6666
* Create a Telegram instance from the bot token
67-
* \param $bot_id the bot token
67+
* \param $bot_token the bot token
6868
* \return an instance of the class.
6969
*/
70-
public function __construct($bot_id)
70+
public function __construct($bot_token)
7171
{
72-
$this->bot_id = $bot_id;
72+
$this->bot_token = $bot_token;
7373
$this->data = $this->getData();
7474
}
7575

@@ -84,7 +84,7 @@ public function __construct($bot_id)
8484
*/
8585
public function endpoint($api, array $content, $post = true)
8686
{
87-
$url = 'https://api.telegram.org/bot'.$this->bot_id.'/'.$api;
87+
$url = 'https://api.telegram.org/bot'.$this->bot_token.'/'.$api;
8888
if ($post) {
8989
$reply = $this->sendAPIRequest($url, $content);
9090
} else {
@@ -1307,7 +1307,7 @@ public function editMessageReplyMarkup(array $content)
13071307
*/
13081308
public function downloadFile($telegram_file_path, $local_file_path)
13091309
{
1310-
$file_url = 'https://api.telegram.org/file/bot'.$this->bot_id.'/'.$telegram_file_path;
1310+
$file_url = 'https://api.telegram.org/file/bot'.$this->bot_token.'/'.$telegram_file_path;
13111311
$in = fopen($file_url, 'rb');
13121312
$out = fopen($local_file_path, 'wb');
13131313

bot examples/updates/composer/error.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
require_once '../../../vendor/autoload.php';
44

5-
$bot_id = 'bot_token';
6-
$telegram = new Telegram($bot_id);
5+
$bot_token = 'bot_token';
6+
$telegram = new Telegram($bot_token);
77

88
$telegram->getUpdates();
99
$telegram->serveUpdate(0);

bot examples/updates/composer/getUpdates.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require_once '../../../vendor/autoload.php';
44

5-
$bot_id = 'bot_token';
6-
$telegram = new Telegram($bot_id);
5+
$bot_token = 'bot_token';
6+
$telegram = new Telegram($bot_token);
77

88
var_dump($telegram->getUpdates());

bot examples/updates/getUpdates.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88
include 'Telegram.php';
99

10-
$bot_id = 'bot_token';
11-
$telegram = new Telegram($bot_id);
10+
$bot_token = 'bot_token';
11+
$telegram = new Telegram($bot_token);
1212

1313
// Get all the new updates and set the new correct update_id
1414
$req = $telegram->getUpdates();

bot examples/webhook/gamebot.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
include 'Telegram.php';
44

5-
$bot_id = 'bot_token';
6-
$telegram = new Telegram($bot_id);
5+
$bot_token = 'bot_token';
6+
$telegram = new Telegram($bot_token);
77
$text = $telegram->Text();
88
$chat_id = $telegram->ChatID();
99
$data = $telegram->getData();

bot examples/webhook/update.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
include 'Telegram.php';
88

99
// Set the bot TOKEN
10-
$bot_id = 'bot_token';
10+
$bot_token = 'bot_token';
1111
// Instances the class
12-
$telegram = new Telegram($bot_id);
12+
$telegram = new Telegram($bot_token);
1313

1414
/* If you need to manually take some parameters
1515
* $result = $telegram->getData();

bot examples/webhook/updatecowsay.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
include 'Telegram.php';
99

1010
// Set the bot TOKEN
11-
$bot_id = 'bot_token';
11+
$bot_token = 'bot_token';
1212
// Instances the class
13-
$telegram = new Telegram($bot_id);
13+
$telegram = new Telegram($bot_token);
1414

1515
/* If you need to manually take some parameters
1616
* $result = $telegram->getData();

0 commit comments

Comments
 (0)