From 4f0f5d50e607c02dbde9e9e3a1e7cf7f1a67d880 Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Fri, 10 May 2024 20:50:31 -0500 Subject: [PATCH] Set up auto-markov replies, if set in config --- bot.py | 2 +- handlers.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 1433f68..ee10ced 100644 --- a/bot.py +++ b/bot.py @@ -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" diff --git a/handlers.py b/handlers.py index cc6899f..59212df 100644 --- a/handlers.py +++ b/handlers.py @@ -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