From d8a612b6f6df5dc53ae45348c4a655222436391d Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Fri, 10 May 2024 20:51:14 -0500 Subject: [PATCH] Formatting --- commands.py | 9 +++++---- handlers.py | 2 +- threads.py | 24 +++++++++++++++++++++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/commands.py b/commands.py index ecdf1dd..f8a3151 100644 --- a/commands.py +++ b/commands.py @@ -112,11 +112,11 @@ def quote(bot: bare.bot, chan: str, name: str, message: str) -> None: ) # pyright: ignore [reportInvalidStringEscapeSequence] r.seed() with open("mastermessages.txt", "r") as mm: - q =[] + q = [] try: q = list(filter(lambda x: re.search(qfilter, x), mm.readlines())) except re.error: - q = ['Sorry, your query is invalid regex. Please try again.'] + q = ["Sorry, your query is invalid regex. Please try again."] if q == []: q = [f'No results for "{query}" '] sel = conf.decode_escapes( @@ -209,9 +209,10 @@ def markov(bot: bare.bot, chan: str, name: str, message: str) -> None: word = message.split()[1] proposed = bot.markov.generate_text(word) if proposed == word: - proposed = f"Chain failed. (Firepup has never been recorded saying \"{word}\")" + proposed = f'Chain failed. (Firepup has never been recorded saying "{word}")' bot.msg(proposed, chan) + data: dict[str, dict[str, Any]] = { "!botlist": {"prefix": False, "aliases": []}, "bugs bugs bugs": {"prefix": False, "aliases": []}, @@ -242,7 +243,7 @@ data: dict[str, dict[str, Any]] = { "fpmp": {"prefix": True, "aliases": []}, "version": {"prefix": True, "aliases": ["ver", "v"]}, "np": {"prefix": True, "aliases": []}, - "markov": {"prefix": True, "aliases": ["m"]} + "markov": {"prefix": True, "aliases": ["m"]}, } regexes: list[str] = [conf.npbase, conf.su] call: dict[str, Callable[[bare.bot, str, str, str], None]] = { diff --git a/handlers.py b/handlers.py index 59212df..6888ee3 100644 --- a/handlers.py +++ b/handlers.py @@ -138,7 +138,7 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str] ) elif kind == "ACTION ducks": bot.msg("\x01ACTION gets hit by a duck\x01", chan) - if chan in bot.channels and bot.channels[chan] >=bot.interval: + if chan in bot.channels and bot.channels[chan] >= bot.interval: sel = "" bot.channels[chan] = 0 if bot.autoMethod == "QUOTE": diff --git a/threads.py b/threads.py index b28bd38..c77a229 100644 --- a/threads.py +++ b/threads.py @@ -83,7 +83,7 @@ def radio(instance: bare.bot) -> NoReturn: missChunk = 0 missCap = -5 perChunk = 10 - debug = False # instance.server == "replirc" + debug = False # instance.server == "replirc" while 1: try: newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing() @@ -109,7 +109,16 @@ def radio(instance: bare.bot) -> NoReturn: if misses < 0: misses += 1 if debug: - instance.msg(str({"misses": misses, "missChunk": missChunk, "misses exceed or meet limit": misses <= missCap}), "#fp-radio-debug") + instance.msg( + str( + { + "misses": misses, + "missChunk": missChunk, + "misses exceed or meet limit": misses <= missCap, + } + ), + "#fp-radio-debug", + ) sleep(2) continue instance.msg( @@ -125,7 +134,16 @@ def radio(instance: bare.bot) -> NoReturn: for line in Err.split("\n"): instance.log(line, "WARN") if debug: - instance.msg(str({"misses": misses, "missChunk": missChunk, "misses exceed or meet limit": misses <= missCap}), "#fp-radio-debug") + instance.msg( + str( + { + "misses": misses, + "missChunk": missChunk, + "misses exceed or meet limit": misses <= missCap, + } + ), + "#fp-radio-debug", + ) sleep(2) instance.log("Thread while loop broken", "FATAL") exit(1)