diff --git a/commands.py b/commands.py index 668c69a..80a66db 100644 --- a/commands.py +++ b/commands.py @@ -112,7 +112,7 @@ def quote(bot: bare.bot, chan: str, name: str, message: str) -> None: if q == []: q = [f'No results for "{query}" '] sel = conf.decode_escapes( - str(r.sample(q, 1)).strip("[]'").replace("\\n", "") + r.sample(q, 1)[0].replace("\\n", "").replace("\n", "") ) bot.msg(sel, chan) diff --git a/config.py b/config.py index aae5581..c62d88c 100644 --- a/config.py +++ b/config.py @@ -6,7 +6,7 @@ from typing import Optional, Any import bare load_dotenv() -__version__ = "v2.0.11" +__version__ = "v2.0.12" npbase: str = "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence] su = "^(su|sudo|(su .*|sudo .*))$" servers: dict[str, dict[str, Any]] = { diff --git a/handlers.py b/handlers.py index 911fd07..b5cffce 100644 --- a/handlers.py +++ b/handlers.py @@ -141,9 +141,9 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str] bot.channels[chan] = 0 with open("mastermessages.txt", "r") as mm: sel = conf.decode_escapes( - str(r.sample(mm.readlines(), 1)) - .strip("[]'") + r.sample(mm.readlines(), 1)[0] .replace("\\n", "") + .replace("\n", "") ) bot.msg(f"[QUOTE] {sel}", chan) return None, None