|
12 | 12 | use Telegram\Bot\Objects\ChatMember; |
13 | 13 | use Telegram\Bot\Objects\File; |
14 | 14 | use Telegram\Bot\Objects\Message; |
| 15 | +use Telegram\Bot\Objects\Poll; |
15 | 16 | use Telegram\Bot\Objects\StickerSet; |
16 | 17 | use Telegram\Bot\Objects\UnknownObject; |
17 | 18 | use Telegram\Bot\Objects\Update; |
@@ -1069,6 +1070,42 @@ public function sendContact(array $params) |
1069 | 1070 | return new Message($response->getDecodedBody()); |
1070 | 1071 | } |
1071 | 1072 |
|
| 1073 | + /** |
| 1074 | + * Send a native pol. |
| 1075 | + * |
| 1076 | + * <code> |
| 1077 | + * $params = [ |
| 1078 | + * 'chat_id' => '', |
| 1079 | + * 'question' => '', |
| 1080 | + * 'options' => '', |
| 1081 | + * 'disable_notification' => '', |
| 1082 | + * 'reply_to_message_id' => '', |
| 1083 | + * 'reply_markup' => '', |
| 1084 | + * ]; |
| 1085 | + * </code> |
| 1086 | + * |
| 1087 | + * @link https://core.telegram.org/bots/api#sendpoll |
| 1088 | + * |
| 1089 | + * @param array $params |
| 1090 | + * |
| 1091 | + * @var int|string $params ['chat_id'] |
| 1092 | + * @var string $params ['question'] |
| 1093 | + * @var string $params ['options'] |
| 1094 | + * @var string $params ['disable_notification'] |
| 1095 | + * @var int $params ['reply_to_message_id'] |
| 1096 | + * @var string $params ['reply_markup'] |
| 1097 | + * |
| 1098 | + * @throws TelegramSDKException |
| 1099 | + * |
| 1100 | + * @return Message |
| 1101 | + */ |
| 1102 | + public function sendPoll(array $params) |
| 1103 | + { |
| 1104 | + $response = $this->post('sendPoll', $params); |
| 1105 | + |
| 1106 | + return new Message($response->getDecodedBody()); |
| 1107 | + } |
| 1108 | + |
1072 | 1109 | /** |
1073 | 1110 | * Broadcast a Chat Action. |
1074 | 1111 | * |
@@ -1519,6 +1556,37 @@ public function editMessageReplyMarkup(array $params) |
1519 | 1556 | return new Message($response->getDecodedBody()); |
1520 | 1557 | } |
1521 | 1558 |
|
| 1559 | + |
| 1560 | + /** |
| 1561 | + * Stop a poll which was sent by the bot. |
| 1562 | + * |
| 1563 | + * <code> |
| 1564 | + * $params = [ |
| 1565 | + * 'chat_id' => '', |
| 1566 | + * 'message_id' => '', |
| 1567 | + * 'reply_markup' => '', |
| 1568 | + * ]; |
| 1569 | + * </code> |
| 1570 | + * |
| 1571 | + * @link https://core.telegram.org/bots/api#stoppoll |
| 1572 | + * |
| 1573 | + * @param array $params |
| 1574 | + * |
| 1575 | + * @var int|string $params ['chat_id'] |
| 1576 | + * @var int $params ['message_id'] |
| 1577 | + * @var string $params ['reply_markup'] |
| 1578 | + * |
| 1579 | + * @throws TelegramSDKException |
| 1580 | + * |
| 1581 | + * @return Poll |
| 1582 | + */ |
| 1583 | + public function stopPoll(array $params) |
| 1584 | + { |
| 1585 | + $response = $this->post('stopPoll', $params); |
| 1586 | + |
| 1587 | + return new Poll($response->getDecodedBody()); |
| 1588 | + } |
| 1589 | + |
1522 | 1590 | /** |
1523 | 1591 | * Use this method to send answers to an inline query. |
1524 | 1592 | * |
|
0 commit comments