diff --git a/matrixbot/bot.py b/matrixbot/bot.py index e35cf89..ae10f59 100644 --- a/matrixbot/bot.py +++ b/matrixbot/bot.py @@ -1,6 +1,5 @@ import asyncio import json -import logging import signal import sys from pathlib import Path diff --git a/matrixbot/callbacks.py b/matrixbot/callbacks.py index a3c7d5c..5e3487b 100644 --- a/matrixbot/callbacks.py +++ b/matrixbot/callbacks.py @@ -1,7 +1,7 @@ import logging from functools import wraps -from nio import AsyncClient, RoomMessageText, UnknownEvent +from nio import AsyncClient from config import BOT_PREFIX, MATRIX_USER_ID from commands import COMMANDS, metrics diff --git a/matrixbot/commands.py b/matrixbot/commands.py index e91544b..7e7a4d6 100644 --- a/matrixbot/commands.py +++ b/matrixbot/commands.py @@ -6,16 +6,16 @@ import time import logging from collections import Counter from datetime import datetime -from functools import partial import aiohttp from nio import AsyncClient from utils import send_text, send_html, send_reaction, sanitize_input +from wordle import handle_wordle from config import ( MAX_DICE_SIDES, MAX_DICE_COUNT, BOT_PREFIX, ADMIN_USERS, - OLLAMA_URL, OLLAMA_MODEL, MAX_INPUT_LENGTH, COOLDOWN_SECONDS, + OLLAMA_URL, OLLAMA_MODEL, COOLDOWN_SECONDS, MINECRAFT_RCON_HOST, MINECRAFT_RCON_PORT, MINECRAFT_RCON_PASSWORD, RCON_TIMEOUT, MIN_USERNAME_LENGTH, MAX_USERNAME_LENGTH, ) @@ -99,7 +99,7 @@ async def cmd_help(client: AsyncClient, room_id: str, sender: str, args: str): @command("ping", "Check bot latency") async def cmd_ping(client: AsyncClient, room_id: str, sender: str, args: str): start = time.monotonic() - resp = await send_text(client, room_id, "Pong!") + _ = await send_text(client, room_id, "Pong!") elapsed = (time.monotonic() - start) * 1000 # Edit isn't straightforward in Matrix, so just send a follow-up if slow if elapsed > 500: @@ -822,8 +822,6 @@ async def cmd_health(client: AsyncClient, room_id: str, sender: str, args: str): # --------------------------------------------------------------------------- # Wordle # --------------------------------------------------------------------------- -from wordle import handle_wordle - @command("wordle", "Play Wordle! (!wordle help for details)") async def cmd_wordle(client: AsyncClient, room_id: str, sender: str, args: str): diff --git a/matrixbot/config.py b/matrixbot/config.py index 3a66c92..a298eb2 100644 --- a/matrixbot/config.py +++ b/matrixbot/config.py @@ -1,5 +1,4 @@ import os -import logging from dotenv import load_dotenv load_dotenv() diff --git a/matrixbot/wordle.py b/matrixbot/wordle.py index b95a0b2..de6aa9f 100644 --- a/matrixbot/wordle.py +++ b/matrixbot/wordle.py @@ -317,7 +317,6 @@ def render_keyboard_plain(game: WordleGame) -> str: letter_states[letter] = max(letter_states.get(letter, -1), score) lines = [] - symbols = {-1: " ", 0: "\u2717", 1: "?", 2: "\u2713"} for row in _KB_ROWS: chars = [] for letter in row: @@ -465,7 +464,7 @@ async def wordle_start_or_status(client: AsyncClient, room_id: str, sender: str, if sender in _active_games: game = _active_games[sender] if not game.finished: - guesses_left = 6 - len(game.guesses) + _ = 6 - len(game.guesses) grid_plain = render_grid_plain(game) kb_plain = render_keyboard_plain(game) plain = ( @@ -626,7 +625,7 @@ async def wordle_guess( return # Still playing — show grid + keyboard - guesses_left = 6 - len(game.guesses) + _ = 6 - len(game.guesses) grid_plain = render_grid_plain(game) kb_plain = render_keyboard_plain(game) plain = (