Add optional Matrix thread support for per-category deal organization

When MATRIX_USE_THREADS=true, deals are posted into dedicated threads
instead of the room timeline:

  - 🎮 Game Deals — CheapShark + ITAD type=game
  - 🧩 DLC Deals — ITAD type=dlc
  - 🆓 Epic Free Games — current and upcoming Epic free games
  - 📦 Non-Game Deals — ITAD non-game content (software, courses, etc.)

Thread roots are created on first use and persisted in the database.
When threads are disabled (default), behaviour is unchanged.

Key changes:
- New threads.py module with ThreadCategory enum and routing logic
- ITADDeal now carries deal_type; type filter moved from fetcher to bot
- MatrixDealsClient gains send_deal_in_thread() and create_thread_root()
- Database gets thread_roots table for storing root event IDs
- Bot routes each deal to the appropriate thread via _send_to_thread_or_room()

https://claude.ai/code/session_01EfPjktyrF24DBNHWsY1KBP
This commit is contained in:
Claude
2026-03-01 00:37:26 +00:00
parent f13bfd7b07
commit 2b1c606a80
8 changed files with 273 additions and 33 deletions

View File

@@ -37,6 +37,12 @@ EXTRA_CURRENCIES=CAD,EUR,GBP
MIN_DISCOUNT_PERCENT=50
MAX_PRICE=20
# Matrix threads — post deals into per-category threads instead of the room
# Categories: Game Deals, DLC Deals, Epic Free Games, Non-Game Deals
# When disabled (default), all deals post directly to the room timeline
# and non-game ITAD content is excluded (original behaviour).
#MATRIX_USE_THREADS=false
# Send an intro message to the room on startup (true/false)
SEND_INTRO_MESSAGE=false