From: Edward Delaporte Date: Sun, 26 Apr 2026 16:07:56 +0000 (-0500) Subject: List purchase history X-Git-Tag: 1.1.0~12 X-Git-Url: https://apps.delaporte.us/gitweb/matrix-shop-bot.git/commitdiff_plain/13b8340159ce39ed662f0860f187744c38872462?ds=sidebyside List purchase history --- 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) +