Skip to content

HSNBot ​

HSNBot is a QQ group bot based on NoneBot2 + OneBot V11, providing Phira multiplayer room queries, server monitoring, data statistics, and more.

Tech Stack ​

ComponentTechnology
FrameworkNoneBot2
Protocol AdapterOneBot V11
Command SystemAlconna
HTTP Clienthttpx / aiohttp
Image Renderingnonebot-plugin-htmlrender (Playwright / Chromium)
Data Source APIHSN backend monitoring service (http://23.141.172.246:7001)

Feature List ​

Server Status ​

CommandDescriptionFile
/cksvrCheck if the CK game server is onlineckmp.py
/mcstatusQuery Minecraft server status and render as imagemccheck.py
/users / 在线人数Get the current number of online players on the Phira serverusers.py

Room Management ​

CommandDescriptionFile
/roomQuery all current rooms (image)room.py
/room record <room_name>Query play records for the specified roomroom.py

The plugin listens to the backend in real-time via SSE, and automatically pushes image notifications to the configured QQ group when a new room is created.

Data Monitoring ​

CommandDescriptionFile
/hsndata healthCheck the health status of the monitoring APIhsndata.py
/hsndata history [start] [end]Get HSN historical online datahsndata.py
/hsndata chart <start> <end>Generate an online trend chart for a specified time periodhsndata.py
/hsndata chartsList all generated chartshsndata.py
/hsndata image <type>Get a chart image (hsn / room / user_bar / user_pie)hsndata.py
/hsndata roomrankRoom usage frequency rankinghsndata.py
/hsndata userrank [user_id]User playtime ranking or query a specific userhsndata.py
/hsndata leaderboard [count]Get the playtime leaderboardhsndata.py
/hsndata generateManually trigger chart generationhsndata.py
/hsnvs latestGet the latest server comparison data and trend charthsnvs.py
/hsnvs history <minutes>Get data from a specified number of minutes agohsnvs.py
/hsnvs statsGet statistics resultshsnvs.py
/hsnvs config show | updateView or update configurationhsnvs.py

Others ​

CommandDescriptionFile
/setu [keyword]Get images via Lolicon API, auto-recall after 10 secondssetu.py
骂人 / fuck / 吃大粪Fun repliesmaren.py
/restart [api]Restart the Phira server (group owner/admin only)restart.py

Configuration ​

Configure in .env or .env.prod:

env
# Phira Room Plugin
PHIRA_API_BASE=http://23.141.172.246:12345
PHIRA_CHART_API=https://phira.5wyxi.com
PHIRA_NOTIFY_GROUPS=[123456789, 987654321]
PHIRA_FONT_PATH=/path/to/font.ttf
PHIRA_BG_PATH=/path/to/background.jpg
PHIRA_LOGO_PATH=/path/to/logo.png
PHIRA_CACHE_TTL=600
PHIRA_SSE_RETRY=5
PHIRA_IMAGE_QUALITY=90

# CK Server Checker (modify directly in ckmp.py)
# USERNAME="your-email"
# PASSWORD="your-password"

# HSN Data Monitoring
HSN_API_BASE=http://23.141.172.246:7001

Deployment ​

bash
# Install dependencies
pip install nonebot2 nonebot-adapter-onebot nonebot-plugin-alconna nonebot-plugin-htmlrender
pip install httpx aiohttp mcstatus

# Configure .env
echo "DRIVER=~fastapi+~httpx" >> .env
echo "HOST=0.0.0.0" >> .env
echo "PORT=8080" >> .env

# Start
nb run

Last modified byFireflyF09on2026-06-26 15:41

Built with VitePress