Formatting

This commit is contained in:
Firepup Sixfifty 2024-05-10 20:51:14 -05:00
parent 4f0f5d50e6
commit d8a612b6f6
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
3 changed files with 27 additions and 8 deletions

View file

@ -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]] = {

View file

@ -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":

View file

@ -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)