forked from Firepup650/FireBot
Formatting
This commit is contained in:
parent
4f0f5d50e6
commit
d8a612b6f6
3 changed files with 27 additions and 8 deletions
|
@ -112,11 +112,11 @@ def quote(bot: bare.bot, chan: str, name: str, message: str) -> None:
|
||||||
) # pyright: ignore [reportInvalidStringEscapeSequence]
|
) # pyright: ignore [reportInvalidStringEscapeSequence]
|
||||||
r.seed()
|
r.seed()
|
||||||
with open("mastermessages.txt", "r") as mm:
|
with open("mastermessages.txt", "r") as mm:
|
||||||
q =[]
|
q = []
|
||||||
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]] = {
|
||||||
|
|
|
@ -138,7 +138,7 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
|
||||||
)
|
)
|
||||||
elif kind == "ACTION ducks":
|
elif kind == "ACTION ducks":
|
||||||
bot.msg("\x01ACTION gets hit by a duck\x01", chan)
|
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 = ""
|
sel = ""
|
||||||
bot.channels[chan] = 0
|
bot.channels[chan] = 0
|
||||||
if bot.autoMethod == "QUOTE":
|
if bot.autoMethod == "QUOTE":
|
||||||
|
|
22
threads.py
22
threads.py
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue