Beispiel #1
0
def balance(bot, update, args):
    equation = "".join(args)
    user = Chemistry(equation)
    if user.check_equation():
        # if the equation is written right
        balanced = user.balance()
        if balanced == False:
            # if something went wrong during the balance
            bot.send_message(chat_id=update.message.chat_id,
                             text="Something"
                             " went wrong during the balance of the equation.")
            equation_example(bot, update)
        else:
            # went all right
            bot.send_message(chat_id=update.message.chat_id, text=balanced)
    else:
        # if the equation isn't written right
        bot.send_message(chat_id=update.message.chat_id,
                         text="Something went "
                         "wrong during the balance of the equation.")
        equation_example(bot, update)