python aiogram 中的机器人如何以同步功能发送消息?

How to send a message in a synchronous function by a bot in python aiogram?

我有一个同步函数,我需要在其中使用 python aiogram 中的机器人发送消息。我发现您可以不使用 bot.send_message (...),而是 requests.get (...) 来发送消息。但是这样你就不能指定 parse_mode 并附加一个内联按钮。还有其他方法可以实现吗?由于某种原因,此选项不起作用。:

requests.get(f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage?chat_id={chat_id}&text={parse_message}&reply_markup={open_tp}&parse_mode=HTML")

使用 <b>AK-47 | Vulcan (Battle-Scarred)</b> 而不是 <strong> 标签。您可以在此处找到 Telegram Bot API 的 HTML 和 Markdown 语法: https://core.telegram.org/bots/api#formatting-options

我们需要在这个结构中包装发送消息:

dp.loop.run_until_complete(bot.send_message(STEAMTRADEBOT_UNLIMITED_ID, parse_message, reply_markup = open_tp))