sendPollПоддерживается
Use this method to send a native poll. On success, the sent Message is returned.
regular/quiz, anonymous/public, multiple answers, revoting, shuffle, hide results, open_period/close_date (≤2628000), is_closed, description, poll/option media; allow_adding_options (public non-quiz polls: voters add options via messages.addPollAnswer and delete them via deletePollAnswer, ids never reused; supergroups get poll_option_added/poll_option_deleted); members_only/country_codes (channel chats; enforced on every vote: channel member for >24 h, country from the voter's phone, FT = +888); explanation_media for quizzes; Poll carries members_only/country_codes/explanation_media, PollOption.added_by_user/added_by_chat/addition_date; business_connection_id supported (poll created by the account)
Параметры
@username. Polls can't be sent to channel direct messages chats.Пример запроса
curl "https://api.staticgram.top/bot$TOKEN/sendPoll" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 123456789,
"question": "Ваш выбор?",
"options": [
{
"text": "Да"
},
{
"text": "Нет"
}
]
}'from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)
result = await bot.send_poll(
chat_id=123456789,
question="Ваш выбор?",
options=[{"text": "Да"}, {"text": "Нет"}],
)const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/sendPoll`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"question": "Ваш выбор?",
"options": [
{
"text": "Да"
},
{
"text": "Нет"
}
]
}),
});
const data = await res.json();Ответ (Message)
{
"ok": true,
"result": {
"message_id": 1,
"date": 1790000000,
"chat": {
"id": 1780243423,
"type": "private"
}
}
}