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]
else []
)
self.autoMethof = (
self.autoMethod = (
conf.servers[server]["autoMethod"]
if "autoMethod" in conf.servers[server]
else "QUOTE"

View file

@ -138,18 +138,18 @@ 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":
r.seed()
bot.channels[chan] = 0
with open("mastermessages.txt", "r") as mm:
sel = conf.decode_escapes(
r.sample(mm.readlines(), 1)[0].replace("\\n", "").replace("\n", "")
)
else:
sel = "Markov resp"
bot.msg(f"[{bot.autoMethod}] {sel}")
sel = bot.markov.generate_from_sentence(message)
bot.msg(f"[{bot.autoMethod}] {sel}", chan)
return None, None