reply_keyboard.py 483 B

12345678910111213141516
  1. from __future__ import annotations
  2. from contextlib import suppress
  3. from typing import Any
  4. from pyrogram.types import ReplyKeyboardRemove
  5. async def remove_reply_keyboard(message: Any) -> None:
  6. """Remove a stale Telegram reply keyboard without leaving a chat message."""
  7. notice = await message.reply_text(
  8. "正在打开消息内菜单…",
  9. reply_markup=ReplyKeyboardRemove(selective=False),
  10. )
  11. with suppress(Exception):
  12. await notice.delete()