Make quotes more sane

This commit is contained in:
Firepup Sixfifty 2024-02-20 16:02:26 -06:00
parent 400a29db99
commit 3c9f11cc52
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
3 changed files with 4 additions and 4 deletions

View file

@ -112,7 +112,7 @@ def quote(bot: bare.bot, chan: str, name: str, message: str) -> None:
if q == []: if q == []:
q = [f'No results for "{query}" '] q = [f'No results for "{query}" ']
sel = conf.decode_escapes( 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) bot.msg(sel, chan)

View file

@ -6,7 +6,7 @@ from typing import Optional, Any
import bare import bare
load_dotenv() 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] 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 .*))$" su = "^(su|sudo|(su .*|sudo .*))$"
servers: dict[str, dict[str, Any]] = { servers: dict[str, dict[str, Any]] = {

View file

@ -141,9 +141,9 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
bot.channels[chan] = 0 bot.channels[chan] = 0
with open("mastermessages.txt", "r") as mm: with open("mastermessages.txt", "r") as mm:
sel = conf.decode_escapes( sel = conf.decode_escapes(
str(r.sample(mm.readlines(), 1)) r.sample(mm.readlines(), 1)[0]
.strip("[]'")
.replace("\\n", "") .replace("\\n", "")
.replace("\n", "")
) )
bot.msg(f"[QUOTE] {sel}", chan) bot.msg(f"[QUOTE] {sel}", chan)
return None, None return None, None