diff --git a/mojo-bot-v2.py b/mojo-bot-v2.py index 3d240cb..183b5af 100644 --- a/mojo-bot-v2.py +++ b/mojo-bot-v2.py @@ -31,14 +31,6 @@ def reactable_string(text): # no processing needed because: honestly its funnier even if it gets the word boundary wrong. reactable_array.append('flavortown') return reactable_array - - -# def react_to_message(reaction): -# payload['web_client'].reactions_add( -# channel = channel_id, -# name = reaction, -# thread_ts = thread_ts -# ) @slack.RTMClient.run_on(event='message') @@ -51,24 +43,27 @@ def handle_messages(**payload): data = payload['data'] channel_id = data['channel'] thread_ts = data['ts'] - reactions_needed = reactable_string(data['text']) - def react_to_message(reaction): - payload['web_client'].reactions_add( - channel=channel_id, - name=reaction, - timestamp=thread_ts - ) + pdb.set_trace() + if reactable_string(data['text']): + reactions_needed = reactable_string(data['text']) + + def react_to_message(reaction): + payload['web_client'].reactions_add( + channel=channel_id, + name=reaction, + timestamp=thread_ts + ) - if 'ai' in reactions_needed: - react_to_message("robot_face") - if 'furry' in reactions_needed: - react_to_message("eggplant") - react_to_message("sweat_drops") - if 'flavortown' in reactions_needed: - react_to_message("dark_sunglasses") - react_to_message("guyfieri") + if 'ai' in reactions_needed: + react_to_message("robot_face") + if 'furry' in reactions_needed: + react_to_message("eggplant") + react_to_message("sweat_drops") + if 'flavortown' in reactions_needed: + react_to_message("dark_sunglasses") + react_to_message("guyfieri") is_command = parse_direct_mention(data['text']) @@ -90,7 +85,7 @@ def handle_messages(**payload): webclient.chat_postMessage( channel=channel_id, text=response, - thread_ts=thread_ts + timestamp=thread_ts )