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

@ -116,7 +116,7 @@ def quote(bot: bare.bot, chan: str, name: str, message: str) -> None:
try: try:
q = list(filter(lambda x: re.search(qfilter, x), mm.readlines())) q = list(filter(lambda x: re.search(qfilter, x), mm.readlines()))
except re.error: 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 == []: if q == []:
q = [f'No results for "{query}" '] q = [f'No results for "{query}" ']
sel = conf.decode_escapes( sel = conf.decode_escapes(
@ -209,9 +209,10 @@ def markov(bot: bare.bot, chan: str, name: str, message: str) -> None:
word = message.split()[1] word = message.split()[1]
proposed = bot.markov.generate_text(word) proposed = bot.markov.generate_text(word)
if proposed == 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) bot.msg(proposed, chan)
data: dict[str, dict[str, Any]] = { data: dict[str, dict[str, Any]] = {
"!botlist": {"prefix": False, "aliases": []}, "!botlist": {"prefix": False, "aliases": []},
"bugs bugs bugs": {"prefix": False, "aliases": []}, "bugs bugs bugs": {"prefix": False, "aliases": []},
@ -242,7 +243,7 @@ data: dict[str, dict[str, Any]] = {
"fpmp": {"prefix": True, "aliases": []}, "fpmp": {"prefix": True, "aliases": []},
"version": {"prefix": True, "aliases": ["ver", "v"]}, "version": {"prefix": True, "aliases": ["ver", "v"]},
"np": {"prefix": True, "aliases": []}, "np": {"prefix": True, "aliases": []},
"markov": {"prefix": True, "aliases": ["m"]} "markov": {"prefix": True, "aliases": ["m"]},
} }
regexes: list[str] = [conf.npbase, conf.su] regexes: list[str] = [conf.npbase, conf.su]
call: dict[str, Callable[[bare.bot, str, str, str], None]] = { call: dict[str, Callable[[bare.bot, str, str, str], None]] = {

View file

@ -109,7 +109,16 @@ def radio(instance: bare.bot) -> NoReturn:
if misses < 0: if misses < 0:
misses += 1 misses += 1
if debug: 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) sleep(2)
continue continue
instance.msg( instance.msg(
@ -125,7 +134,16 @@ def radio(instance: bare.bot) -> NoReturn:
for line in Err.split("\n"): for line in Err.split("\n"):
instance.log(line, "WARN") instance.log(line, "WARN")
if debug: 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) sleep(2)
instance.log("Thread while loop broken", "FATAL") instance.log("Thread while loop broken", "FATAL")
exit(1) exit(1)