From 39e2d65f5070af3e98b4c37b3224e9d0c4cdca37 Mon Sep 17 00:00:00 2001 From: Linus E <75929322+Rripped@users.noreply.github.com> Date: Tue, 3 May 2022 09:22:51 +0200 Subject: [PATCH] fixed selling tranaction --- telegram_bot/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telegram_bot/bot.py b/telegram_bot/bot.py index 83667ba..fabe6ec 100644 --- a/telegram_bot/bot.py +++ b/telegram_bot/bot.py @@ -468,13 +468,13 @@ def set_new_transaction(message): :rtype: none """ user_id = int(message.from_user.id) - bot.send_message(chat_id=user_id, text='Type ",,," (time of transaction will be set to now):') + bot.send_message(chat_id=user_id, text='Type ",,," (time of transaction will be set to now, negative amount is selling, positive is buying):') bot.register_next_step_handler(message, set_new_transaction_step) def set_new_transaction_step(message): user_id = int(message.from_user.id) - if not re.match(r"[A-Za-z0-9]+,[A-Za-z0-9]+,[0-9]+(.[0-9]+)?,[0-9]+(.[0-9]+)?", message.text): + if not re.match(r"[A-Za-z0-9]+,[A-Za-z0-9]+,(-)?[0-9]+(.[0-9]+)?,[0-9]+(.[0-9]+)?", message.text): bot.send_message(chat_id=user_id, text='Invalid format \n(e.g. Apple,US0378331005,53.2,120.4).\n Try again with /newtransaction.') return