From a34c1d260faa7d0675598de2fb0bd24fadec0d93 Mon Sep 17 00:00:00 2001 From: b3yond Date: Sun, 18 Jun 2017 01:01:11 +0200 Subject: [PATCH] fixed bug bc of empty lines in badlist --- badlist | 1 - trigger.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/badlist b/badlist index f732a93..3082c97 100644 --- a/badlist +++ b/badlist @@ -6,4 +6,3 @@ jude schwuchtel fag faggot - diff --git a/trigger.py b/trigger.py index 9f1f50a..0109ca5 100644 --- a/trigger.py +++ b/trigger.py @@ -10,10 +10,23 @@ class Trigger(object): self.goodlistpath = goodlistpath with open(goodlistpath, "r+") as f: self.goodlist = [s.strip() for s in f.readlines()] + self.goodlist = self.strings_ok(self.goodlist) self.badlistpath = badlistpath with open(badlistpath, "r+") as f: self.badlist = [s.strip() for s in f.readlines()] + self.badlist = self.strings_ok(self.badlist) + + def strings_ok(self, filterlist): + """ + Checks if an empty line is in a list and removes it. + :param filterlist: a good- or badlist. + :return: filterlist: a corrected list. + """ + for word in filterlist: + if word == "\n": + del word + return filterlist def check_string(self, string): """