Skip to content

Commit 9bf3bbc

Browse files
committed
Add Chat method
1 parent 4c2ff82 commit 9bf3bbc

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Telegram.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,30 @@ public function ChatID()
862862

863863
return $this->data['message']['chat']['id'];
864864
}
865+
/**
866+
* \return the Array chat.
867+
*/
868+
public function Chat()
869+
{
870+
$type = $this->getUpdateType();
871+
if ($type == self::CALLBACK_QUERY) {
872+
return @$this->data['callback_query']['message']['chat'];
873+
}
874+
if ($type == self::CHANNEL_POST) {
875+
return @$this->data['channel_post']['chat'];
876+
}
877+
if ($type == self::EDITED_MESSAGE) {
878+
return @$this->data['edited_message']['chat'];
879+
}
880+
if ($type == self::INLINE_QUERY) {
881+
return @$this->data['inline_query']['from'];
882+
}
883+
if ($type == self::MY_CHAT_MEMBER) {
884+
return @$this->data['my_chat_member']['chat'];
885+
}
886+
887+
return $this->data['message']['chat'];
888+
}
865889

866890
/// Get the message_id of the current message
867891

0 commit comments

Comments
 (0)