要在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标记只能在回复消息中使用,不能在发送消息时使用。

telegram bot 发送html消息

原文地址: https://www.cveoy.top/t/topic/hnBG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录