-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
48 lines (45 loc) · 1.63 KB
/
bot.py
File metadata and controls
48 lines (45 loc) · 1.63 KB
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
45
46
47
48
import tweepy
import time
import random
from time import sleep
import math
from credentials import *
try:
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
z = 1000
def pooltings():
for tweet in tweepy.Cursor(api.search, q=('#ikokazi OR #ikokazike OR #ikokaziug'), count=100,
result_type="recent").items(z):
try:
print('\nTweet by: @' + tweet.user.screen_name)
tweet.retweet()
print('Retweeted the tweet')
r = random.randint(120,720)
s = r/60
w = round(s,1)
if w == 10:
while True:
tweet.favorite()
print('Favorited & tweeted ' + tweet.user.screen_name + ' s tweet')
for follower in tweepy.Cursor(api.followers).items(3):
follower.follow()
print('You followed: @' + follower.screen_name)
a = 1
if(a == 1):
break
else:
print('Sleeping for '+ str(w) + ' minute/s')
sleep(r)
except tweepy.TweepError as e:
print(e.reason)
print("Session ended")
u = random.randint(0,5)
print('Restarting in ' + str(u) + ' seconds')
sleep(u)
continue
# break
pooltings()
except time.time() as x:
print('Amsha bot' + str(x))