Last active
March 3, 2017 16:09
-
-
Save ChipWolf/bc5fa396a6097df92e50c3f933d83dc0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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