How to execute commands using another program, in web Emscripten version? `stdin`?

I know this should be possible to utilize stdin on a dedicated server, but can I do this with the web version?

So far I only come up with a workaround of bind K my_command, and then window.dispatchEvent(new KeyboardEvent('keydown', { code: KeyK })), which is not super nice.

What I want this for is to detect when a player connects to the game, and then kicking all the bots and map_restart.
I need it for this project: GitHub - WofWca/quake3.xdc: A webxdc (in-chat mini-app) version of Quake III Arena.

Regarding the task at hand: I somewhat solved it by adding set bot_minplayers 2 to autoexec.cfg.

But it would still be nice to know the answer to the question.