diff options
Diffstat (limited to 'modules/twitter')
-rwxr-xr-x | modules/twitter | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/twitter b/modules/twitter index e8962657..49d092fb 100755 --- a/modules/twitter +++ b/modules/twitter @@ -22,6 +22,7 @@ def shorten(text): text = text.replace(" years", "y") text = text.replace(" year", "y") text = text.replace(" ago", "") + text = text.replace("a", "1") return text @@ -33,7 +34,7 @@ def parse(text): escape = "" if piece.startswith("@"): escape = "[33;4m" - if piece[1:].lower() == "shackspace": + if piece[1:].lower() == "shackspam" or piece[1:].lower() == "shackspace": escape = "[31;4m" elif piece.startswith("#"): @@ -48,16 +49,16 @@ def parse(text): return new if len(sys.argv) > 1 and sys.argv[1] == "--help": - print "read or post to the shackspace twitter timeline" + print "read or post to the shackspam twitter timeline" if len(sys.argv) == 3 and sys.argv[2] == "--verbose": print "call without parameters to read" - print "use /twitter [your tweet] to tweet something to the shackspace twitter timeline" + print "use /twitter [your tweet] to tweet something to the shackspam twitter timeline" exit() -api = twitter.Api(username="shackspace", password="0b0dallaf4lla") +api = twitter.Api(username="shackspam", password="sh4ckit") #api.SetXTwitterHeaders("Shackspace UTTERANCE","","0.00.0.01.42") @@ -93,7 +94,8 @@ else: a.reverse() for i in a: text = i.text - if i.user.screen_name.lower() == "shackspace": + ilen = len(i.user.screen_name) + len(shorten(i.GetRelativeCreatedAt())) + 2 + if i.user.screen_name.lower() == "shackspace" or i.user.screen_name.lower() == "shackspam": info = "[32;4m" + i.user.screen_name + "[m [34m" + shorten(i.GetRelativeCreatedAt()) + "[m" else: info = "[32m" + i.user.screen_name + "[m [34m" + shorten(i.GetRelativeCreatedAt()) + "[m" @@ -102,12 +104,12 @@ else: t = text.split(" ") tmp = "" for n in t: - if ((len(tmp) + len(n)) > 80): + if ((len(tmp) + len(n)) >= 80): print parse(tmp).encode("utf8") - tmp = " " *( len(info)-15) + tmp = " " * ilen tmp += " " + n - if len(tmp) > (len(info)-15+1): + if len(tmp) > ilen: print parse(tmp).encode("utf8") |