From bfd7caaf4483ed42c99645217e934a78fad0db12 Mon Sep 17 00:00:00 2001
From: Dylan Janssen <dylan.janssen31@gmail.com>
Date: Wed, 30 Mar 2022 15:34:13 +0200
Subject: [PATCH] Clean up of the code

---
 commands.py | 10 ++++------
 main.py     |  1 +
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/commands.py b/commands.py
index 3561c21..9ae3bd7 100644
--- a/commands.py
+++ b/commands.py
@@ -43,10 +43,8 @@ def start(update: Update, context: CallbackContext):
         else:
             update.effective_message.reply_text("You cannot join a wallet twice")
 
-    #     TODO. when the last one is added send mnemonics to users
-
     user.set_state(1)
-    # TODO: clear variables
+    user.set_variable({})
 
     reply_msg, reply_markup = generate_message(1)
     update.effective_message.reply_text(reply_msg, reply_markup=reply_markup)
@@ -90,8 +88,8 @@ def choose_wallet(update: Update, context: CallbackContext):
 
 
 def wallet_options(update: Update, context: CallbackContext, user: AppUser):
-    query = update.callback_query.data
-    print("We are in the wallet options: " + query)
+    wallet_name = update.callback_query.data
+    user.set_variable("wallet_name", wallet_name)
     next_state = user.next_state()
     reply_msg, reply_markup = generate_message(next_state)
     update.effective_message.reply_text(reply_msg, reply_markup=reply_markup)
@@ -146,7 +144,7 @@ def name_wallet(update: Update, context: CallbackContext, user: AppUser):
         for request in wallet_requests:
             update.effective_message.reply_text("Hi, please join this wallet as co-signer.\n"
                                                 "Wallet name= {}\n"
-                                                "https://t.me/BitcoinLibTestbot&start={}".format(variables['wallet_name'], request["token"]))
+                                                "https://t.me/BitcoinLibTestbot?start={}".format(variables['wallet_name'], request["token"]))
 
         next_state = user.next_state()
         reply_msg, reply_markup = generate_message(next_state)
diff --git a/main.py b/main.py
index fb9cbff..a57b5b0 100644
--- a/main.py
+++ b/main.py
@@ -22,6 +22,7 @@ class TelegramWrapper:
 
     def start_polling(self):
         self._updater.start_polling()
+        self._updater.idle()
 
     def connect_database(self):
         connect(True)
-- 
GitLab