Set up auto-markov replies, if set in config

This commit is contained in:
Firepup Sixfifty 2024-05-10 20:50:31 -05:00
parent c69d555e90
commit 4f0f5d50e6
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
2 changed files with 5 additions and 5 deletions

2
bot.py
View file

@ -72,7 +72,7 @@ class bot(bare.bot):
if "onStrtCmds" in conf.servers[server] if "onStrtCmds" in conf.servers[server]
else [] else []
) )
self.autoMethof = ( self.autoMethod = (
conf.servers[server]["autoMethod"] conf.servers[server]["autoMethod"]
if "autoMethod" in conf.servers[server] if "autoMethod" in conf.servers[server]
else "QUOTE" else "QUOTE"

View file

@ -140,16 +140,16 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
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
if bot.autoMethod == "QUOTE": if bot.autoMethod == "QUOTE":
r.seed() r.seed()
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(
r.sample(mm.readlines(), 1)[0].replace("\\n", "").replace("\n", "") r.sample(mm.readlines(), 1)[0].replace("\\n", "").replace("\n", "")
) )
else: else:
sel = "Markov resp" sel = bot.markov.generate_from_sentence(message)
bot.msg(f"[{bot.autoMethod}] {sel}") bot.msg(f"[{bot.autoMethod}] {sel}", chan)
return None, None return None, None