@@ -25,7 +25,7 @@ function API.update(_)
2525 API .socket :settimeout (SOCKET_TIMEOUT )
2626 local port = BALATRO_BOT_CONFIG .port
2727 API .socket :setsockname (" 127.0.0.1" , tonumber (port ) or 12346 )
28- sendDebugMessage (" UDP socket created on port " .. port , " BALATROBOT " )
28+ sendDebugMessage (" UDP socket created on port " .. port , " API " )
2929 end
3030
3131 -- Process pending requests
@@ -56,16 +56,16 @@ function API.update(_)
5656 local func = API .functions [data .name ]
5757 local args = data .arguments
5858 if func == nil then
59- API .send_error_response (" Unknown function name" , { function_name = data .name })
59+ API .send_error_response (" Unknown function name" , { name = data .name })
6060 elseif type (args ) ~= " table" then
6161 API .send_error_response (" Arguments must be a table" , { received_type = type (args ) })
6262 else
63- sendDebugMessage (data .name .. " (" .. json .encode (args ) .. " )" , " BALATROBOT " )
63+ sendDebugMessage (data .name .. " (" .. json .encode (args ) .. " )" , " API " )
6464 func (args )
6565 end
6666 end
6767 elseif client_ip ~= " timeout" then
68- sendErrorMessage (" UDP error: " .. tostring (client_ip ), " BALATROBOT " )
68+ sendErrorMessage (" UDP error: " .. tostring (client_ip ), " API " )
6969 end
7070end
7171
8181--- @param message string The error message
8282--- @param context ? table Optional additional context about the error
8383function API .send_error_response (message , context )
84- sendErrorMessage (message , " BALATROBOT " )
84+ sendErrorMessage (message , " API " )
8585 local response = { error = message , state = G .STATE }
8686 if context then
8787 response .context = context
@@ -106,7 +106,7 @@ function API.init()
106106 G .FPS_CAP = 60
107107 end
108108
109- sendInfoMessage (" BalatrobotAPI initialized" , " BALATROBOT " )
109+ sendInfoMessage (" BalatrobotAPI initialized" , " API " )
110110end
111111
112112---- ----------------------------------------------------------------------------
125125--- @param _ table Arguments (not used )
126126API .functions [" go_to_menu" ] = function (_ )
127127 if G .STATE == G .STATES .MENU and G .MAIN_MENU_UI then
128- sendDebugMessage (" go_to_menu called but already in menu" , " BALATROBOT " )
128+ sendDebugMessage (" go_to_menu called but already in menu" , " API " )
129129 local game_state = utils .get_game_state ()
130130 API .send_response (game_state )
131131 return
@@ -155,7 +155,7 @@ API.functions["start_run"] = function(args)
155155 local deck_found = false
156156 for _ , v in pairs (G .P_CENTER_POOLS .Back ) do
157157 if v .name == args .deck then
158- sendDebugMessage (" Changing to deck: " .. v .name , " BALATROBOT " )
158+ sendDebugMessage (" Changing to deck: " .. v .name , " API " )
159159 G .GAME .selected_back :change_to (v )
160160 G .GAME .viewed_back :change_to (v )
161161 deck_found = true
0 commit comments