S
S
smoosh2020-08-23 18:53:05
Python
smoosh, 2020-08-23 18:53:05

python bot responding with wrong variables?

5f429051d7156719824714.png

function code:
def send_text(message):
if message.text.lower() == '/menu':
bot.send_message(message.chat.id, 'What do you want? \n1. Character abilities \n2. Top player profiles \n3 Game rules')

elif message.text.lower() == '2' or 'Top profiles' or '/profile':
bot.send_message(message.chat.id, 'Top profiles not yet.\n\ nTop profiles updated every week')

elif message.text.lower() == '1' or 'Character Abilities' or '/stats':
bot.send_message(message.chat.id, 'Write character name')

elif message. text.lower() == '3' or 'Rules' or 'rules':
bot.send_message(message.chat.id,'Rules:')

else:
bot.send_message(message.chat.id, 'What are you talking about? Don't be a fool.')

Don't ask why everything is in one function.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kirillinyakin, 2020-08-23
@smoosh

elif message.text.lower() == '2' or 'Top profiles' or '/profile'
It's not spelled like it should be
elif message.text.lower() == '2' or message.text.lower( ) == 'Top profiles' or message.text.lower() == '/profile'
or you can write message.text.lower() in [Top profiles' , '/profile', '2']
And again in telebot, the decorator has a named parameter that is responsible for entering commands, commands is called like

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question