]> apps.delaporte.us Git - matrix-shop-bot.git/commitdiff
List purchase history
authorEdward Delaporte <edward@delaporte.us>
Sun, 26 Apr 2026 16:07:56 +0000 (11:07 -0500)
committerEdward Delaporte <edward@delaporte.us>
Sun, 26 Apr 2026 16:07:56 +0000 (11:07 -0500)
matrix_shop_bot/bot.py
matrix_shop_bot/tasks.py

index 46ba972de0b86c0fbaefdd3c9d84b3b0b65d7374..ae65bdc03494b7f6166c79dc40ff607c653dcd47 100644 (file)
@@ -121,6 +121,16 @@ async def do_shop(match):
             results.append(str(item))
         return results
 
+
+    if match.command('past'):
+        store_name = ' '.join(match.args()[1:])
+        items = Data().list_purchases(store_name)
+        results = ['Past purchases at {store_name}']
+        for item in items:
+            results.append(str(item))
+        return results
+    
+
     if match.command('unsorted'):
         items = Data().get_unsorted_list()
         results = ['Items assigned to no store']
index 8d1125ee36ff3688ab3f0aa01515459d469b81d1..515649b623f60bd1774cd01b652229b0e51768c6 100644 (file)
@@ -88,3 +88,9 @@ def remove_item(c, item_id):
 def remove_store(c, store_id):
     Data().remove_store(store_id)
 
+@task
+def list_purchases(c, store):
+    items = Data().list_purchases(store)
+    for item in items:
+        print(item)
+