From 09dc57b9d5f564d13f80707eefadd845a4aa9aec Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 20 Dec 2012 11:18:43 +0700 Subject: //god/twinter - cleanup --- god/twinter/init_stripped.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'god/twinter') diff --git a/god/twinter/init_stripped.py b/god/twinter/init_stripped.py index 4d359171..79550158 100644 --- a/god/twinter/init_stripped.py +++ b/god/twinter/init_stripped.py @@ -14,17 +14,16 @@ auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) mention = api.mentions()[0] -mention_stripped = mention.text.replace("@shacktwinter","").lstrip().rstrip() -mention_stripped = re.sub(r'[^\w _|@\[\]{}()<>:;!#$%^&+=-]+','',mention_stripped)[:32] +mention_stripped =re.sub(r'[^\w _|@\[\]{}()<>:;!#$%^&+=-]+','', + mention.text.replace("@shacktwinter","").lstrip().rstrip())[:32] f = open(os.path.dirname(os.path.abspath(sys.argv[0]))+"/msg_file","r+") last = f.read() -#sys.exit(23) + if last == mention_stripped: print "received old message" sys.exit(23) else: print "received new message: %s" % mention_stripped - s = socket(AF_INET, SOCK_STREAM) send_message = \ '\x1b%%-12345X@PJL JOB\n@PJL RDYMSG DISPLAY="%s"\n@PJL EOJ\n\x1b%%-12345X' % (mention_stripped, ) @@ -37,4 +36,5 @@ else: f.close() if not mention.user.following: mention.user.follow() - api.update_status("@%s i appreciate your message '%s' for twinter! Ready Message updated." %(mention.user.screen_name,mention_stripped.upper()),in_reply_to_status_id=mention.id) + api.update_status("@%s i appreciate your message '%s' for twinter! Ready Message updated." % + (mention.user.screen_name,mention_stripped.upper()),in_reply_to_status_id=mention.id) -- cgit v1.2.3