- Put slacktive.py somewhere on your system, then change the path in slacktive.plist
- Put com.sean.python.slacktive.plist in ~/Library/LaunchAgents/
- Add your token to com.sean.python.slacktive.plist (see file comments)
launchctl load ~/Library/LaunchAgents/com.sean.python.slactive.plist
Last active
January 11, 2017 16:54
-
-
Save Seanmatthews/f4576232e9944c20d7d099cd34c65d5a to your computer and use it in GitHub Desktop.
Slack user keepalive
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.sean.python.slacktive</string> | |
<key>Program</key> | |
<string>/Users/sean/src/slacktive/slacktive.py</string> | |
<key>KeepAlive</key> | |
<true/> | |
<key>RunAtLoad</key> | |
<true/> | |
</dict> | |
</plist> |
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
import os | |
import time | |
from requests import post | |
while True: | |
# Replace x's with your user token. | |
# Token available from https://api.slack.com/docs/oauth-test-tokens | |
r = post("https://slack.com/api/users.setActive", data = {'token': 'xxxxxxxxxxxxxxxxx'}) | |
if r.status_code is not 200: | |
break | |
time.sleep(25*60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment