Compare commits
2 commits
c90df959d5
...
4f0f5d50e6
Author | SHA1 | Date | |
---|---|---|---|
4f0f5d50e6 | |||
c69d555e90 |
4 changed files with 18 additions and 7 deletions
1
bare.py
1
bare.py
|
@ -41,6 +41,7 @@ class bot:
|
|||
onJoinCmds: list[str]
|
||||
onStrtCmds: list[str]
|
||||
markov: MarkovBot
|
||||
autoMethod: str
|
||||
|
||||
def __init__(self, server: str): ...
|
||||
|
||||
|
|
5
bot.py
5
bot.py
|
@ -72,6 +72,11 @@ class bot(bare.bot):
|
|||
if "onStrtCmds" in conf.servers[server]
|
||||
else []
|
||||
)
|
||||
self.autoMethod = (
|
||||
conf.servers[server]["autoMethod"]
|
||||
if "autoMethod" in conf.servers[server]
|
||||
else "QUOTE"
|
||||
)
|
||||
self.lastfmLink = conf.lastfmLink
|
||||
with open("mastermessages.txt") as f:
|
||||
TMFeed = []
|
||||
|
|
|
@ -45,6 +45,7 @@ servers: dict[str, dict[str, Any]] = {
|
|||
"admins": ["h-tl"],
|
||||
"hosts": ["owner.firepi"],
|
||||
"threads": ["radio"],
|
||||
"autoMethod": "MARKOV",
|
||||
},
|
||||
"backupbox": {
|
||||
"address": "127.0.0.1",
|
||||
|
|
10
handlers.py
10
handlers.py
|
@ -138,14 +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:
|
||||
r.seed()
|
||||
if chan in bot.channels and bot.channels[chan] >=bot.interval:
|
||||
sel = ""
|
||||
bot.channels[chan] = 0
|
||||
if bot.autoMethod == "QUOTE":
|
||||
r.seed()
|
||||
with open("mastermessages.txt", "r") as mm:
|
||||
sel = conf.decode_escapes(
|
||||
r.sample(mm.readlines(), 1)[0].replace("\\n", "").replace("\n", "")
|
||||
)
|
||||
bot.msg(f"[QUOTE] {sel}", chan)
|
||||
else:
|
||||
sel = bot.markov.generate_from_sentence(message)
|
||||
bot.msg(f"[{bot.autoMethod}] {sel}", chan)
|
||||
return None, None
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue