Created
June 20, 2018 11:46
-
-
Save svdgraaf/52a92190c1ab9a48363e583fa7bb497d to your computer and use it in GitHub Desktop.
@plusplus karma automater
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
#!/usr/bin/env python | |
import os | |
import time | |
from slackclient import SlackClient | |
slack_token = os.environ["SLACK_API_TOKEN"] | |
sc = SlackClient(slack_token) | |
stuff = { | |
"<@U8Q1UCGPM>": 243, # This is the slack user id | |
"@whatever": 2, # Regular stuff also works | |
} | |
for what, karma in stuff.items(): | |
current = 0 | |
while current != karma: | |
print(" %s != %s" % (current, karma) ) | |
if karma > 0: | |
msg = "%s++ karmasync" % what | |
current += 1 | |
if karma < 0: | |
msg = "%s-- karmasync" % what | |
current -= 1 | |
print(msg) | |
# msg = "@platypus++" | |
sc.api_call( | |
"chat.postMessage", | |
as_user=True, | |
link_names=True, | |
username='svdgraaf', | |
parse='none', | |
channel="plusplus-sync", | |
text=msg | |
) | |
time.sleep(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment