make bot less active

This commit is contained in:
horhik 2021-09-01 07:14:05 +03:00
parent ab10c48576
commit 358a442455
1 changed files with 8 additions and 6 deletions

View File

@ -15,6 +15,9 @@ fetched_user = sys.argv[1]
mastodon_instance = sys.argv[2] mastodon_instance = sys.argv[2]
mastodon_token = sys.argv[3] mastodon_token = sys.argv[3]
post_limit = 7
time_interval_sec = 1000
print(Fore.GREEN + '🚀 > Connecting to Instagram...') print(Fore.GREEN + '🚀 > Connecting to Instagram...')
print(Style.RESET_ALL) print(Style.RESET_ALL)
@ -30,7 +33,7 @@ mastodon = Mastodon(
) )
def get_image(url): def get_image(url):
try: try:
print(Fore.YELLOW + "🚀 > Downloading Image...", url) print(Fore.YELLOW + "🚀 > Downloading Image...", url)
print(Style.RESET_ALL) print(Style.RESET_ALL)
@ -118,19 +121,18 @@ posts = profile.get_posts()
def get_new_posts(): def get_new_posts():
stupidcounter = 0 stupidcounter = 0
for post in posts: for post in posts:
if stupidcounter < 100: stupidcounter += 1
if stupidcounter < post_limit:
if already_posted(str(post.url)): if already_posted(str(post.url)):
print(Fore.YELLOW + "🐘 > Already Posted", stupidcounter, " of ", posts.count) print(Fore.YELLOW + "🐘 > Already Posted", stupidcounter, " of ", posts.count)
print(Style.RESET_ALL) print(Style.RESET_ALL)
stupidcounter += 1
continue continue
stupidcounter += 1
toot(post.url, post.caption) toot(post.url, post.caption)
mark_as_posted(str(post.url)) mark_as_posted(str(post.url))
else: else:
break return
while True: while True:
get_new_posts() get_new_posts()
time.sleep(600) time.sleep(time_interval_sec)