Fix banned words regex handler

This commit is contained in:
Jeremy "EndenDragon" Zhang 2020-04-29 16:44:37 -07:00 committed by GitHub
parent 7ac24a8981
commit 012700ee7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ def format_post_content(guild_id, channel_id, message, dbUser):
for word in banned_words: for word in banned_words:
word_boundaried = r"\b%s\b" % word word_boundaried = r"\b%s\b" % word
regex = re.compile(word_boundaried, re.IGNORECASE) regex = re.compile(word_boundaried, re.IGNORECASE)
if regex.match(message): if regex.search(message):
illegal_post = True illegal_post = True
illegal_reasons.append("The following word is prohibited: " + word) illegal_reasons.append("The following word is prohibited: " + word)
@ -744,4 +744,4 @@ def af_direct_message_post():
cleverbot_url = "http://www.cleverbot.com/getreply" cleverbot_url = "http://www.cleverbot.com/getreply"
payload = {'key': config["cleverbot-api-key"], 'cs': cs, 'input': input} payload = {'key': config["cleverbot-api-key"], 'cs': cs, 'input': input}
r = requests.get(cleverbot_url, params=payload) r = requests.get(cleverbot_url, params=payload)
return jsonify(r.json()) return jsonify(r.json())