Skip to content

Commit 227a9a9

Browse files
committed
Better ChatID method
1 parent 9bf3bbc commit 227a9a9

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

Telegram.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -843,24 +843,8 @@ public function Caption()
843843
*/
844844
public function ChatID()
845845
{
846-
$type = $this->getUpdateType();
847-
if ($type == self::CALLBACK_QUERY) {
848-
return @$this->data['callback_query']['message']['chat']['id'];
849-
}
850-
if ($type == self::CHANNEL_POST) {
851-
return @$this->data['channel_post']['chat']['id'];
852-
}
853-
if ($type == self::EDITED_MESSAGE) {
854-
return @$this->data['edited_message']['chat']['id'];
855-
}
856-
if ($type == self::INLINE_QUERY) {
857-
return @$this->data['inline_query']['from']['id'];
858-
}
859-
if ($type == self::MY_CHAT_MEMBER) {
860-
return @$this->data['my_chat_member']['chat']['id'];
861-
}
862-
863-
return $this->data['message']['chat']['id'];
846+
$chat = $this->Chat();
847+
return $chat['id'];
864848
}
865849
/**
866850
* \return the Array chat.

0 commit comments

Comments
 (0)