-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.py
36 lines (29 loc) · 919 Bytes
/
process.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import tweepy
from ai import getFakeTweet
def processTweet(api, tweet, friend):
#Get info from tweet
friend_score = friend["score"]
if friend_score >= 1:
like(tweet)
retweet(tweet)
reply(api, tweet, getFakeTweet(friend))
def like(tweet):
if not tweet.favorited:
# Mark it as Liked, since we have not done it yet
try:
tweet.favorite()
except Exception as e:
print("Error on fav")
def retweet(tweet):
if not tweet.retweeted:
# Retweet, since we have not retweeted it yet
try:
tweet.retweet()
except Exception as e:
print("Error on fav and retweet")
def reply(api, tweet, message):
try:
m = "@" + tweet.user.screen_name + " " + message
t = api.update_status(status=m, in_reply_to_status_id=tweet.id)
except Exception as e:
print("Error on reply")