From 13b8340159ce39ed662f0860f187744c38872462 Mon Sep 17 00:00:00 2001 From: Edward Delaporte Date: Sun, 26 Apr 2026 11:07:56 -0500 Subject: [PATCH] List purchase history --- matrix_shop_bot/bot.py | 10 ++++++++++ matrix_shop_bot/tasks.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/matrix_shop_bot/bot.py b/matrix_shop_bot/bot.py index 46ba972..ae65bdc 100644 --- a/matrix_shop_bot/bot.py +++ b/matrix_shop_bot/bot.py @@ -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'] diff --git a/matrix_shop_bot/tasks.py b/matrix_shop_bot/tasks.py index 8d1125e..515649b 100644 --- a/matrix_shop_bot/tasks.py +++ b/matrix_shop_bot/tasks.py @@ -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) + -- 2.47.3