Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to create several bots? #90

Open
prokopevaleksey opened this issue Dec 4, 2018 · 3 comments
Open

Is it possible to create several bots? #90

prokopevaleksey opened this issue Dec 4, 2018 · 3 comments

Comments

@prokopevaleksey
Copy link

I am trying to do roughly the following:

bot0 = Bot(username=username0,password = password0)
bot1 = Bot(username=username1,password = password1)

bot0.client.send_chat_message(recipient, message)
bot1.client.send_chat_message(recipient, message)

However, connection management seems to be not very happy with that.

@dexterdj
Copy link

dexterdj commented Dec 4, 2018

I use this technique to connect multiple bots:

python Bot.py 1& => Launch the bot to connect account ID 1
python Bot.py 2& => Launch the bot to connect account ID 2
.....
A launcher program have to launch bots :)

@Jaapp-
Copy link
Contributor

Jaapp- commented Dec 13, 2018

I use something like this for Rage Bot:

for account in accounts:
    Thread(target=bot_thread, args=([account]), name=account.username).start()
    time.sleep(0.1)


def bot_thread(account):
    asyncio.set_event_loop(asyncio.new_event_loop())
    RageBot(account.username, account.password)

A couple of things to keep in mind:

  • device_id and android_id need to be unique per bot, you can use the override arguments for login etc
  • device_id and android_id need to be the same each time you log in for a specific bot, so you need to store that somewhere

@dexterdj
Copy link

Cool,
Was having errors trying to start many bot threads from the same main thread.
"asyncio main loop error".

It's why my program use only 1 account, and a launcher is dedicated to start X programs with the "&" directive.

I'll try your method with asyncio.set_event_loop(asyncio.new_event_loop())

Thanks for this ;)

@Sitiaro Sitiaro mentioned this issue Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants