Update twitter.py
This commit is contained in:
parent
4b7c8ffa75
commit
e46cb5c826
1 changed files with 5 additions and 1 deletions
|
@ -28,8 +28,10 @@ def get_api(bot):
|
||||||
|
|
||||||
@hook.regex(*TWITTER_RE)
|
@hook.regex(*TWITTER_RE)
|
||||||
def twitter_url(match, bot=None):
|
def twitter_url(match, bot=None):
|
||||||
|
# Find the tweet ID from the URL
|
||||||
tweet_id = match.group(1)
|
tweet_id = match.group(1)
|
||||||
|
|
||||||
|
# Get the tweet using the tweepy API
|
||||||
api = get_api(bot)
|
api = get_api(bot)
|
||||||
if not api:
|
if not api:
|
||||||
return
|
return
|
||||||
|
@ -39,6 +41,7 @@ def twitter_url(match, bot=None):
|
||||||
except tweepy.error.TweepError:
|
except tweepy.error.TweepError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Format the return the text of the tweet
|
||||||
text = " ".join(tweet.text.split())
|
text = " ".join(tweet.text.split())
|
||||||
|
|
||||||
if user.verified:
|
if user.verified:
|
||||||
|
@ -122,8 +125,9 @@ def twitter(inp, bot=None):
|
||||||
user = tweet.user
|
user = tweet.user
|
||||||
else:
|
else:
|
||||||
# ???
|
# ???
|
||||||
return "Unknown Error"
|
return "Invalid Input"
|
||||||
|
|
||||||
|
# Format the return the text of the tweet
|
||||||
text = " ".join(tweet.text.split())
|
text = " ".join(tweet.text.split())
|
||||||
|
|
||||||
if user.verified:
|
if user.verified:
|
||||||
|
|
Reference in a new issue