Set up auto-markov replies, if set in config
This commit is contained in:
parent
c69d555e90
commit
4f0f5d50e6
2 changed files with 5 additions and 5 deletions
2
bot.py
2
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"
|
||||
|
|
|
@ -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)
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue