Skip to content

Commit b2ec976

Browse files
committed
Add getBotId()
1 parent f536bae commit b2ec976

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Telegram.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ class Telegram
4646
*/
4747
protected $bot_name = '';
4848

49+
/**
50+
* Telegram Bot id
51+
*
52+
* @var string
53+
*/
54+
protected $bot_id = '';
55+
4956
/**
5057
* Raw request data (json) for webhook methods
5158
*
@@ -144,6 +151,9 @@ public function __construct($api_key, $bot_name)
144151
$this->api_key = $api_key;
145152
$this->bot_name = $bot_name;
146153

154+
preg_match("/([0-9]*)\:.*/", $this->api_key, $matches);
155+
$this->bot_id = $matches[1];
156+
147157
//Set default download and upload path
148158
$this->setDownloadPath(BASE_PATH . '/../Download');
149159
$this->setUploadPath(BASE_PATH . '/../Upload');
@@ -728,6 +738,16 @@ public function getBotName()
728738
return $this->bot_name;
729739
}
730740

741+
/**
742+
* Get Bot Id
743+
*
744+
* @return string
745+
*/
746+
public function getBotId()
747+
{
748+
return $this->bot_id;
749+
}
750+
731751
/**
732752
* Get Version
733753
*

0 commit comments

Comments
 (0)