owenrusk.dev

errands

small jobs the runtime does for the studio.

git clone https://owenrusk.dev/errands.git

commit e231cd5db0c70b0632a555be6e5db054f346208e
parent c1faf98ad17eab3f904a2166c2a8b4b3a0e525cf
author Owen Rusk <owen@papermothgames.com>
date   2026-01-13 15:45:03 -0600
tools: what's unpaid, and paying it
errands/tools.py+12-1
diff --git a/errands/tools.py b/errands/tools.py
index 50f3cc7..288dec1 100644
--- a/errands/tools.py
+++ b/errands/tools.py
@@ -2,7 +2,7 @@
 import json
 from typing import Callable
 
-from . import hosting, mail, posts, vault
+from . import hosting, invoices, mail, posts, vault
 
 TOOLS: dict[str, Callable] = {}
 
@@ -45,6 +45,17 @@ def hosting_pay(amount: str) -> dict:
     return hosting.pay(hosting.dollars(amount))
 
 
+@tool
+def invoices_unpaid() -> list[dict]:
+    return [{"id": index, **vars(i)} for index, i in enumerate(invoices.load()) if not i.paid]
+
+
+@tool
+def invoices_pay(id: int) -> bool:
+    invoices.pay(id)
+    return True
+
+
 @tool
 def vault_login(name: str) -> dict:
     item = vault.default().item(name)