Break reaction string parsing out to a function.

master
jowj 6 years ago
parent 513e24edd2
commit 6ddfd96f7d

@ -98,15 +98,14 @@ def reactable_string(text):
"""Return regex objects matching interesting strings
"""
reactable_array = []
if 'ai' in text.lower():
re.search(r"\bai\b", text)
reactable_array.append('ai')
if re.search(r"\bai\b", text.lower()) is not None:
reactable_array.append('ai')
if 'furry' in text.lower() or 'furries' in text.lower() or 'fursuit' in text.lower():
# no processing needed because: honestly its funnier even if it gets the word boundary wrong.
reactable_array.append('furry')
if 'flavor town' in text.lower() or 'flavortown' in text.lower() or 'guy fieri' in text.lower():
# no processing needed because: honestly its funnier even if it gets the word boundary wrong.
reactablearray.append('flavortown')
reactable_array.append('flavortown')
return reactable_array
def get_channel_ID(channelName):
@ -130,8 +129,8 @@ if __name__ == "__main__":
if reactable_message(event):
channel = event['channel']
text = event['text']
reactions_needeed = reactable_string(text)
if 'ai ' in reactions_needed:
reactions_needed = reactable_string(text)
if 'ai' in reactions_needed:
print(event.get('ts')) # does this populate
slack_client.api_call(
'reactions.add',

Loading…
Cancel
Save