This tool simulates a NapCat / aiocqhttp reverse WebSocket client that connects to AstrBot, sends OneBot v11 group message and notice payloads, and responds to OneBot action requests from AstrBot.
It is a development load-test tool. It is not part of either plugin runtime and should not be bundled into plugin release packages.
python -m pip install -r requirements.txtReplace the URL with the OneBot WebSocket server URL exposed by AstrBot.
python fake_onebot_ws_client.py `
--url ws://127.0.0.1:6199/ws `
--rate 10 `
--duration 120 `
--groups 3 `
--users 50 `
--bad-ratio 0.03 `
--notice-ratio 0.01If AstrBot requires a token:
python fake_onebot_ws_client.py `
--url ws://127.0.0.1:6199/ws `
--token YOUR_TOKENBaseline:
python fake_onebot_ws_client.py --url ws://127.0.0.1:6199/ws --rate 10 --duration 120Short peak:
python fake_onebot_ws_client.py --url ws://127.0.0.1:6199/ws --rate 100 --duration 60Burst:
python fake_onebot_ws_client.py --url ws://127.0.0.1:6199/ws --burst 1000 --rate 0 --duration 5Slow and failed actions:
python fake_onebot_ws_client.py `
--url ws://127.0.0.1:6199/ws `
--rate 50 `
--duration 60 `
--slow-action-ratio 0.05 `
--fail-action-ratio 0.02 `
--action-timeout-ratio 0.01During a run, inspect the plugin metrics from AstrBot:
.cf metrics
/glog metrics
Watch for action timeouts, failed dispatches, SQLite delays, and whether event counts match the sent payload volume.
The fake client responds to these action names:
get_login_infosend_group_msgsend_group_forward_msgdelete_msgset_group_banupload_group_fileget_group_infoget_group_info_exget_group_member_listset_group_nameset_group_portrait
Unknown actions return a failed OneBot-style response with retcode=1404.