Add random reply chance to markov bot

Whenever someone says something, there's a chance that markov will
interject his opinion. Users can also set the chance between 0.0 and the
default value (in the config) if they want to see markov replies less
often.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-05-30 14:29:37 -07:00
parent 57dd547233
commit 6a1ed5c372
2 changed files with 52 additions and 29 deletions

View File

@@ -38,8 +38,9 @@ async def main():
for line in lines:
if mat := LINE_RE.search(line):
name = mat["name"]
message = mat["message"]
plugin.add(channel, name, message)
message = mat["message"].strip()
if name != server_config.nick and message and message[0] != "!":
plugin.add(channel, name, message)
await plugin.save()