Commit e0fe42a3 authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Add command line switches to tweet.py for passing tweet text and a tweet ID to reply to

parent 473a0d54
#!/usr/bin/env python3
import twitools
import argparse, twitools
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Send a tweet from the status monitor\'s account.')
parser.add_argument('-r', '--reply', default=None, metavar='ID', type=int, help='reply to tweet ID')
parser.add_argument('-t', '--text', default=None, type=str, help='tweet provided string')
args = parser.parse_args()
two = twitools.twObject()
try:
text = input("> ")
if not args.text:
text = input("> ")
else:
text = args.text
except KeyboardInterrupt:
exit(0)
two.tweet(text)
two.tweet(text, args.reply)
......@@ -30,8 +30,8 @@ class twObject:
tweets.reverse()
return tweets
def tweet(self, text):
self.api.update_status(text)
def tweet(self, text, replyto = None):
self.api.update_status(text, replyto)
def whoami(self):
return self.auth.get_username()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment