Skip to content

Commit d0f8506

Browse files
committed
improve getUpdateType
1 parent a175b8b commit d0f8506

File tree

1 file changed

+20
-73
lines changed

1 file changed

+20
-73
lines changed

Telegram.php

Lines changed: 20 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,98 +1704,45 @@ public function getUpdateType()
17041704
}
17051705

17061706
$update = $this->data;
1707-
if (isset($update['inline_query'])) {
1707+
$this->update_type = false;
1708+
if (isset($update['inline_query']))
17081709
$this->update_type = self::INLINE_QUERY;
1709-
1710-
return $this->update_type;
1711-
}
1712-
if (isset($update['callback_query'])) {
1710+
if (isset($update['callback_query']))
17131711
$this->update_type = self::CALLBACK_QUERY;
1714-
1715-
return $this->update_type;
1716-
}
1717-
if (isset($update['edited_message'])) {
1712+
if (isset($update['edited_message']))
17181713
$this->update_type = self::EDITED_MESSAGE;
1719-
1720-
return $this->update_type;
1721-
}
1722-
if (isset($update['message']['text'])) {
1714+
if (isset($update['message']['text']))
17231715
$this->update_type = self::MESSAGE;
1724-
1725-
return $this->update_type;
1726-
}
1727-
if (isset($update['message']['photo'])) {
1716+
if (isset($update['message']['photo']))
17281717
$this->update_type = self::PHOTO;
1729-
1730-
return $this->update_type;
1731-
}
1732-
if (isset($update['message']['video'])) {
1718+
if (isset($update['message']['video']))
17331719
$this->update_type = self::VIDEO;
1734-
1735-
return $this->update_type;
1736-
}
1737-
if (isset($update['message']['audio'])) {
1720+
if (isset($update['message']['audio']))
17381721
$this->update_type = self::AUDIO;
1739-
1740-
return $this->update_type;
1741-
}
1742-
if (isset($update['message']['voice'])) {
1722+
if (isset($update['message']['voice']))
17431723
$this->update_type = self::VOICE;
1744-
1745-
return $this->update_type;
1746-
}
1747-
if (isset($update['message']['contact'])) {
1724+
if (isset($update['message']['contact']))
17481725
$this->update_type = self::CONTACT;
1749-
1750-
return $this->update_type;
1751-
}
1752-
if (isset($update['message']['location'])) {
1726+
if (isset($update['message']['location']))
17531727
$this->update_type = self::LOCATION;
1754-
1755-
return $this->update_type;
1756-
}
1757-
if (isset($update['message']['reply_to_message'])) {
1728+
if (isset($update['message']['reply_to_message']))
17581729
$this->update_type = self::REPLY;
1759-
1760-
return $this->update_type;
1761-
}
1762-
if (isset($update['message']['animation'])) {
1730+
if (isset($update['message']['animation']))
17631731
$this->update_type = self::ANIMATION;
1764-
1765-
return $this->update_type;
1766-
}
1767-
if (isset($update['message']['sticker'])) {
1732+
if (isset($update['message']['sticker']))
17681733
$this->update_type = self::STICKER;
1769-
1770-
return $this->update_type;
1771-
}
1772-
if (isset($update['message']['document'])) {
1734+
if (isset($update['message']['document']))
17731735
$this->update_type = self::DOCUMENT;
1774-
1775-
return $this->update_type;
1776-
}
1777-
if (isset($update['message']['new_chat_member'])) {
1736+
if (isset($update['message']['new_chat_member']))
17781737
$this->update_type = self::NEW_CHAT_MEMBER;
1779-
1780-
return $this->update_type;
1781-
}
1782-
if (isset($update['message']['left_chat_member'])) {
1738+
if (isset($update['message']['left_chat_member']))
17831739
$this->update_type = self::LEFT_CHAT_MEMBER;
1784-
1785-
return $this->update_type;
1786-
}
1787-
if (isset($update['my_chat_member'])) {
1740+
if (isset($update['my_chat_member']))
17881741
$this->update_type = self::MY_CHAT_MEMBER;
1789-
1790-
return $this->update_type;
1791-
}
1792-
if (isset($update['channel_post'])) {
1742+
if (isset($update['channel_post']))
17931743
$this->update_type = self::CHANNEL_POST;
17941744

1795-
return $this->update_type;
1796-
}
1797-
1798-
return false;
1745+
return $this->update_type;
17991746
}
18001747

18011748
private function sendAPIRequest($url, array $content, $post = true)

0 commit comments

Comments
 (0)