from aiogram import Bot, Dispatcher, Router, F
from aiogram.types import (
Message,
ReplyKeyboardMarkup,
KeyboardButton,
KeyboardButtonPollType,
)
import asyncio
bot = Bot(token="token")
dp = Dispatcher()
router = Router()
dp.include_router(router)
@router.message(F.text == "/poll")
async def send_poll_keyboard(message: Message):
keyboard = ReplyKeyboardMarkup(
keyboard=[
[
KeyboardButton(
text="Regular",
request_poll=KeyboardButtonPollType(type="regular"),
),
KeyboardButton(
text="Quiz",
request_poll=KeyboardButtonPollType(type="quiz"),
),
],
[
KeyboardButton(
text="Ixtiyoriy",
request_poll=KeyboardButtonPollType(),
),
],
],
resize_keyboard=True,
)
await message.answer("Poll turini tanlang:", reply_markup=keyboard)
async def main():
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())
from aiogram.types import (
Message,
ReplyKeyboardMarkup,
KeyboardButton,
KeyboardButtonPollType,
)
import asyncio
bot = Bot(token="token")
dp = Dispatcher()
router = Router()
dp.include_router(router)
@router.message(F.text == "/poll")
async def send_poll_keyboard(message: Message):
keyboard = ReplyKeyboardMarkup(
keyboard=[
[
KeyboardButton(
text="Regular",
request_poll=KeyboardButtonPollType(type="regular"),
),
KeyboardButton(
text="Quiz",
request_poll=KeyboardButtonPollType(type="quiz"),
),
],
[
KeyboardButton(
text="Ixtiyoriy",
request_poll=KeyboardButtonPollType(),
),
],
],
resize_keyboard=True,
)
await message.answer("Poll turini tanlang:", reply_markup=keyboard)
async def main():
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())