Skip to content

Instantly share code, notes, and snippets.

@wadey wadey/betagoal.py
Last active Aug 29, 2015

Embed
What would you like to do?
World Cup Slack Bot (with delay for no spoilers)
import time
import json
from twitter import TwitterStream, OAuth
import requests
import settings
twitter_stream = TwitterStream(
auth=OAuth(
settings.TOKEN,
settings.TOKEN_KEY,
settings.CON_SECRET,
settings.CON_SECRET_KEY))
iterator = twitter_stream.statuses.filter(follow='2567530321')
for tweet in iterator:
print tweet
if u'text' in tweet and tweet[u'user'][u'id_str'] == '2567530321':
text = tweet[u'text']
time.sleep(120)
payload = {
'text': text,
'icon_emoji': ':soccer:',
'username': 'betagoal',
}
requests.post(settings.SLACK_URL, json.dumps(payload))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.