Help executing actions in python

Good day. :wave:

I need sending actions with python code. The starter bot for JS and Python has no implementation for executing command. I manage to understand from the kotlin code that I can use the following in python:

connection.send("SendPlayerCommand", botCommand)

Although I need help getting the botCommand datatype in Python.
Any help would be much appreciated. :pray:

Thanks.

Hi @KodinGuy

What I managed to get to was that the datatype is a dictionary, with the Action and the Bot ID. Where Action is a number between 1 and 12 (I think) and your own bot’s ID.
Hope this helps.

thisdict = {
“Action”: action,
“BotId”: bot_id
}
connection.send(“SendPlayerCommand”,[thisdict])

1 Like

Okay, thank you so much it worked.

For anyone else the code is(as mentioned by @kr0 ):

command = {
    "BotId": player_id,
    "Action": action #Integer value from 1-12
}

connection.send("SendPlayerCommand", [command])

Shown here

1 Like

Hi @KodinGuy!

Yes, the python SignalR library expects the arguments as a list unlike some other languages. As a side note, the values given in your listeners (e.g ReceiveBotState) are also lists, so you’ll want to unwrap the values before using them :slight_smile: