From 98b2076730dd5df1b5f5d33ad790470455f4ac19 Mon Sep 17 00:00:00 2001 From: Zac Herd Date: Mon, 4 Apr 2016 09:38:24 +0100 Subject: [PATCH] No longer logs messages containing web links, changed how logging filters work, v0.10.5 --- bot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 1ab18e0..0216232 100644 --- a/bot.py +++ b/bot.py @@ -25,7 +25,7 @@ from secret import email,pwd name = "Maki" # bot version -version = "v0.10.4" +version = "v0.10.5" # text shown by .help command helptext = """I am a bot written in Python by MrDetonia @@ -283,8 +283,9 @@ def on_message(message): with open('hist.json', 'w') as fp: json.dump(history, fp) - # log user messages for markov chains - if '```' not in message.content: + # log user messages for markov chains, ignoring messages with certain substrings + filters = ['```', 'http://', 'https://'] + if not any(x in message.content for x in filters): with open('./markovs/' + message.author.id, 'a') as fp: fp.write('\n' + message.content)