retweetbot worx again!

This commit is contained in:
b3yond 2017-06-25 23:50:58 +02:00
parent 8ad4696179
commit 3fa47de34e
2 changed files with 3 additions and 4 deletions

View file

@ -194,6 +194,6 @@ if __name__ == "__main__":
try: try:
while True: while True:
bot.flow() bot.flow()
sleep(3) sleep(6)
except: except:
bot.shutdown() bot.shutdown()

View file

@ -23,7 +23,7 @@ class Trigger(object):
for pattern in listfile: for pattern in listfile:
pattern = pattern.strip() pattern = pattern.strip()
if pattern: if pattern:
self.goodlist.append(re.compile(pattern)) self.goodlist.append(re.compile(pattern, re.IGNORECASE))
try: try:
blacklistpath = config['trigger']['blacklist_path'] blacklistpath = config['trigger']['blacklist_path']
@ -47,12 +47,11 @@ class Trigger(object):
:return: If the string passes the test :return: If the string passes the test
""" """
for pattern in self.goodlist: for pattern in self.goodlist:
if pattern.match(message): if pattern.search(message) is not None:
break break
else: else:
# no pattern matched # no pattern matched
return False return False
for word in message.lower().split(): for word in message.lower().split():
if word in self.blacklist: if word in self.blacklist:
return False return False