fixed bug bc of empty lines in badlist

This commit is contained in:
b3yond 2017-06-18 01:01:11 +02:00
parent f0f5d91813
commit a34c1d260f
2 changed files with 13 additions and 1 deletions

View file

@ -6,4 +6,3 @@ jude
schwuchtel
fag
faggot

View file

@ -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):
"""