message.text
посмотреть в message.text_markdown
или message.text_html
(доки)? Ну и соответственно указать не text, а markdown или html при вызове send_message(). menus = [menu1, menu2, menu3]
print(menus) # [menu1, menu2, menu3]
def menu_select(menu):
menus[2] = menus[1]
menus[1] = menus[0]
menus[0] = menu
# смена меню на menu4
menu_select(menu4)
print(menus) # [menu4, menu1, menu2]
import asyncio
from aiogram import Bot, Dispatcher, F
from aiogram.filters.callback_data import CallbackData
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram.filters import Command, BaseFilter
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery, ReplyKeyboardMarkup, \
KeyboardButtonRequestChat
from aiogram.utils.keyboard import InlineKeyboardBuilder
from aiogram.types import (
KeyboardButton,
Message)
TOKEN = ""
bot = Bot(TOKEN)
dp = Dispatcher(storage=MemoryStorage())
@dp.message(F.text.contains("/start"))
async def text_handler(message: Message):
await message.answer("I'm here", reply_markup=ReplyKeyboardMarkup(keyboard=
[
[
KeyboardButton(text="test1", request_chat=KeyboardButtonRequestChat(
request_id=1,
user_is_bot=False,
chat_is_channel=True,
chat_is_forum=False
)),
KeyboardButton(text="test2", request_chat=KeyboardButtonRequestChat(
request_id=2,
user_is_bot=False,
chat_is_channel=False,
chat_is_forum=False
)),
]
]
))
@dp.message(F.chat)
async def handle_request_chat(msg: Message):
chat_info = msg.chat_shared.chat_id
await bot.send_message(msg.from_user.id, f"Вы выбрали канал с ID: {chat_info}")
async def main():
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())