add tweet subcommand to twitter, to send tweets.
needs admin, until i figure out if i want more authentication for it
This commit is contained in:
parent
d9b85f4364
commit
0e7e2bf50c
@ -82,6 +82,19 @@ class Twitter(Module):
|
|||||||
return self.reply(connection, replypath, self.tweet_or_retweet_text(tweet=tweet))
|
return self.reply(connection, replypath, self.tweet_or_retweet_text(tweet=tweet))
|
||||||
except twitter.TwitterError as e:
|
except twitter.TwitterError as e:
|
||||||
return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))
|
return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))
|
||||||
|
elif whats[1] == 'tweet' and len(whats) >= 3:
|
||||||
|
if self.authed is False:
|
||||||
|
return self.reply(connection, replypath, 'You must be authenticated to tweet.')
|
||||||
|
if admin_unlocked is False:
|
||||||
|
return self.reply(connection, replypath, 'Only admins can tweet.')
|
||||||
|
|
||||||
|
try:
|
||||||
|
if self.twit.PostUpdates(' '.join(whats[2:]), continuation=u'\u2026') is not None:
|
||||||
|
return self.reply(connection, replypath, 'Tweet(s) sent.')
|
||||||
|
else:
|
||||||
|
return self.reply(connection, replypath, 'Unknown error sending tweet(s).')
|
||||||
|
except twitter.TwitterError as e:
|
||||||
|
return self.reply(connection, replypath, 'Couldn\'t tweet: ' + str(e))
|
||||||
elif whats[1] == 'gettoken':
|
elif whats[1] == 'gettoken':
|
||||||
# get request token
|
# get request token
|
||||||
resp, content = self.client.request(self.request_token_url, "GET")
|
resp, content = self.client.request(self.request_token_url, "GET")
|
||||||
|
Loading…
Reference in New Issue
Block a user