summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-08-13 21:06:37 -0700
committerPinapelz <yukais@pinapelz.com>2026-08-13 21:06:37 -0700
commiteb636a8066adbeaba216d994b755cc188a6288ad (patch)
tree1f6b7d6950b0dcc38bebd1d6b1ef30e885da4660
parent16f6c75096f5a7d3c87f08e1b670fa87166dfea4 (diff)
remove games featureHEADmain
-rw-r--r--bot.py5
-rw-r--r--games.py90
2 files changed, 0 insertions, 95 deletions
diff --git a/bot.py b/bot.py
index bc44cb1..ce99725 100644
--- a/bot.py
+++ b/bot.py
@@ -3,7 +3,6 @@ import os
from dotenv import load_dotenv
import constants
import restaurants
-import games
load_dotenv()
@@ -17,7 +16,6 @@ creds = botlib.Creds(homeserver=HOMESERVER, username=USERNAME, access_token=ACCE
bot = botlib.Bot(creds)
restaurants.init_db()
-games.init_db()
@bot.listener.on_message_event
@@ -30,9 +28,6 @@ async def trigger_responses(room, message):
if await restaurants.handle_restaurant_command(bot.api, room.room_id, message.sender, message.body, SELF):
return
- if await games.handle_game_command(bot.api, room.room_id, message.sender, message.body, SELF):
- return
-
msg_text = message.body.strip().lower()
cleaned = ''.join(ch if ch.isalnum() else ' ' for ch in msg_text)
words = cleaned.split()
diff --git a/games.py b/games.py
deleted file mode 100644
index d1b666b..0000000
--- a/games.py
+++ /dev/null
@@ -1,90 +0,0 @@
-import db
-
-CATEGORY = "game"
-
-
-def init_db():
- db.init_db()
- db.seed(CATEGORY)
-
-
-def _format(row) -> str:
- note_line = f"\n- {row['note']}" if row['note'].strip() else ""
- return f"{row['name']}{note_line}\nAdded by {row['added_by']}"
-
-
-HELP_TEXT = (
- "🎮 Game bot commands:\n"
- " !addgame <name> [| <note>] — add a new game (names must be unique, note is optional)\n"
- " !removegame <name> — remove a game by name\n"
- " !findgame [keyword] — get a random game (optionally filtered by keyword in note)"
-)
-
-
-async def handle_game_command(bot_api, room_id: str, sender: str, body: str, self_name: str):
- stripped = body.strip()
- lower = stripped.lower()
-
- # Passive trigger: any message containing "what to play"
- if "what to play" in lower and not lower.startswith("!"):
- after = lower.split("what to play", 1)[1].strip()
- if after.isdigit():
- index = int(after)
- total = db.count_items(CATEGORY)
- pick = db.get_item_by_index(CATEGORY, index)
- if pick is None:
- reply = f"❌ Index {index} is out of range. Valid range: 1–{total}."
- else:
- reply = f"#{index} from the list of considerations:\n\n{_format(pick)}"
- else:
- pick = db.find_item(CATEGORY)
- reply = f"Fresh from the list of considerations:\n\n{_format(pick)}" if pick else "No games in the list yet. Use !addgame to add one!"
- await bot_api.send_text_message(room_id, reply)
- return True
-
- if not lower.startswith("!"):
- return False
-
- # !addgame <name> | <note>
- if lower.startswith("!addgame"):
- rest = stripped[len("!addgame"):].strip()
- if not rest:
- await bot_api.send_text_message(
- room_id,
- "Usage: !addgame <name> [| <note>]\nExample: !addgame Minecraft | sandbox survival game\nExample: !addgame Minecraft",
- )
- return True
- if "|" in rest:
- name, _, note = rest.partition("|")
- else:
- name = rest
- note = ""
- added_by = sender.lstrip("@").split(":")[0]
- error = db.add_item(CATEGORY, name, added_by, note=note)
- reply = error if error else f"✅ I will add **{name.strip()}** to the list of considerations"
- await bot_api.send_text_message(room_id, reply)
- return True
-
- # !removegame <name>
- if lower.startswith("!removegame"):
- name = stripped[len("!removegame"):].strip()
- if not name:
- await bot_api.send_text_message(
- room_id,
- "Usage: !removegame <name>\nExample: !removegame Minecraft",
- )
- return True
- result = db.remove_item(CATEGORY, name)
- if result is None:
- reply = f"❌ No game named **{name}** found. Names are case-insensitive."
- else:
- reply = f"🗑️ Removed **{result}** from the game list."
- await bot_api.send_text_message(room_id, reply)
- return True
-
- # !games (help alias)
- if lower.startswith("!games"):
- await bot_api.send_text_message(room_id, HELP_TEXT)
- return True
-
- return False
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage