-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbot.py
More file actions
36 lines (28 loc) · 999 Bytes
/
Copy pathbot.py
File metadata and controls
36 lines (28 loc) · 999 Bytes
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
API_KEY = ''
API_SECRET_KEY = ''
ACCESS_TOKEN = ''
ACCESS_SECRET_TOKEN = ''
auth = tweepy.OAuthHandler(API_KEY, API_SECRET_KEY0)
auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET_TOKEN)
api = tweepy.API(auth)
FILE = "id.text"
def retrieve_id(file):
f_read = open(file, 'r')
last_seen_id = int(f_read.read().strip())
f_read.close()
return last_seen_id
def store_id(id, file):
f_write = open(file, "w")
f_write.write(str(id))
f_write.close()
return
last_seen_id = retrieve_id(FILE)
mentions = api.mentions_timeline(last_seen_id, tweet_mode = "extended")
for mentions in api.mentions_timeline(mentions):
if "solidity":"ETHDEV","Reactjs" in mentio.full_text:
store_id(last_seen_id, FILE)
api.update_status('@'+mention.user.screen_name + 'The future is here, learning is important', mentions)
print('replied to @' + mention.user.screen_name)
for mention in mentions:
print(mention.id)