kik-bot-api-unofficial icon indicating copy to clipboard operation
kik-bot-api-unofficial copied to clipboard

Is it possible to create several bots?

Open prokopevaleksey opened this issue 6 years ago • 3 comments

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.

prokopevaleksey avatar Dec 04 '18 08:12 prokopevaleksey

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 :)

dexterdj avatar Dec 04 '18 09:12 dexterdj

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

Jaapp- avatar Dec 13 '18 14:12 Jaapp-

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 ;)

dexterdj avatar Dec 13 '18 15:12 dexterdj