I just finished creating my first bot and it works perfectly in groups and when I message it, however, when I add it to a Channel and give it all permissions it does not work. The echo message function gives an error of caused error 'NoneType' object has no attribute 'text'.
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from telegram import MessageEntity, InlineQueryResultArticle, InputTextMessageContent
def echo(update, context): # this is from the documentation
context.bot.send_message(chat_id=update.effective_chat.id, text=update.message.text)
def error(update, context):
print(f'Error {update} caused error {context.error}')
def main():
updater = Updater(API)
dp = updater.dispatcher
#Echo message
echo_handler = MessageHandler(Filters.text & (~Filters.command), echo)
dp.add_handler(echo_handler)
#Handle errors
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
main()
update.messageis being returned as aNoneType, do you give your bot read permission too?