Create a gist now

Instantly share code, notes, and snippets.

this script lets twitter tell u that ur a piece of shit in real time
from __future__ import unicode_literals
from twython import TwythonStreamer, TwythonError
import time
import pyttsx
# too lazy to ask twr for handle. u put ur handle here
MY_HANDLE = 'thricedotted'
# im shitty so i put my credentials in a plain file lol
with open('./.twittertest') as f: exec(f.read())
# if ur not shitty, put ur credentials here
#api_key = ''
#api_secret = ''
#access_token = ''
#access_token_secret = ''
# tts engine shit whatever
engine = pyttsx.init()
engine.setProperty('voice', 'english-us')
engine.setProperty('rate', 100)
engine.startLoop(False)
# ugh
def exclude_word(word):
return any(x in word for x in ('@', 'http'))
class ShitStreamer(TwythonStreamer):
def on_success(self, data):
if 'text' in data:
# skip retweets
if data['text'].startswith('RT'):
return
# skip own tweets/DMs
if data['user']['screen_name'] == MY_HANDLE:
return
elif '@' + MY_HANDLE in data['text'].lower():
#print("Mention received")
#print(utterance)
utterance = ' '.join(w for w in data['text'].split() if not exclude_word(w)) + ", you piece of shit."
engine.say(utterance)
engine.iterate()
def on_error(self, status_code, data):
print(status_code)
shitstream = ShitStreamer(api_key, api_secret, access_token, access_token_secret)
shitstream.user()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment