Skip to content

Instantly share code, notes, and snippets.

@ChipWolf
Last active March 3, 2017 16:09
Show Gist options
  • Save ChipWolf/bc5fa396a6097df92e50c3f933d83dc0 to your computer and use it in GitHub Desktop.
Save ChipWolf/bc5fa396a6097df92e50c3f933d83dc0 to your computer and use it in GitHub Desktop.
from slackclient import SlackClient
import time
sc = SlackClient('<slack token>')
ts = time.time()
charlie = 'U2JV6D05A'
if sc.rtm_connect():
while True:
output_list = sc.rtm_read()
if output_list and len(output_list) > 0:
for output in output_list:
if output and 'user' in output and 'ts' in output:
print output['user']
if output['user'] == charlie:
sc.api_call(
"reactions.add",
channel=output['channel'],
name='unicorn_face',
timestamp=output['ts']
)
time.sleep(1)
else:
print "Connection Failed, invalid token?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment