【发布时间】:2022-01-03 12:13:10
【问题描述】:
我使用 telebot 库构建了一个简单的电报机器人,它可以成功运行!然后我将机器人添加到电报频道它不起作用!另外,我将同一个机器人添加到电报组,然后它就可以工作了!我有点困惑为什么电报机器人不能在我的电报频道中工作?谁能帮我解决这个问题?
这是我的代码。
import telebot
from constatnts import API_KEY
bot = telebot.TeleBot(API_KEY, parse_mode=None)
@bot.message_handler(commands=['help', 'hello'])
def send_help_message(msg):
bot.reply_to(msg, "Hello this is test bot for ml5")
print(msg)
@bot.message_handler(func=lambda msg: msg.content_type == 'text' )
def send_message(msg):
bot.reply_to(msg, "Gotcha")
bot.polling()
【问题讨论】:
标签: python telegram telegram-bot py-telegram-bot-api