-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainbot.py
44 lines (34 loc) · 1.38 KB
/
mainbot.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
37
38
39
40
41
42
43
44
import tweepy
import os # operating system library
from datetime import date
born=date(2000, 10, 11)
def calculateAge(birthDate):
today = date.today()
age = today.year - birthDate.year - ((today.month, today.day) < (birthDate.month, birthDate.day))
return age
old=calculateAge(born)
def create_api():
consumer_key = os.getenv('consumer_key')
consumer_secret = os.getenv('consumer_secret')
access_token = os.getenv('access_token')
access_token_secret = os.getenv('access_token_secret')
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth,wait_on_rate_limit=True,wait_on_rate_limit_notify=True)
api.verify_credentials()
print('API Created')
return api
# Complete code
import time
def age_count():
emoji_numbers = {0: "0️⃣", 1: "1️⃣", 2: "2️⃣", 3: "3️⃣",
4: "4️⃣", 5: "5️⃣", 6: "6️⃣", 7: "7️⃣", 8: "8️⃣", 9: "9️⃣"}
uf_split = [int(i) for i in str(old)]# Used to seperate
emoji_followers = ''.join([emoji_numbers[j] for j in uf_split if j in emoji_numbers.keys()])
return emoji_followers
api = create_api()
while True:
api.update_profile(name=f'Shubham Sharma|{age_count()}')
print(f'Updating Twitter Name : Shubham Sharma|{age_count()}')
print('Waiting to refresh')
time.sleep(60)