Telegram Bot 发送 HTML 消息教程
要在 Telegram Bot 中发送 HTML 消息,请使用 sendMessage 方法中的 parse_mode 参数,并将其设置为 HTML。例如:
import telebot
bot = telebot.TeleBot('YOUR_TOKEN')
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.reply_to(message, '<b>Welcome!</b>', parse_mode='HTML')
bot.polling()
在上面的例子中,我们使用了 reply_to 方法来回复用户,并设置了 parse_mode 参数为 HTML,以便在回复消息中使用 HTML 标记。注意,HTML 标记只能在回复消息中使用,不能在发送消息时使用。
原文地址: https://www.cveoy.top/t/topic/oQpM 著作权归作者所有。请勿转载和采集!