My telegram bot answers in personal chats but don't in group chats. I could not find the problem. A snippet from my code:
@app.route('/{}'.format(TOKEN), methods=['POST'])
def respond():
# retrieve the message in JSON and then transform it to Telegram object
update = telegram.Update.de_json(request.get_json(force=True), bot)
# get the chat_id to be able to respond to the same user
chat_id = update.message.chat.id
# Telegram understands UTF-8, so encode text for unicode compatibility
text = update.message.text
if text == '/start':
response = send_welcome()
bot.sendMessage(chat_id=chat_id, text=response)
elif 'discord' in text.split():
response = send_discord()
bot.sendMessage(chat_id=chat_id, text=response)
elif 'edeka' in text.split():
response = send_edeka()
bot.sendMessage(chat_id=chat_id, text=response)
elif 'random' in text.split():
response = send_random()
bot.sendMessage(chat_id=chat_id, text=response)
elif 'metro' in text.split():
response = send_metro()
bot.sendMessage(chat_id=chat_id, text=response)
elif text == '/help':
response = send_help()
bot.sendMessage(chat_id=chat_id, text=response)
elif text == 'Good bot':
response = 'Önemli degil kanka'
bot.sendMessage(chat_id=chat_id, text=response)
return 'ok'
I get an error message in heroku for text.split(), but only from group chats.