from instabot import Bot
import time

bot = Bot()
bot.login(username="your_username", password="your_password")
user_ids = bot.get_hashtag_users("#your_hashtag")
batch_size = 10
for i in range(0, len(user_ids), batch_size):
    batch = user_ids[i:i + batch_size]
    for user_id in batch:
        try:
            bot.send_message("Hello!", user_id)
            print(f"Message sent to user {user_id}")
            time.sleep(120)
        except Exception as e:
            print(f"Error sending message to user {user_id}: {e}")

Here's my full code and idk why the console is showing this error: INFO - Instabot version: 0.117.0 Started INFO - Not yet logged in starting: PRE-LOGIN FLOW! ERROR - Request returns 429 error! WARNING - That means 'too many requests'. I'll go to sleep for 5 minutes.

Please help me guys im just trying to make a auto dm bot.

I first tried using a bigger time limit and then I did it using batches but idk why it doesnt work

0

There are 0 best solutions below