Add command line switches to tweet.py for passing tweet text and a tweet ID to reply to
This commit is contained in:
parent
473a0d54c0
commit
e0fe42a35d
13
tweet.py
13
tweet.py
|
@ -1,11 +1,18 @@
|
|||
#!/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()
|
||||
|
|
Loading…
Reference in New Issue