Fix idiotic error with threading

- if you thread, an event is generated that wraps the message event in
  a dict

- but only after the event already comes through.

- don't make threads and life gets so much fucking easier.
master
jowj 5 years ago
parent e11906fa48
commit 562926f33c

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

Loading…
Cancel
Save