I build a simple telegram bot using the telebot library and it’s successfully working! then I added the bot into a telegram channel it’s not working! also, I added the same bot to a telegram group then it’s working! I’m a little bit confused why the telegram bot is not working in my telegram channel? Can anyone help me through this?
Here is my code.
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()
2
Answers
IIRC, messages and channel posts have different handlers:
Also do make sure the bot is an administrator of the channel.