nonebot-plugin-l4d2-server 1.1.6__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/PKG-INFO +29 -14
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/README.md +25 -12
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/nonebot_plugin_l4d2_server/__init__.py +6 -5
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/__main__.py +368 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/api/__init__.py +5 -0
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/nonebot_plugin_l4d2_server/config.py +10 -7
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/Help.json +78 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/__init__.py +4 -4
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/draw.py +23 -10
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/domain/L4D2/l4d2/l4d2.json +1 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/domain/L4D2/l4d2.json +1 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/l4_ban/__init__.py +5 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/l4_ban/utils.py +5 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/l4_help/__init__.py +8 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/l4_image/__init__.py +5 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/l4_local/__init__.py +5 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/l4_request/__init__.py +5 -0
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/nonebot_plugin_l4d2_server/message.py +1 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/commands/__init__.py +1 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/__init__.py +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/convert.py +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/html_img.py +33 -12
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/image_tools.py +44 -12
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/anne/anne.html +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/anne/group_ip.html +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/anne/ip.html +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/github.svg +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/l.svg +5 -5
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/m.svg +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/normal.html +2 -3
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/normal_old.html +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/style.css +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/vue.css +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/w.svg +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/workshop.html +8 -8
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/ban/__init__.py +174 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/ban/utils.py +11 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_local → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/local}/__init__.py +20 -21
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_local → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/local}/download.py +1 -2
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_local → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/local}/file.py +1 -2
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_local → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/local}/utils.py +2 -2
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_request → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/query}/__init__.py +17 -13
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_request → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/query}/draw_msg.py +129 -96
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_request → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/query}/tj.py +10 -7
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_request → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/query}/typing.py +1 -1
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_request → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/server/query}/utils.py +26 -14
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared}/utils/api/request.py +43 -32
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared}/utils/api/utils.py +3 -1
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared/utils/database/models.py +32 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared/utils/group_store.py +93 -0
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared/utils/sb_sources.py +57 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared}/utils/utils.py +2 -2
- nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/utils/__init__.py +5 -0
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/pyproject.toml +4 -2
- nonebot_plugin_l4d2_server-1.3.1/tests/__init__.py +0 -0
- nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/__main__.py +0 -324
- nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/utils/database/models.py +0 -18
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/LICENSE +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//344/273/213/347/273/215.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//344/273/273/345/212/241.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//344/277/241/346/201/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/205/254/345/221/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/210/200/345/211/221.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/210/207/346/215/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/210/240/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/210/267/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/215/241/347/273/204.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/223/252/351/207/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/234/260/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/257/274/345/205/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/257/274/345/207/272.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//345/275/261.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/213/274/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/216/242/347/264/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/216/250/351/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/224/266/351/233/206.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/224/273/347/225/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/233/264/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/235/220/346/226/231.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/237/245/350/257/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/240/241/351/252/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/257/217/346/234/210.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/267/261/346/270/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/267/273/345/212/240.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//346/270/205/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//347/212/266/346/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//347/255/276/345/210/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//347/273/221/345/256/232.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//350/241/250.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//350/241/250/346/203/205.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//350/247/222/350/211/262.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//350/256/260/345/275/225.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//351/205/215/347/275/256.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/icon//351/207/215/345/220/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/texture2d/badge.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/texture2d/banner.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/texture2d/bg.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/texture2d/button.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_help → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/core/help}/texture2d/icon.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/data → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/domain}/font/loli.ttf +0 -0
- /nonebot_plugin_l4d2_server-1.1.6/tests/__init__.py → /nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/commands/server_groups.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/anne/back.png +0 -0
- /nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image/img/back_img/background.jpg → /nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render/img/back_img/background .jpg +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/head/head.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/header/logo.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/header/player1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/vac.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/img/template/vac_white.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server/l4_image → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/presentation/render}/model.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared}/utils/api/api.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.6/nonebot_plugin_l4d2_server → nonebot_plugin_l4d2_server-1.3.1/nonebot_plugin_l4d2_server/shared}/utils/api/models.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/tests/conftest.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/tests/help.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.6 → nonebot_plugin_l4d2_server-1.3.1}/tests/todo.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nonebot-plugin-l4d2-server
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: L4D2 server related operations plugin for NoneBot2
|
|
5
5
|
Keywords: steam,game,l4d2,nonebot2,plugin
|
|
6
6
|
Author-Email: Agnes_Digital <Z735803792@163.com>
|
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Project-URL: homepage, https://github.com/Agnes4m/nonebot_plugin_l4d2_server
|
|
17
|
-
Requires-Python: <4.0,>=3.
|
|
17
|
+
Requires-Python: <4.0,>=3.10
|
|
18
18
|
Requires-Dist: nonebot2>=2.1.0
|
|
19
19
|
Requires-Dist: nonebot2[fastapi]>=2.3.3
|
|
20
20
|
Requires-Dist: nonebot-plugin-htmlrender>=0.3.0
|
|
@@ -34,6 +34,8 @@ Requires-Dist: rarfile>=4.2
|
|
|
34
34
|
Requires-Dist: pyunpack>=0.3
|
|
35
35
|
Requires-Dist: aiofiles>=24.1.0
|
|
36
36
|
Requires-Dist: bs4==0.0.2
|
|
37
|
+
Requires-Dist: lxml>=6.0.2
|
|
38
|
+
Requires-Dist: playwright==1.57.0
|
|
37
39
|
Description-Content-Type: text/markdown
|
|
38
40
|
|
|
39
41
|
<!-- markdownlint-disable MD026 MD031 MD033 MD036 MD041 MD046 MD051 -->
|
|
@@ -45,7 +47,7 @@ Description-Content-Type: text/markdown
|
|
|
45
47
|
|
|
46
48
|
<div align="center">
|
|
47
49
|
|
|
48
|
-
# nonebot_plugin_l4d2_server 1.
|
|
50
|
+
# nonebot_plugin_l4d2_server 1.3.0
|
|
49
51
|
|
|
50
52
|
_✨Nonebot & Left 4 Dead 2 server 操作 ✨_
|
|
51
53
|
|
|
@@ -86,14 +88,34 @@ _✨Nonebot & Left 4 Dead 2 server 操作 ✨_
|
|
|
86
88
|
</a>
|
|
87
89
|
</div>
|
|
88
90
|
|
|
89
|
-
##
|
|
91
|
+
## 功能
|
|
90
92
|
|
|
91
|
-
- 在 json 文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云 1 输出 1 号服务器
|
|
92
93
|
- `l4d2帮助` 帮助指令
|
|
94
|
+
|
|
95
|
+
### 自定义服务器
|
|
96
|
+
|
|
97
|
+
- 在 json 文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云 1 输出 1 号服务器
|
|
98
|
+
|
|
99
|
+
### SourceBans++
|
|
100
|
+
|
|
101
|
+
- 通过 [SourceBans++](https://sbpp.github.io/) 获取服务器的 ban 信息,自动导入ip
|
|
102
|
+
|
|
103
|
+
### 配置管理
|
|
104
|
+
|
|
93
105
|
- l4 图片开启/关闭 超管指令 可以修改输出单图是否为图片输出
|
|
94
106
|
- l4 查找用户 在已知服务器中查找
|
|
95
107
|
- l4 工坊下载 提供创意工坊 id 下载到服务器和群聊
|
|
96
108
|
|
|
109
|
+
### 自定义查服背景图片
|
|
110
|
+
|
|
111
|
+
插件支持自定义图片背景,在 `data/L4D2/custom_backgrounds/` 目录下放入 PNG/JPG/JPEG 格式图片即可,插件会自动随机选择使用。
|
|
112
|
+
|
|
113
|
+
具体位置参考 [数据结构](./docs/standand.md)
|
|
114
|
+
|
|
115
|
+
- 目录不存在时插件会自动创建
|
|
116
|
+
- 放入图片无需重启立即生效
|
|
117
|
+
- 未放置图片时默认使用纯白色背景
|
|
118
|
+
|
|
97
119
|
## 安装
|
|
98
120
|
|
|
99
121
|
以下提到的方法 任选**其一** 即可
|
|
@@ -155,8 +177,6 @@ conda install nonebot-plugin-l4d2-server
|
|
|
155
177
|
|
|
156
178
|
## [数据结构](./docs/standand.md)
|
|
157
179
|
|
|
158
|
-
暂未更新
|
|
159
|
-
|
|
160
180
|
## env 设置
|
|
161
181
|
|
|
162
182
|
```bash
|
|
@@ -177,15 +197,10 @@ conda install nonebot-plugin-l4d2-server
|
|
|
177
197
|
|
|
178
198
|
## 和 0.x.x 更改部分
|
|
179
199
|
|
|
180
|
-
- 取消了网页控制台(没有卵用)
|
|
181
|
-
- 取消了自动重启(与其他插件功能重复)
|
|
182
|
-
- 取消了 git 拉取更新(nb 规范用 pypi)
|
|
183
|
-
- 删除无用部分(依赖太多难以维护)
|
|
184
|
-
- 删除了 anne 部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过 core 插件调用
|
|
185
|
-
|
|
186
200
|
## 其他
|
|
187
201
|
|
|
188
|
-
-
|
|
202
|
+
- anne 部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过 core 插件调用
|
|
203
|
+
- 如果您有发现 BUG 或者更好的建议,欢迎提 Issue & Pr
|
|
189
204
|
- 如果本插件对你有帮助,不要忘了点个 Star~
|
|
190
205
|
- 本项目仅供学习使用,请勿用于商业用途
|
|
191
206
|
- [更新日志](./docs/update.md)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
# nonebot_plugin_l4d2_server 1.
|
|
10
|
+
# nonebot_plugin_l4d2_server 1.3.0
|
|
11
11
|
|
|
12
12
|
_✨Nonebot & Left 4 Dead 2 server 操作 ✨_
|
|
13
13
|
|
|
@@ -48,14 +48,34 @@ _✨Nonebot & Left 4 Dead 2 server 操作 ✨_
|
|
|
48
48
|
</a>
|
|
49
49
|
</div>
|
|
50
50
|
|
|
51
|
-
##
|
|
51
|
+
## 功能
|
|
52
52
|
|
|
53
|
-
- 在 json 文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云 1 输出 1 号服务器
|
|
54
53
|
- `l4d2帮助` 帮助指令
|
|
54
|
+
|
|
55
|
+
### 自定义服务器
|
|
56
|
+
|
|
57
|
+
- 在 json 文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云 1 输出 1 号服务器
|
|
58
|
+
|
|
59
|
+
### SourceBans++
|
|
60
|
+
|
|
61
|
+
- 通过 [SourceBans++](https://sbpp.github.io/) 获取服务器的 ban 信息,自动导入ip
|
|
62
|
+
|
|
63
|
+
### 配置管理
|
|
64
|
+
|
|
55
65
|
- l4 图片开启/关闭 超管指令 可以修改输出单图是否为图片输出
|
|
56
66
|
- l4 查找用户 在已知服务器中查找
|
|
57
67
|
- l4 工坊下载 提供创意工坊 id 下载到服务器和群聊
|
|
58
68
|
|
|
69
|
+
### 自定义查服背景图片
|
|
70
|
+
|
|
71
|
+
插件支持自定义图片背景,在 `data/L4D2/custom_backgrounds/` 目录下放入 PNG/JPG/JPEG 格式图片即可,插件会自动随机选择使用。
|
|
72
|
+
|
|
73
|
+
具体位置参考 [数据结构](./docs/standand.md)
|
|
74
|
+
|
|
75
|
+
- 目录不存在时插件会自动创建
|
|
76
|
+
- 放入图片无需重启立即生效
|
|
77
|
+
- 未放置图片时默认使用纯白色背景
|
|
78
|
+
|
|
59
79
|
## 安装
|
|
60
80
|
|
|
61
81
|
以下提到的方法 任选**其一** 即可
|
|
@@ -117,8 +137,6 @@ conda install nonebot-plugin-l4d2-server
|
|
|
117
137
|
|
|
118
138
|
## [数据结构](./docs/standand.md)
|
|
119
139
|
|
|
120
|
-
暂未更新
|
|
121
|
-
|
|
122
140
|
## env 设置
|
|
123
141
|
|
|
124
142
|
```bash
|
|
@@ -139,15 +157,10 @@ conda install nonebot-plugin-l4d2-server
|
|
|
139
157
|
|
|
140
158
|
## 和 0.x.x 更改部分
|
|
141
159
|
|
|
142
|
-
- 取消了网页控制台(没有卵用)
|
|
143
|
-
- 取消了自动重启(与其他插件功能重复)
|
|
144
|
-
- 取消了 git 拉取更新(nb 规范用 pypi)
|
|
145
|
-
- 删除无用部分(依赖太多难以维护)
|
|
146
|
-
- 删除了 anne 部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过 core 插件调用
|
|
147
|
-
|
|
148
160
|
## 其他
|
|
149
161
|
|
|
150
|
-
-
|
|
162
|
+
- anne 部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过 core 插件调用
|
|
163
|
+
- 如果您有发现 BUG 或者更好的建议,欢迎提 Issue & Pr
|
|
151
164
|
- 如果本插件对你有帮助,不要忘了点个 Star~
|
|
152
165
|
- 本项目仅供学习使用,请勿用于商业用途
|
|
153
166
|
- [更新日志](./docs/update.md)
|
|
@@ -16,17 +16,18 @@
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from nonebot import get_driver, require
|
|
19
|
+
from nonebot.plugin import PluginMetadata, inherit_supported_adapters
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
# 依赖插件声明 必须在导入其它插件模块之前执行
|
|
21
22
|
require("nonebot_plugin_alconna")
|
|
22
|
-
require("nonebot_plugin_tortoise_orm")
|
|
23
23
|
require("nonebot_plugin_datastore")
|
|
24
|
+
require("nonebot_plugin_htmlrender")
|
|
25
|
+
require("nonebot_plugin_tortoise_orm")
|
|
24
26
|
|
|
25
|
-
from
|
|
26
|
-
|
|
27
|
-
from . import __main__ as __main__ # noqa: E402
|
|
27
|
+
from . import __main__ # noqa: E402, F401
|
|
28
28
|
from .config import ConfigModel # noqa: E402
|
|
29
29
|
from .l4_help import __version__ # noqa: E402
|
|
30
|
+
from .shared.utils.database import models # noqa: E402, F401
|
|
30
31
|
|
|
31
32
|
driver = get_driver()
|
|
32
33
|
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"""
|
|
2
|
+
* Copyright (c) 2023, Agnes Digital
|
|
3
|
+
*
|
|
4
|
+
* This program is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import List, Optional, cast
|
|
20
|
+
|
|
21
|
+
import ujson as json
|
|
22
|
+
from nonebot import get_driver
|
|
23
|
+
from nonebot.adapters import Message
|
|
24
|
+
from nonebot.log import logger
|
|
25
|
+
from nonebot.matcher import Matcher
|
|
26
|
+
from nonebot.params import CommandArg, CommandStart, RawCommand
|
|
27
|
+
from nonebot.permission import SUPERUSER
|
|
28
|
+
from nonebot.plugin import on_command, on_fullmatch
|
|
29
|
+
from nonebot_plugin_alconna import UniMessage
|
|
30
|
+
|
|
31
|
+
from .config import config, config_manager
|
|
32
|
+
from .l4_ban import l4_request
|
|
33
|
+
from .l4_ban.utils import refresh_server_command_rule
|
|
34
|
+
from .l4_help import get_l4d2_core_help
|
|
35
|
+
from .l4_local import * # noqa: F403
|
|
36
|
+
from .l4_request import (
|
|
37
|
+
COMMAND,
|
|
38
|
+
get_all_server_detail,
|
|
39
|
+
get_ip_server,
|
|
40
|
+
get_server_detail,
|
|
41
|
+
reload_ip,
|
|
42
|
+
server_find,
|
|
43
|
+
tj_request,
|
|
44
|
+
)
|
|
45
|
+
from .message import Gm, Sm
|
|
46
|
+
from .shared.utils.api.models import OutServer
|
|
47
|
+
from .shared.utils.api.request import L4API, L4D2Api
|
|
48
|
+
from .shared.utils.api.utils import out_msg_out
|
|
49
|
+
from .shared.utils.group_store import set_group
|
|
50
|
+
from .shared.utils.sb_sources import load_pages
|
|
51
|
+
from .shared.utils.utils import split_maohao
|
|
52
|
+
|
|
53
|
+
driver = get_driver()
|
|
54
|
+
|
|
55
|
+
reload_ip()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
l4_help = on_command("l4_help", aliases={"l4help", "l4d2帮助"})
|
|
59
|
+
|
|
60
|
+
l4_reload_servers = on_command("l4_reload", aliases={"l4reload", "l4刷新", "l4重载"})
|
|
61
|
+
l4_list_all_servers = on_command("l4_all", aliases={"l4all", "l4全服"})
|
|
62
|
+
l4_connect_server = on_command("l4_connect", aliases={"connect", "l4连接"})
|
|
63
|
+
l4_find_player = on_command("l4_find_player", aliases={"l4find", "l4查找"})
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
config_path = Path(config.l4_path) / "config.json"
|
|
67
|
+
refresh_server_command_rule(l4_request)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
async def sync_sb_pages_groups() -> None:
|
|
71
|
+
"""根据 sb_pages.json 内容刷新所有服务器组"""
|
|
72
|
+
pages = await load_pages()
|
|
73
|
+
if not pages:
|
|
74
|
+
logger.info("sb_pages.json 为空,跳过启动时刷新")
|
|
75
|
+
reload_ip()
|
|
76
|
+
refresh_server_command_rule(l4_request)
|
|
77
|
+
return
|
|
78
|
+
|
|
79
|
+
api = L4D2Api()
|
|
80
|
+
ok = 0
|
|
81
|
+
failed: List[str] = []
|
|
82
|
+
for tag, page in pages.items():
|
|
83
|
+
try:
|
|
84
|
+
servers = await api.get_sourceban(tag, page)
|
|
85
|
+
await set_group(tag, servers)
|
|
86
|
+
ok += 1
|
|
87
|
+
except Exception as exc:
|
|
88
|
+
failed.append(f"{tag}: {exc}")
|
|
89
|
+
|
|
90
|
+
reload_ip()
|
|
91
|
+
refresh_server_command_rule(l4_request)
|
|
92
|
+
|
|
93
|
+
if ok:
|
|
94
|
+
logger.success(f"启动时已刷新 {ok} 个服务器组")
|
|
95
|
+
if failed:
|
|
96
|
+
logger.warning("以下服务器组刷新失败:" + "; ".join(failed))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@driver.on_startup
|
|
100
|
+
async def _sync_groups_on_startup() -> None:
|
|
101
|
+
await sync_sb_pages_groups()
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@l4_help.handle()
|
|
105
|
+
async def handle_l4_help():
|
|
106
|
+
"""帮助"""
|
|
107
|
+
logger.info("开始执行[l4d2帮助]")
|
|
108
|
+
im = await get_l4d2_core_help()
|
|
109
|
+
await out_msg_out(im)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@l4_request.handle()
|
|
113
|
+
async def handle_server_query(
|
|
114
|
+
start: str = CommandStart(),
|
|
115
|
+
command: str = RawCommand(),
|
|
116
|
+
args: Message = CommandArg(),
|
|
117
|
+
):
|
|
118
|
+
logger.info(f"[l4]开始执行请求]:{command}")
|
|
119
|
+
if start:
|
|
120
|
+
command = command.replace(start, "")
|
|
121
|
+
if command == "anne":
|
|
122
|
+
command = "云"
|
|
123
|
+
|
|
124
|
+
_id: Optional[str] = args.extract_plain_text().strip()
|
|
125
|
+
if _id and not _id.isdigit():
|
|
126
|
+
logger.info(Gm.no_id)
|
|
127
|
+
return
|
|
128
|
+
|
|
129
|
+
if not _id:
|
|
130
|
+
_id = None
|
|
131
|
+
else:
|
|
132
|
+
logger.info(f"ID: {_id}")
|
|
133
|
+
|
|
134
|
+
msg = await get_server_detail(command, _id)
|
|
135
|
+
if msg is None:
|
|
136
|
+
await out_msg_out(Sm.server_outtime)
|
|
137
|
+
return
|
|
138
|
+
|
|
139
|
+
logger_info_msg = Gm.outputing_group
|
|
140
|
+
if _id is not None:
|
|
141
|
+
logger_info_msg += f" {_id}"
|
|
142
|
+
logger.info(logger_info_msg, is_connect=config.l4_image)
|
|
143
|
+
await out_msg_out(msg)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@l4_find_player.handle()
|
|
147
|
+
async def handle_find_player(
|
|
148
|
+
args: Message = CommandArg(),
|
|
149
|
+
):
|
|
150
|
+
# 以后有时间补img格式
|
|
151
|
+
msg: str = args.extract_plain_text().strip()
|
|
152
|
+
if not msg:
|
|
153
|
+
return UniMessage.text(Gm.add_name)
|
|
154
|
+
tag_list: List[str] = msg.split(" ", maxsplit=1)
|
|
155
|
+
if len(tag_list) == 1:
|
|
156
|
+
await UniMessage.text(Sm.no_group_search).send()
|
|
157
|
+
name = tag_list[0]
|
|
158
|
+
out = cast(List[OutServer], await server_find(is_img=False))
|
|
159
|
+
logger.info(out)
|
|
160
|
+
logger.info(type(out))
|
|
161
|
+
out_msg = Sm.no_player
|
|
162
|
+
for one in out:
|
|
163
|
+
logger.info(one)
|
|
164
|
+
for player in one["player"]:
|
|
165
|
+
if name in player.name:
|
|
166
|
+
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
|
167
|
+
logger.info(config.l4_connect)
|
|
168
|
+
logger.info(type(out_msg))
|
|
169
|
+
if config.l4_connect and isinstance(out_msg, bytes):
|
|
170
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
171
|
+
out_msgs = UniMessage.image(raw=out_msg) + UniMessage.text(
|
|
172
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
173
|
+
)
|
|
174
|
+
elif config.l4_connect and isinstance(out_msg, str):
|
|
175
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
176
|
+
out_msgs = UniMessage.text(out_msg) + UniMessage.text(
|
|
177
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
178
|
+
)
|
|
179
|
+
elif isinstance(out_msg, str):
|
|
180
|
+
out_msgs = UniMessage.text(out_msg)
|
|
181
|
+
else:
|
|
182
|
+
out_msgs = UniMessage.image(raw=out_msg)
|
|
183
|
+
return await out_msg_out(out_msgs)
|
|
184
|
+
return None
|
|
185
|
+
if len(tag_list) == 2:
|
|
186
|
+
group, name = tag_list
|
|
187
|
+
await UniMessage.text(f"正在查询{group}组").send()
|
|
188
|
+
out = cast(List[OutServer], await server_find(command=group, is_img=True))
|
|
189
|
+
out_msg = Gm.no_player
|
|
190
|
+
for one in out:
|
|
191
|
+
for player in one["player"]:
|
|
192
|
+
if name in player.name:
|
|
193
|
+
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
|
194
|
+
logger.info(config.l4_connect)
|
|
195
|
+
logger.info(type(out_msg))
|
|
196
|
+
if config.l4_connect and isinstance(out_msg, bytes):
|
|
197
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
198
|
+
out_msgs = UniMessage.image(raw=out_msg) + UniMessage.text(
|
|
199
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
200
|
+
)
|
|
201
|
+
elif config.l4_connect and isinstance(out_msg, str):
|
|
202
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
203
|
+
out_msgs = UniMessage.text(out_msg) + UniMessage.text(
|
|
204
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
205
|
+
)
|
|
206
|
+
elif isinstance(out_msg, str):
|
|
207
|
+
out_msgs = UniMessage.text(out_msg)
|
|
208
|
+
else:
|
|
209
|
+
out_msgs = UniMessage.image(raw=out_msg)
|
|
210
|
+
|
|
211
|
+
return await out_msg_out(out_msgs)
|
|
212
|
+
return None
|
|
213
|
+
return None
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@l4_list_all_servers.handle()
|
|
217
|
+
async def handle_all_servers():
|
|
218
|
+
await out_msg_out(await get_all_server_detail())
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
@l4_connect_server.handle()
|
|
222
|
+
async def handle_connect_server(args: Message = CommandArg()):
|
|
223
|
+
ip: Optional[str] = args.extract_plain_text()
|
|
224
|
+
if ip is not None:
|
|
225
|
+
host, port = split_maohao(ip)
|
|
226
|
+
await out_msg_out(
|
|
227
|
+
await get_ip_server(ip),
|
|
228
|
+
is_connect=config.l4_connect,
|
|
229
|
+
host=host,
|
|
230
|
+
port=str(port),
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
@l4_reload_servers.handle()
|
|
235
|
+
async def handle_reload_servers(args: Message = CommandArg()):
|
|
236
|
+
arg = args.extract_plain_text().strip()
|
|
237
|
+
if not arg:
|
|
238
|
+
with (Path(config.l4_path) / "l4d2.json").open("r", encoding="utf-8") as f:
|
|
239
|
+
content = f.read().strip()
|
|
240
|
+
ip_json = json.loads(content)
|
|
241
|
+
for tag, url in ip_json.items():
|
|
242
|
+
logger.info(f"重载{tag}的ip")
|
|
243
|
+
await L4API.get_sourceban(tag, url)
|
|
244
|
+
reload_ip()
|
|
245
|
+
refresh_server_command_rule(l4_request)
|
|
246
|
+
logger.success("重载ip完成")
|
|
247
|
+
await out_msg_out("重载ip完成")
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# l4_add_ban = on_command("l4addban", aliases={"l4添加ban"})
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# @l4_add_ban.handle()
|
|
254
|
+
# async def _(args: Message = CommandArg()):
|
|
255
|
+
# arg = args.extract_plain_text().strip().split(" ")
|
|
256
|
+
# if len(arg) != 2:
|
|
257
|
+
# await UniMessage.text("请在命令后增加响应指令名和网址").finish()
|
|
258
|
+
|
|
259
|
+
# config_data = read_config(config_path)
|
|
260
|
+
# config_data.update({arg[0]: arg[1]})
|
|
261
|
+
# write_config(config_path, config_data)
|
|
262
|
+
|
|
263
|
+
# await L4API.get_sourceban(arg[0], arg[1])
|
|
264
|
+
# reload_ip()
|
|
265
|
+
# refresh_server_command_rule(l4_request)
|
|
266
|
+
# await UniMessage.text("添加成功\n组名: {arg[0]}\n网址: {arg[1]}").send()
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
# l4_del_ban = on_command("l4delban", aliases={"l4删除ban", "l4移除ban"})
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# @l4_del_ban.handle()
|
|
273
|
+
# async def _(args: Message = CommandArg()):
|
|
274
|
+
# arg = args.extract_plain_text().strip().split(" ")
|
|
275
|
+
# if len(arg) not in [1, 2]:
|
|
276
|
+
# await UniMessage.text("请在命令后增加响应指令名或者带响应网址").finish()
|
|
277
|
+
# elif len(arg) == 1:
|
|
278
|
+
# if not Path(Path(config.l4_path) / "config.json").is_file():
|
|
279
|
+
# await UniMessage.text("没有添加过组名").finish()
|
|
280
|
+
# else:
|
|
281
|
+
# with (Path(config.l4_path) / "config.json").open(
|
|
282
|
+
# "r",
|
|
283
|
+
# encoding="utf-8",
|
|
284
|
+
# ) as f:
|
|
285
|
+
# content = f.read().strip()
|
|
286
|
+
# config_data = json.loads(content)
|
|
287
|
+
# if arg[0] not in config_data:
|
|
288
|
+
# await UniMessage.text("没有添加过这个组").finish()
|
|
289
|
+
# else:
|
|
290
|
+
# del config_data[arg[0]]
|
|
291
|
+
# async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
|
292
|
+
# json.dump(config_data, f, ensure_ascii=False, indent=4)
|
|
293
|
+
# await out_msg_out(f"删除成功,组名:{arg[0]}")
|
|
294
|
+
# elif len(arg) == 2:
|
|
295
|
+
# if not Path(Path(config.l4_path) / "config.json").is_file():
|
|
296
|
+
# await UniMessage.text("没有添加过组名").finish()
|
|
297
|
+
# else:
|
|
298
|
+
# with (Path(config.l4_path) / "config.json").open(
|
|
299
|
+
# "r",
|
|
300
|
+
# encoding="utf-8",
|
|
301
|
+
# ) as f:
|
|
302
|
+
# content = f.read().strip()
|
|
303
|
+
# config_datas = json.loads(content)
|
|
304
|
+
# if arg[0] not in config_datas:
|
|
305
|
+
# await UniMessage.text("没有添加过这个组").finish()
|
|
306
|
+
# else:
|
|
307
|
+
# config_datas[arg[0]] = arg[1]
|
|
308
|
+
# async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
|
309
|
+
# json.dump(config_datas, f, ensure_ascii=False, indent=4)
|
|
310
|
+
# await out_msg_out(f"修改成功,组名:{arg[0]},网址:{arg[1]}")
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
if "云" in COMMAND:
|
|
314
|
+
ld_tj = on_fullmatch("tj")
|
|
315
|
+
ld_zl = on_fullmatch("zl")
|
|
316
|
+
ld_kl = on_fullmatch("kl")
|
|
317
|
+
|
|
318
|
+
@ld_tj.handle()
|
|
319
|
+
async def handle_tj_command(matcher: Matcher):
|
|
320
|
+
await matcher.send("正在寻找牢房信息")
|
|
321
|
+
await matcher.finish(await tj_request("云", "tj"))
|
|
322
|
+
|
|
323
|
+
@ld_zl.handle()
|
|
324
|
+
async def handle_zl_command(matcher: Matcher):
|
|
325
|
+
await matcher.send("正在寻找牢房信息")
|
|
326
|
+
await matcher.finish(await tj_request("云", "zl"))
|
|
327
|
+
|
|
328
|
+
@ld_kl.handle()
|
|
329
|
+
async def handle_kl_command(matcher: Matcher):
|
|
330
|
+
await matcher.send("正在寻找牢房信息")
|
|
331
|
+
await matcher.finish(await tj_request("云", "kl"))
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
## 以下为配置修改
|
|
335
|
+
|
|
336
|
+
l4_toggle_image = on_command(
|
|
337
|
+
"l4_toggle_image",
|
|
338
|
+
aliases={"l4img", "l4图片"},
|
|
339
|
+
permission=SUPERUSER,
|
|
340
|
+
)
|
|
341
|
+
l4_switch_style = on_command(
|
|
342
|
+
"l4_switch_style",
|
|
343
|
+
aliases={"l4style", "l4风格切换"},
|
|
344
|
+
permission=SUPERUSER,
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
@l4_toggle_image.handle()
|
|
349
|
+
async def handle_toggle_image_mode(args: Message = CommandArg()):
|
|
350
|
+
arg = args.extract_plain_text().strip().lower()
|
|
351
|
+
if arg == "开启":
|
|
352
|
+
config_manager.update_image_config(enabled=True)
|
|
353
|
+
await out_msg_out("[l4]已开启图片模式")
|
|
354
|
+
elif arg == "关闭":
|
|
355
|
+
config_manager.update_image_config(enabled=False)
|
|
356
|
+
await out_msg_out("[l4]已关闭图片模式")
|
|
357
|
+
else:
|
|
358
|
+
await UniMessage.text("请在参数后加上开启或关闭").finish()
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
@l4_switch_style.handle()
|
|
362
|
+
async def handle_switch_style():
|
|
363
|
+
if config.l4_style == "default":
|
|
364
|
+
config_manager.update_style_config(style="old")
|
|
365
|
+
await UniMessage.text("[l4]已切换为旧风格").finish()
|
|
366
|
+
else:
|
|
367
|
+
config_manager.update_style_config(style="default")
|
|
368
|
+
await UniMessage.text("[l4]已切换为默认风格").finish()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import List
|
|
2
|
+
from typing import List
|
|
3
3
|
|
|
4
4
|
from nonebot import get_plugin_config
|
|
5
5
|
from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_MEMBER, GROUP_OWNER
|
|
6
6
|
from nonebot.log import logger
|
|
7
|
-
from nonebot.permission import SUPERUSER
|
|
7
|
+
from nonebot.permission import SUPERUSER, Permission
|
|
8
8
|
from pydantic import BaseModel, Field, field_validator
|
|
9
9
|
|
|
10
10
|
# 常量定义
|
|
@@ -27,7 +27,6 @@ def init_data_directory(data_dir: Path) -> None:
|
|
|
27
27
|
# 初始化目录结构
|
|
28
28
|
DATAOUT = Path(DEFAULT_DATA_DIR)
|
|
29
29
|
init_data_directory(DATAOUT)
|
|
30
|
-
init_data_directory(DATAOUT / "l4d2")
|
|
31
30
|
server_all_path = DATAOUT / "l4d2"
|
|
32
31
|
server_all_path.mkdir(parents=True, exist_ok=True)
|
|
33
32
|
|
|
@@ -82,10 +81,10 @@ class ConfigModel(BaseModel):
|
|
|
82
81
|
"""更新地图索引配置"""
|
|
83
82
|
if index < 0:
|
|
84
83
|
raise ValueError("地图索引不能小于0")
|
|
85
|
-
self.
|
|
84
|
+
self.map_index = index
|
|
86
85
|
|
|
87
86
|
@property
|
|
88
|
-
def l4_permission_set(self) ->
|
|
87
|
+
def l4_permission_set(self) -> Permission:
|
|
89
88
|
permissions = {
|
|
90
89
|
1: SUPERUSER,
|
|
91
90
|
2: SUPERUSER | GROUP_OWNER,
|
|
@@ -140,7 +139,11 @@ class ConfigManager:
|
|
|
140
139
|
if key not in valid_keys:
|
|
141
140
|
raise ValueError(f"无效的配置项: {key}")
|
|
142
141
|
|
|
143
|
-
|
|
142
|
+
field_info = ConfigModel.model_fields[key]
|
|
143
|
+
field_type = field_info.annotation
|
|
144
|
+
if not field_type:
|
|
145
|
+
continue
|
|
146
|
+
|
|
144
147
|
if not isinstance(value, field_type):
|
|
145
148
|
raise TypeError(f"{key} 必须是 {field_type.__name__} 类型")
|
|
146
149
|
|
|
@@ -148,7 +151,7 @@ class ConfigManager:
|
|
|
148
151
|
|
|
149
152
|
# 验证更新后的配置
|
|
150
153
|
try:
|
|
151
|
-
self._config = ConfigModel(**self._config.
|
|
154
|
+
self._config = ConfigModel(**self._config.model_dump())
|
|
152
155
|
except ValueError as e:
|
|
153
156
|
logger.error(f"配置更新失败: {e!s}")
|
|
154
157
|
|