|
|
@ -87,7 +87,7 @@ class PublicRelations(Bureau):
|
|
|
|
return shortcode
|
|
|
|
return shortcode
|
|
|
|
|
|
|
|
|
|
|
|
@add_command("tweetpic", "Post a Document Camera Image to Twitter")
|
|
|
|
@add_command("tweetpic", "Post a Document Camera Image to Twitter")
|
|
|
|
def tweet_pic(self):
|
|
|
|
def tweet_pic(self, reply_to_id=None, at_user=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Takes a photograph using the document camera and posts it to Twitter.
|
|
|
|
Takes a photograph using the document camera and posts it to Twitter.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -96,8 +96,17 @@ class PublicRelations(Bureau):
|
|
|
|
with open(photo, "rb") as imagefile:
|
|
|
|
with open(photo, "rb") as imagefile:
|
|
|
|
imagedata = imagefile.read()
|
|
|
|
imagedata = imagefile.read()
|
|
|
|
t_up = twitter.Twitter(domain='upload.twitter.com', auth=self.auth)
|
|
|
|
t_up = twitter.Twitter(domain='upload.twitter.com', auth=self.auth)
|
|
|
|
|
|
|
|
|
|
|
|
id_img1 = t_up.media.upload(media=imagedata)["media_id_string"]
|
|
|
|
id_img1 = t_up.media.upload(media=imagedata)["media_id_string"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if reply_to_id:
|
|
|
|
|
|
|
|
if at_user:
|
|
|
|
|
|
|
|
status = "@" + at_user
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
status = " "
|
|
|
|
|
|
|
|
self.t.t.statuses.update(status=status,
|
|
|
|
|
|
|
|
in_reply_to_status_id=reply_to_id,
|
|
|
|
|
|
|
|
media_ids=id_img1)
|
|
|
|
|
|
|
|
else:
|
|
|
|
self.t.t.statuses.update(status="#screenless", media_ids=id_img1)
|
|
|
|
self.t.t.statuses.update(status="#screenless", media_ids=id_img1)
|
|
|
|
|
|
|
|
|
|
|
|
@add_command("fbpost", "Post to Facebook")
|
|
|
|
@add_command("fbpost", "Post to Facebook")
|
|
|
@ -203,6 +212,8 @@ class PublicRelations(Bureau):
|
|
|
|
prn.text("like\r\n")
|
|
|
|
prn.text("like\r\n")
|
|
|
|
prn.barcode("PRtwlk." + tw_shortcode, "CODE128", function_type="B")
|
|
|
|
prn.barcode("PRtwlk." + tw_shortcode, "CODE128", function_type="B")
|
|
|
|
prn.text("\r\n\r\n")
|
|
|
|
prn.text("\r\n\r\n")
|
|
|
|
|
|
|
|
prn.barcode("PRtwre." + tw_shortcode, "CODE128", function_type="B")
|
|
|
|
|
|
|
|
prn.text("\r\n\r\n")
|
|
|
|
|
|
|
|
|
|
|
|
prn.cut()
|
|
|
|
prn.cut()
|
|
|
|
|
|
|
|
|
|
|
@ -222,9 +233,9 @@ class PublicRelations(Bureau):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
shortcode, _ = data.split(".")
|
|
|
|
shortcode, _ = data.split(".")
|
|
|
|
tweet_id = self.get_tweet_id(shortcode)
|
|
|
|
tweet_id = self.get_tweet_id(shortcode)
|
|
|
|
# TODO: do the actual reply
|
|
|
|
tweet = self.t.t.statuses.show(id=tweet_id)
|
|
|
|
# maybe this should be an optional arg for tweet_pic?
|
|
|
|
at_user = tweet["user"]["screen_name"]
|
|
|
|
return
|
|
|
|
self.tweet_pic(tweet_id=tweet_id, at_user=at_user)
|
|
|
|
|
|
|
|
|
|
|
|
@add_command("twlk", "Like a Tweet")
|
|
|
|
@add_command("twlk", "Like a Tweet")
|
|
|
|
def tw_like(self, data):
|
|
|
|
def tw_like(self, data):
|
|
|
|