There was an error while loading. Please reload this page.
1 parent 8b44005 commit 371373aCopy full SHA for 371373a
1 file changed
docs/example-bot.md
@@ -17,14 +17,18 @@ import requests
17
# BalatroBot API endpoint
18
URL = "http://127.0.0.1:12346"
19
20
+
21
def rpc(method: str, params: dict = {}) -> dict:
22
"""Send a JSON-RPC 2.0 request to the BalatroBot API."""
- response = requests.post(URL, json={
23
- "jsonrpc": "2.0",
24
- "method": method,
25
- "params": params,
26
- "id": 1,
27
- })
+ response = requests.post(
+ URL,
+ json={
+ "jsonrpc": "2.0",
+ "method": method,
28
+ "params": params,
29
+ "id": 1,
30
+ },
31
+ )
32
data = response.json()
33
# Raise if error, otherwise return result (contains game state)
34
if "error" in data:
0 commit comments