def main(): # Initalize Pi GPIO out.initialize() # Create a new twitter interface thandler = twitterclock.tclock() # Fake twitter for testing #thandler = twitterclock.fakeclock() while 1: #if monitor.tweet_changed(): parse_command(thandler) # Twitter api rate limit is 100 / hr sleep(30) return
def tweethelp(thandle, command, options): thandle = twitterclock.tclock() user = thandle.get_mentions_user() if options == 'help': text = "tweet 'help: subject' where subject = {say,clock,life}" elif options == 'say': text = "say: string || prints out 'string' to the display" elif options == 'clock': text = "clock: options || enables clock-mode where options = {analog,digital}" elif options == 'life': text = "life: selfstr goodstr negastr threshold numberon waittime || all optional" else: text = "I don't understand you. Tweet 'help: help' for a list of commands." tweet = '@%s %s' % (user,text) # Check that we didn't just post this message - we don't want to spam lastpost = thandle.get_last_post() if not tweet == lastpost: thandle.post_text(tweet) return