]> us-delaporte.pagekite.me Git - matrix-shop-bot.git/blobdiff - matrix_shop_bot/bot.py
Fix error code
[matrix-shop-bot.git] / matrix_shop_bot / bot.py
index 5c8e6c5eae83f7ffbbc319bf217c2373244e8e14..f426663a8b8a6f42cb2a6f00a516e62ab13618c3 100644 (file)
@@ -82,6 +82,7 @@ async def do_shop(match):
     if match.command('clear'):
         store_id = ' '.join(match.args()[1:])
         Data().clear_list(store_id)
+        self.last_store_id = None
         return ['Success']
 
     if match.command('clear-all'):
@@ -91,6 +92,9 @@ async def do_shop(match):
 
     if match.command('list'):
         store_id = ' '.join(match.args()[1:])
+        if len(store_id) == 0:
+            store_id = None
+
         items = Data().get_shopping_list(store_id)
         results = ['Shopping List']
         for item in items:
@@ -129,6 +133,9 @@ async def shop_bot(room, message, bot):
                 await bot.api.send_text_message(
                     room.room_id, str(line))
     except Exception as ex:
-        return ['You have:', '    no tea']
+        for line in ['You have:', '    no tea']:
+            await bot.api.send_text_message(
+                room.room_id, str(line))
+