nonebot-plugin-aawarframe 0.6.0__tar.gz → 0.24.2__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_aawarframe-0.24.2/PKG-INFO +81 -0
- nonebot_plugin_aawarframe-0.24.2/README.md +45 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/__init__.py +26 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/admin/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/admin/control.py +206 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/admin/server.py +284 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/admin/static/app.js +56 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/admin/static/index.html +14 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/admin/static/style.css +2 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/api.py +151 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/assets/offline.tar.gz +0 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/assets/riven_stats.json +78 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/bootstrap.py +162 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/client.py +79 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/commands/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/commands/parsing.py +176 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/commands/router.py +119 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/config.py +27 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/__init__.py +8 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/catalog.py +82 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/index.py +95 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/json_store.py +83 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/links.py +146 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/manager.py +529 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/models.py +56 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/normalizer.py +39 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/patches.py +17 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/registry.py +89 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/rewards.py +72 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/search.py +56 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/sources.py +294 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/storage.py +60 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/grq/unified.py +194 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/cache.py +68 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/http.py +103 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/images.py +55 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/ocr_worker.py +112 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/riven_ocr.py +128 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/storage.py +34 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/wiki_http.py +142 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/infrastructure/wiki_transport.py +47 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/initialization/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/initialization/build.py +109 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/initialization/market.py +59 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/initialization/nodes.py +55 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/initialization/pipeline.py +218 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/initialization/rules.py +247 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/initialization/wfcd.py +129 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/localization/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/localization/relics.py +115 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/localization/resolver.py +57 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/localization/resources.py +68 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/localization/riven_attributes.py +62 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/localization/rivens.py +53 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/media_onebot.py +103 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/media_qq.py +50 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/arbitration.py +25 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/bounties.py +43 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/common.py +251 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/errors.py +11 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/market.py +86 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/operations.py +40 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/relics.py +37 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/riven_market.py +34 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/riven_values.py +20 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/rivens.py +51 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/trend.py +48 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/void_trader.py +42 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/wiki.py +41 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/models/worldstate.py +176 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/protocols/__init__.py +1 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/protocols/message.py +71 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/protocols/qq.py +181 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/providers/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/providers/market.py +150 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/providers/riven_market.py +39 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/providers/rivens.py +99 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/providers/wiki.py +44 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/providers/worldstate.py +35 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/base.css +274 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/relics.css +15 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/riven_analysis.css +14 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/riven_market.css +10 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/riven_values.css +13 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/themes/default.css +10 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/trader.css +12 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/assets/css/trend.css +15 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/charts.py +47 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/renderer.py +396 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/arbitration.html +12 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/archimedea.html +25 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/attributes.html +12 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/base.html +26 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/bounties.html +33 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/bounty_rewards.html +7 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/card.html +29 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/challenge_bounties.html +16 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/commands.html +8 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/fissures.html +42 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/market.html +26 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/nightwave.html +18 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/operations.html +38 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/relics.html +28 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/riven_analysis.html +10 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/riven_market.html +18 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/riven_values.html +29 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/trend.html +30 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/void_trader.html +21 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/templates/weekly.html +16 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/rendering/viewmodels.py +106 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/router.py +210 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/arbitration.py +170 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/archimedea.py +117 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/bounties.py +217 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/calendar.py +60 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/cetus.py +12 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/challenge_bounties.py +116 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/circuit.py +93 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/clan.py +47 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/common.py +18 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/cycles.py +125 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/fissures.py +80 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/market.py +100 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/nightwave.py +103 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/operations.py +136 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/relics.py +98 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/riven_analysis.py +176 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/riven_market.py +84 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/riven_values.py +111 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/rivens.py +164 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/steel_path.py +27 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/trend.py +65 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/void_trader.py +81 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/weekly.py +55 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/wiki.py +26 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/wiki_store.py +92 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/services/worldstate.py +78 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/subscriptions/__init__.py +5 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/subscriptions/rules.py +143 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/subscriptions/service.py +437 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/subscriptions/sources.py +186 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/subscriptions/store.py +528 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/subscriptions/targets.py +192 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/parsers/__init__.py +3 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/parsers/bounties.py +39 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/parsers/challenge_bounties.py +72 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/parsers/common.py +31 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/parsers/cycles.py +88 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/parsers/location_bounties.py +19 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe/worldstate/seeded_random.py +24 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe.egg-info/PKG-INFO +81 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe.egg-info/SOURCES.txt +195 -0
- nonebot_plugin_aawarframe-0.24.2/nonebot_plugin_aawarframe.egg-info/requires.txt +29 -0
- nonebot_plugin_aawarframe-0.24.2/pyproject.toml +56 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_arbitration.py +107 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_archimedea.py +89 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_bounties.py +160 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_bounty_summary.py +53 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_cache.py +109 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_challenge_bounties.py +110 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_core_api.py +145 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_core_api_contract.py +60 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_cycles.py +101 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_fissure_cards.py +115 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_initialization.py +149 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_manual_release.py +37 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_market.py +365 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_message_output.py +21 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_nightwave.py +97 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_ocr_admission_v2.py +91 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_ocr_frontend_admission.py +29 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_operations.py +127 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_protocol_messages.py +19 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_qq_official.py +46 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_registry_admin.py +161 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_rendering.py +151 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_riven_static_rules.py +23 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_subscription_extensions.py +319 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_subscription_numbers.py +167 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_subscriptions.py +173 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_unified_items.py +91 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_void_storms.py +106 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_weekly_rotations.py +112 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_wiki.py +136 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_wiki_http.py +138 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_wiki_persistent_cache.py +81 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_wiki_transport.py +34 -0
- nonebot_plugin_aawarframe-0.24.2/tests/test_worldstate.py +130 -0
- nonebot_plugin_aawarframe-0.6.0/PKG-INFO +0 -141
- nonebot_plugin_aawarframe-0.6.0/README.md +0 -123
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/__init__.py +0 -15
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/ExportRegions_zh.json +0 -1
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/conquest_zh.json +0 -231
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/faction_type.json +0 -10
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/final_arbys.json +0 -396506
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/mission_type.json +0 -29
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/archimedea.html +0 -153
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/base.css +0 -903
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/current_arbys.html +0 -254
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/eidolon_clock.html +0 -364
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/orders.html +0 -703
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/s_arbys.html +0 -193
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/today_arbys.html +0 -210
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/templates/void_fissures.html +0 -242
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/variables.json +0 -28
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/wm_items.json +0 -1
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/assets/wm_pitems.json +0 -9269
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/commands.py +0 -91
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/common/__init__.py +0 -20
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/integrations/__init__.py +0 -0
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/integrations/warframe_market/__init__.py +0 -0
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/integrations/warframe_market/client.py +0 -40
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/integrations/warframe_market/schemas.py +0 -145
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/__init__.py +0 -0
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/arbys/__init__.py +0 -88
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/archimedea/__init__.py +0 -0
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/archimedea/data_processor.py +0 -181
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/archimedea/deep.py +0 -27
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/archimedea/temporal.py +0 -27
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/earth/__init__.py +0 -1
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/earth/eidolon_clock.py +0 -174
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/voidfissures/__init__.py +0 -72
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/warframe_market/__init__.py +0 -1
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/warframe_market/matcher.py +0 -41
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/warframe_market/orders.py +0 -204
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe/service/warframe_market/utils.py +0 -12
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe.egg-info/PKG-INFO +0 -141
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe.egg-info/SOURCES.txt +0 -44
- nonebot_plugin_aawarframe-0.6.0/nonebot_plugin_aawarframe.egg-info/requires.txt +0 -7
- nonebot_plugin_aawarframe-0.6.0/pyproject.toml +0 -22
- {nonebot_plugin_aawarframe-0.6.0 → nonebot_plugin_aawarframe-0.24.2}/LICENSE +0 -0
- {nonebot_plugin_aawarframe-0.6.0 → nonebot_plugin_aawarframe-0.24.2}/nonebot_plugin_aawarframe.egg-info/dependency_links.txt +0 -0
- {nonebot_plugin_aawarframe-0.6.0 → nonebot_plugin_aawarframe-0.24.2}/nonebot_plugin_aawarframe.egg-info/top_level.txt +0 -0
- {nonebot_plugin_aawarframe-0.6.0 → nonebot_plugin_aawarframe-0.24.2}/setup.cfg +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nonebot-plugin-aawarframe
|
|
3
|
+
Version: 0.24.2
|
|
4
|
+
Summary: Aa 的 Warframe 助手:支持 QQ 官方和 OneBot V11
|
|
5
|
+
Author-email: nekox41 <aameow@outlook.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: ==3.12.*
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: nonebot2>=2.5.0
|
|
11
|
+
Requires-Dist: httpx>=0.28.1
|
|
12
|
+
Requires-Dist: fastapi<1,>=0.115
|
|
13
|
+
Requires-Dist: uvicorn<1,>=0.35
|
|
14
|
+
Requires-Dist: curl-cffi<0.18,>=0.17
|
|
15
|
+
Requires-Dist: nonebot-plugin-htmlrender<0.9,>=0.8.0
|
|
16
|
+
Requires-Dist: playwright>=1.61.0
|
|
17
|
+
Requires-Dist: rapidfuzz>=3.14.5
|
|
18
|
+
Requires-Dist: pydantic<3,>=2
|
|
19
|
+
Requires-Dist: jinja2>=3.1
|
|
20
|
+
Requires-Dist: json5>=0.9.25
|
|
21
|
+
Provides-Extra: qq
|
|
22
|
+
Requires-Dist: nonebot-adapter-qq<2,>=1.7.4; extra == "qq"
|
|
23
|
+
Provides-Extra: onebot
|
|
24
|
+
Requires-Dist: nonebot-adapter-onebot<3,>=2.4.6; extra == "onebot"
|
|
25
|
+
Provides-Extra: ocr
|
|
26
|
+
Requires-Dist: paddlepaddle==3.2.0; extra == "ocr"
|
|
27
|
+
Requires-Dist: paddleocr==3.3.2; extra == "ocr"
|
|
28
|
+
Requires-Dist: Pillow<13,>=11; extra == "ocr"
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.9; extra == "dev"
|
|
33
|
+
Requires-Dist: build>=1; extra == "dev"
|
|
34
|
+
Requires-Dist: twine>=6; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
<div align="center">
|
|
38
|
+
|
|
39
|
+
<img src="./imgs/logo.png" width="132" alt="Aa 的 Warframe 助手">
|
|
40
|
+
|
|
41
|
+
# Aa 的 Warframe 助手
|
|
42
|
+
|
|
43
|
+
把 Warframe 的常用信息带进聊天。
|
|
44
|
+
|
|
45
|
+
[](https://pypi.org/project/nonebot-plugin-aawarframe/)
|
|
46
|
+
[](https://www.python.org/)
|
|
47
|
+
[](./LICENSE)
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
它是一个基于 NoneBot2 的 Warframe 查询插件。你可以在 QQ 里查看游戏状态、查询交易信息、分析紫卡,也可以订阅自己关心的变化。
|
|
52
|
+
|
|
53
|
+
支持 QQ 官方机器人和 OneBot V11。查询结果会整理成图片卡片,尽量让信息一眼就能看清。
|
|
54
|
+
|
|
55
|
+
## 能做什么
|
|
56
|
+
|
|
57
|
+
- 查看世界状态、裂缝、赏金和每周轮换
|
|
58
|
+
- 查询 Warframe Market 挂单、成交趋势和遗物部件
|
|
59
|
+
- 查询紫卡价格、词条数值,并识别紫卡截图
|
|
60
|
+
- 订阅夜灵、裂缝、仲裁和市场等提醒
|
|
61
|
+
- 搜索 Warframe Wiki
|
|
62
|
+
|
|
63
|
+
## 文档
|
|
64
|
+
|
|
65
|
+
| 想了解什么 | 文档 |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| 安装与手动部署 | [安装指南](docs/installation.md) |
|
|
68
|
+
| 插件配置 | [配置说明](docs/configuration.md) |
|
|
69
|
+
| 有哪些功能、怎么使用 | [功能介绍](docs/features.md) |
|
|
70
|
+
| 代码如何组织 | [项目架构](docs/architecture.md) |
|
|
71
|
+
| 数据、缓存、渲染和 OCR | [技术细节](docs/technical-details.md) |
|
|
72
|
+
|
|
73
|
+
## 支持
|
|
74
|
+
|
|
75
|
+
- Python 3.12
|
|
76
|
+
- NoneBot2
|
|
77
|
+
- QQ 官方机器人、OneBot V11
|
|
78
|
+
|
|
79
|
+
## 许可
|
|
80
|
+
|
|
81
|
+
本项目使用 [MIT License](LICENSE)。
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="./imgs/logo.png" width="132" alt="Aa 的 Warframe 助手">
|
|
4
|
+
|
|
5
|
+
# Aa 的 Warframe 助手
|
|
6
|
+
|
|
7
|
+
把 Warframe 的常用信息带进聊天。
|
|
8
|
+
|
|
9
|
+
[](https://pypi.org/project/nonebot-plugin-aawarframe/)
|
|
10
|
+
[](https://www.python.org/)
|
|
11
|
+
[](./LICENSE)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
它是一个基于 NoneBot2 的 Warframe 查询插件。你可以在 QQ 里查看游戏状态、查询交易信息、分析紫卡,也可以订阅自己关心的变化。
|
|
16
|
+
|
|
17
|
+
支持 QQ 官方机器人和 OneBot V11。查询结果会整理成图片卡片,尽量让信息一眼就能看清。
|
|
18
|
+
|
|
19
|
+
## 能做什么
|
|
20
|
+
|
|
21
|
+
- 查看世界状态、裂缝、赏金和每周轮换
|
|
22
|
+
- 查询 Warframe Market 挂单、成交趋势和遗物部件
|
|
23
|
+
- 查询紫卡价格、词条数值,并识别紫卡截图
|
|
24
|
+
- 订阅夜灵、裂缝、仲裁和市场等提醒
|
|
25
|
+
- 搜索 Warframe Wiki
|
|
26
|
+
|
|
27
|
+
## 文档
|
|
28
|
+
|
|
29
|
+
| 想了解什么 | 文档 |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| 安装与手动部署 | [安装指南](docs/installation.md) |
|
|
32
|
+
| 插件配置 | [配置说明](docs/configuration.md) |
|
|
33
|
+
| 有哪些功能、怎么使用 | [功能介绍](docs/features.md) |
|
|
34
|
+
| 代码如何组织 | [项目架构](docs/architecture.md) |
|
|
35
|
+
| 数据、缓存、渲染和 OCR | [技术细节](docs/technical-details.md) |
|
|
36
|
+
|
|
37
|
+
## 支持
|
|
38
|
+
|
|
39
|
+
- Python 3.12
|
|
40
|
+
- NoneBot2
|
|
41
|
+
- QQ 官方机器人、OneBot V11
|
|
42
|
+
|
|
43
|
+
## 许可
|
|
44
|
+
|
|
45
|
+
本项目使用 [MIT License](LICENSE)。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Aa 的 Warframe 助手:NoneBot2 插件入口。"""
|
|
2
|
+
|
|
3
|
+
from nonebot import require
|
|
4
|
+
from nonebot.plugin import PluginMetadata
|
|
5
|
+
|
|
6
|
+
from .config import Config
|
|
7
|
+
|
|
8
|
+
require("nonebot_plugin_htmlrender")
|
|
9
|
+
|
|
10
|
+
__plugin_meta__ = PluginMetadata(
|
|
11
|
+
name="nonebot-plugin-aawarframe",
|
|
12
|
+
description="Aa 的 Warframe 助手,支持 QQ 官方与 OneBot V11",
|
|
13
|
+
usage="发送 帮助 查看命令",
|
|
14
|
+
type="application",
|
|
15
|
+
homepage="https://github.com/nekox41/nonebot-plugin-aawarframe",
|
|
16
|
+
config=Config,
|
|
17
|
+
supported_adapters=None,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from .bootstrap import setup as setup_runtime # noqa: E402
|
|
21
|
+
|
|
22
|
+
setup_runtime()
|
|
23
|
+
|
|
24
|
+
from .router import setup # noqa: E402
|
|
25
|
+
|
|
26
|
+
setup()
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Desc: 保存管理配置并执行即时生效的命令路由和黑白名单规则。
|
|
2
|
+
# Date: 2026-11-15
|
|
3
|
+
# Author: Aameow
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import re
|
|
7
|
+
from typing import Literal
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
10
|
+
|
|
11
|
+
from ..grq import GameResourceQuery
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ACL(BaseModel):
|
|
15
|
+
model_config = ConfigDict(extra="forbid")
|
|
16
|
+
allow_users: list[str] = Field(default_factory=list, max_length=10000)
|
|
17
|
+
allow_groups: list[str] = Field(default_factory=list, max_length=10000)
|
|
18
|
+
deny_users: list[str] = Field(default_factory=list, max_length=10000)
|
|
19
|
+
deny_groups: list[str] = Field(default_factory=list, max_length=10000)
|
|
20
|
+
|
|
21
|
+
@model_validator(mode="after")
|
|
22
|
+
def validate_ids(self):
|
|
23
|
+
for values in (self.allow_users, self.allow_groups, self.deny_users, self.deny_groups):
|
|
24
|
+
if any(not re.fullmatch(r"(?:qq-(?:group|channel):)?[A-Za-z0-9_-]{1,160}", v) for v in values):
|
|
25
|
+
raise ValueError("用户和群组标识必须是数字或 QQ 官方 OpenID")
|
|
26
|
+
return self
|
|
27
|
+
|
|
28
|
+
def permits(self, user: str, group: str | None):
|
|
29
|
+
if user in self.deny_users or (group and group in self.deny_groups):
|
|
30
|
+
return False
|
|
31
|
+
return not (self.allow_users or self.allow_groups) or (
|
|
32
|
+
user in self.allow_users or bool(group and group in self.allow_groups)
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Command(BaseModel):
|
|
37
|
+
model_config = ConfigDict(extra="forbid")
|
|
38
|
+
feature: str
|
|
39
|
+
name: str = Field(min_length=1, max_length=40)
|
|
40
|
+
aliases: list[str] = Field(default_factory=list, max_length=20)
|
|
41
|
+
enabled: bool = True
|
|
42
|
+
prefix: Literal["nonebot", "none", "optional"] = "nonebot"
|
|
43
|
+
acl: ACL = Field(default_factory=ACL)
|
|
44
|
+
|
|
45
|
+
@model_validator(mode="after")
|
|
46
|
+
def validate_names(self):
|
|
47
|
+
for name in [self.name, *self.aliases]:
|
|
48
|
+
if not name or len(name) > 40 or any(c.isspace() or ord(c) < 32 for c in name):
|
|
49
|
+
raise ValueError("命令不能包含空白,最长 40 字")
|
|
50
|
+
return self
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class Options(BaseModel):
|
|
54
|
+
model_config = ConfigDict(extra="forbid")
|
|
55
|
+
http_timeout: float = Field(default=12, gt=0, le=60)
|
|
56
|
+
worldstate_ttl: float = Field(default=45, gt=0, le=180)
|
|
57
|
+
market_ttl: float = Field(default=30, gt=0, le=90)
|
|
58
|
+
wiki_ttl: float = Field(default=300, ge=0, le=3600)
|
|
59
|
+
wiki_interval: float = Field(default=1, ge=1, le=60)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class Settings(BaseModel):
|
|
63
|
+
model_config = ConfigDict(extra="forbid")
|
|
64
|
+
acl: ACL = Field(default_factory=ACL)
|
|
65
|
+
options: Options = Field(default_factory=Options)
|
|
66
|
+
commands: list[Command]
|
|
67
|
+
|
|
68
|
+
@model_validator(mode="after")
|
|
69
|
+
def unique_names(self):
|
|
70
|
+
features, names = set(), {}
|
|
71
|
+
for cmd in self.commands:
|
|
72
|
+
if cmd.feature in features:
|
|
73
|
+
raise ValueError("功能不能重复")
|
|
74
|
+
features.add(cmd.feature)
|
|
75
|
+
for name in [cmd.name, *cmd.aliases]:
|
|
76
|
+
if name in names and names[name] != cmd.feature:
|
|
77
|
+
raise ValueError("命令冲突:" + name)
|
|
78
|
+
names[name] = cmd.feature
|
|
79
|
+
if features != {f for _, _, f in DEFAULT_COMMANDS}:
|
|
80
|
+
raise ValueError("不能添加或删除功能,请使用启用开关")
|
|
81
|
+
return self
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
DEFAULT_COMMANDS = [
|
|
85
|
+
("帮助", set(), "help"),
|
|
86
|
+
("平原", set(), "plains"),
|
|
87
|
+
("突击", set(), "sortie"),
|
|
88
|
+
("奸商", set(), "void_trader"),
|
|
89
|
+
("入侵", set(), "invasions"),
|
|
90
|
+
("执刑官", set(), "archon"),
|
|
91
|
+
("时光", set(), "temporal"),
|
|
92
|
+
("深层", set(), "deep"),
|
|
93
|
+
("裂缝", set(), "fissures"),
|
|
94
|
+
("钢铁裂缝", set(), "steel_fissures"),
|
|
95
|
+
("九重天", set(), "railjack_fissures"),
|
|
96
|
+
("氏族", set(), "clan"),
|
|
97
|
+
("电波", set(), "nightwave"),
|
|
98
|
+
("日历", set(), "calendar"),
|
|
99
|
+
("钢精", set(), "steel_path"),
|
|
100
|
+
("回廊", set(), "circuit"),
|
|
101
|
+
("灵化", set(), "incarnons"),
|
|
102
|
+
("赏金", set(), "bounty_summary"),
|
|
103
|
+
("地球", set(), "bounties"),
|
|
104
|
+
("金星", set(), "venus_bounties"),
|
|
105
|
+
("火卫二", set(), "deimos_bounties"),
|
|
106
|
+
("圣所", set(), "sanctum_bounties"),
|
|
107
|
+
("扎里曼", set(), "zariman_bounties"),
|
|
108
|
+
("1999", set(), "hex_bounties"),
|
|
109
|
+
("仲裁", set(), "arbitration"),
|
|
110
|
+
("今日仲裁", set(), "today_arbitration"),
|
|
111
|
+
("高效仲裁", set(), "efficient_arbitration"),
|
|
112
|
+
("wm", set(), "market"),
|
|
113
|
+
("趋势", set(), "trend"),
|
|
114
|
+
("部件", set(), "parts"),
|
|
115
|
+
("遗物", set(), "relic"),
|
|
116
|
+
("wmr", set(), "riven_market"),
|
|
117
|
+
("词条", set(), "riven_attributes"),
|
|
118
|
+
("wk", set(), "wiki"),
|
|
119
|
+
("zk", set(), "riven_ranking"),
|
|
120
|
+
("zk已洗", set(), "rolled_riven_ranking"),
|
|
121
|
+
("数值", set(), "riven_values"),
|
|
122
|
+
("分析", set(), "riven_analysis"),
|
|
123
|
+
("订阅", set(), "subscribe"),
|
|
124
|
+
("我的订阅", set(), "list_subscriptions"),
|
|
125
|
+
("取消订阅", set(), "unsubscribe"),
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class Control:
|
|
130
|
+
def __init__(self, registry: GameResourceQuery, options=None):
|
|
131
|
+
self.registry = registry
|
|
132
|
+
default = Settings(
|
|
133
|
+
commands=[Command(feature=f, name=n, aliases=sorted(a)) for n, a, f in DEFAULT_COMMANDS]
|
|
134
|
+
)
|
|
135
|
+
if options:
|
|
136
|
+
default.options = Options(**options)
|
|
137
|
+
raw, self.revision = registry.read_setting("control", default.model_dump())
|
|
138
|
+
features = {cmd.feature for cmd in default.commands}
|
|
139
|
+
raw["commands"] = [item for item in raw["commands"] if item["feature"] in features]
|
|
140
|
+
known = {item["feature"] for item in raw["commands"]}
|
|
141
|
+
raw["commands"].extend(cmd.model_dump() for cmd in default.commands if cmd.feature not in known)
|
|
142
|
+
scheme, revision = registry.read_setting("command_scheme", 0)
|
|
143
|
+
if scheme != 2:
|
|
144
|
+
names = {cmd.feature: cmd.name for cmd in default.commands}
|
|
145
|
+
for item in raw["commands"]:
|
|
146
|
+
item.update(name=names[item["feature"]], aliases=[])
|
|
147
|
+
self.settings = Settings.model_validate(raw)
|
|
148
|
+
if scheme != 2:
|
|
149
|
+
self.revision = registry.write_setting("control", self.settings.model_dump(), self.revision)
|
|
150
|
+
registry.write_setting("command_scheme", 2, revision)
|
|
151
|
+
self.apply = None
|
|
152
|
+
self._compile()
|
|
153
|
+
|
|
154
|
+
def _compile(self):
|
|
155
|
+
self.routes = tuple(
|
|
156
|
+
sorted(
|
|
157
|
+
(
|
|
158
|
+
(name, cmd)
|
|
159
|
+
for cmd in self.settings.commands
|
|
160
|
+
for name in {cmd.name, *cmd.aliases}
|
|
161
|
+
),
|
|
162
|
+
key=lambda pair: (-len(pair[0]), pair[0]),
|
|
163
|
+
)
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
def update(self, raw, revision):
|
|
167
|
+
settings = Settings.model_validate(raw)
|
|
168
|
+
self.revision = self.registry.write_setting("control", settings.model_dump(), revision)
|
|
169
|
+
self.settings = settings
|
|
170
|
+
self._compile()
|
|
171
|
+
if self.apply:
|
|
172
|
+
self.apply(settings.options)
|
|
173
|
+
return self.revision
|
|
174
|
+
|
|
175
|
+
async def update_async(self, raw, revision):
|
|
176
|
+
settings = Settings.model_validate(raw)
|
|
177
|
+
self.revision = await asyncio.to_thread(
|
|
178
|
+
self.registry.write_setting, "control", settings.model_dump(), revision
|
|
179
|
+
)
|
|
180
|
+
self.settings = settings
|
|
181
|
+
self._compile()
|
|
182
|
+
if self.apply:
|
|
183
|
+
self.apply(settings.options)
|
|
184
|
+
return self.revision
|
|
185
|
+
|
|
186
|
+
def route(self, text, starts, user, group=None):
|
|
187
|
+
# 先识别最长命令,再判断开关和名单;被停用的长命令不会误触发短命令。
|
|
188
|
+
matches = []
|
|
189
|
+
for name, command in self.routes:
|
|
190
|
+
prefixes = starts if command.prefix == "nonebot" else {""}
|
|
191
|
+
if command.prefix == "optional":
|
|
192
|
+
prefixes = {*starts, ""}
|
|
193
|
+
for prefix in prefixes:
|
|
194
|
+
token = prefix + name
|
|
195
|
+
if text.startswith(token):
|
|
196
|
+
matches.append((len(token), command, text[len(token) :].strip()))
|
|
197
|
+
if not matches:
|
|
198
|
+
return None
|
|
199
|
+
_, command, args = max(matches, key=lambda m: m[0])
|
|
200
|
+
if (
|
|
201
|
+
not command.enabled
|
|
202
|
+
or not self.settings.acl.permits(user, group)
|
|
203
|
+
or not command.acl.permits(user, group)
|
|
204
|
+
):
|
|
205
|
+
return None
|
|
206
|
+
return command.feature, args
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# 作用:提供带口令认证的 HTTPS 管理 API 和网页管理台。
|
|
2
|
+
# 编写日期:2026-11-13
|
|
3
|
+
# 作者:Aameow
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import hashlib
|
|
7
|
+
import hmac
|
|
8
|
+
import logging
|
|
9
|
+
import os
|
|
10
|
+
import secrets
|
|
11
|
+
import ssl
|
|
12
|
+
import subprocess
|
|
13
|
+
from collections import OrderedDict, deque
|
|
14
|
+
from contextlib import contextmanager
|
|
15
|
+
from ipaddress import ip_address
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from time import monotonic
|
|
18
|
+
from typing import Literal
|
|
19
|
+
|
|
20
|
+
import uvicorn
|
|
21
|
+
from fastapi import Depends, FastAPI, HTTPException, Request
|
|
22
|
+
from fastapi.responses import FileResponse, JSONResponse
|
|
23
|
+
from pydantic import BaseModel, Field
|
|
24
|
+
|
|
25
|
+
logger = logging.getLogger(__name__)
|
|
26
|
+
STATIC = Path(__file__).parent / "static"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class AliasInput(BaseModel):
|
|
30
|
+
item_id: str
|
|
31
|
+
alias: str = Field(min_length=1, max_length=120)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ArbitrationInput(BaseModel):
|
|
35
|
+
node_id: str
|
|
36
|
+
grade: Literal["S", "A", "B", "C", "D", "F"]
|
|
37
|
+
vitus_per_minute: float = Field(ge=0, allow_inf_nan=False)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def create_app(runtime, token: str):
|
|
41
|
+
grq = runtime.grq
|
|
42
|
+
digest = hashlib.sha256(token.encode()).digest()
|
|
43
|
+
failures = OrderedDict()
|
|
44
|
+
|
|
45
|
+
async def authenticate(request: Request):
|
|
46
|
+
address = request.client.host if request.client else "unknown"
|
|
47
|
+
now = monotonic()
|
|
48
|
+
attempts = failures.setdefault(address, deque())
|
|
49
|
+
failures.move_to_end(address)
|
|
50
|
+
while len(failures) > 2048:
|
|
51
|
+
failures.popitem(last=False)
|
|
52
|
+
while attempts and now - attempts[0] > 60:
|
|
53
|
+
attempts.popleft()
|
|
54
|
+
if len(attempts) >= 10:
|
|
55
|
+
raise HTTPException(429, "登录尝试过多,请一分钟后重试")
|
|
56
|
+
value = request.headers.get("authorization", "")
|
|
57
|
+
supplied = value[7:] if value.startswith("Bearer ") else ""
|
|
58
|
+
if not hmac.compare_digest(hashlib.sha256(supplied.encode()).digest(), digest):
|
|
59
|
+
attempts.append(now)
|
|
60
|
+
raise HTTPException(401, "登录口令不正确")
|
|
61
|
+
failures.pop(address, None)
|
|
62
|
+
# Bearer 认证不使用 Cookie;同时拒绝跨站浏览器提交。
|
|
63
|
+
origin = request.headers.get("origin")
|
|
64
|
+
if origin and origin != str(request.base_url).rstrip("/"):
|
|
65
|
+
raise HTTPException(403, "不允许跨站请求")
|
|
66
|
+
|
|
67
|
+
app = FastAPI(docs_url=None, redoc_url=None, openapi_url=None)
|
|
68
|
+
|
|
69
|
+
@app.middleware("http")
|
|
70
|
+
async def protect(request, call_next):
|
|
71
|
+
limit = 2_000_000
|
|
72
|
+
length = request.headers.get("content-length")
|
|
73
|
+
if length and (not length.isdigit() or int(length) > limit):
|
|
74
|
+
return JSONResponse({"detail": "请求内容过大"}, 413)
|
|
75
|
+
# 同时限制没有 Content-Length 的分块上传。
|
|
76
|
+
if request.method in {"POST", "PUT", "PATCH"}:
|
|
77
|
+
chunks, size = [], 0
|
|
78
|
+
async for chunk in request.stream():
|
|
79
|
+
size += len(chunk)
|
|
80
|
+
if size > limit:
|
|
81
|
+
return JSONResponse({"detail": "请求内容过大"}, 413)
|
|
82
|
+
chunks.append(chunk)
|
|
83
|
+
request._body = b"".join(chunks)
|
|
84
|
+
response = await call_next(request)
|
|
85
|
+
response.headers.update(
|
|
86
|
+
{
|
|
87
|
+
"Cache-Control": "no-store",
|
|
88
|
+
"X-Content-Type-Options": "nosniff",
|
|
89
|
+
"Referrer-Policy": "no-referrer",
|
|
90
|
+
"X-Frame-Options": "DENY",
|
|
91
|
+
"Content-Security-Policy": "default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'",
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
return response
|
|
95
|
+
|
|
96
|
+
@app.exception_handler(ValueError)
|
|
97
|
+
async def invalid(request, exc):
|
|
98
|
+
return JSONResponse({"detail": str(exc)}, status_code=409)
|
|
99
|
+
|
|
100
|
+
@app.get("/")
|
|
101
|
+
async def home():
|
|
102
|
+
return FileResponse(STATIC / "index.html")
|
|
103
|
+
|
|
104
|
+
@app.get("/app.js")
|
|
105
|
+
async def javascript():
|
|
106
|
+
return FileResponse(STATIC / "app.js", media_type="text/javascript")
|
|
107
|
+
|
|
108
|
+
@app.get("/style.css")
|
|
109
|
+
async def stylesheet():
|
|
110
|
+
return FileResponse(STATIC / "style.css", media_type="text/css")
|
|
111
|
+
|
|
112
|
+
auth = [Depends(authenticate)]
|
|
113
|
+
|
|
114
|
+
@app.get("/api/session", dependencies=auth)
|
|
115
|
+
async def session():
|
|
116
|
+
return {"ok": True}
|
|
117
|
+
|
|
118
|
+
@app.get("/api/items", dependencies=auth)
|
|
119
|
+
async def items(q: str = ""):
|
|
120
|
+
if len(q) > 200:
|
|
121
|
+
raise HTTPException(400, "查询内容过长")
|
|
122
|
+
if not q.strip():
|
|
123
|
+
return {"items": []}
|
|
124
|
+
index = grq.domains["Items"]
|
|
125
|
+
result = grq.search("Items", q)
|
|
126
|
+
selected = {r.id: r for r in result.candidates}
|
|
127
|
+
key = q.casefold()
|
|
128
|
+
for resource in index.resources.values():
|
|
129
|
+
if len(selected) >= 30:
|
|
130
|
+
break
|
|
131
|
+
if (
|
|
132
|
+
resource.enabled
|
|
133
|
+
and key
|
|
134
|
+
in " ".join([resource.id, *resource.names.values(), *resource.aliases]).casefold()
|
|
135
|
+
):
|
|
136
|
+
selected.setdefault(resource.id, resource)
|
|
137
|
+
return {
|
|
138
|
+
"items": [
|
|
139
|
+
{
|
|
140
|
+
"id": r.id,
|
|
141
|
+
"name": r.name(),
|
|
142
|
+
"name_en": r.names.get("en", ""),
|
|
143
|
+
"tradable": r.metadata.get("market_tradable", False),
|
|
144
|
+
"market_slug": r.identifiers.get("market.slug"),
|
|
145
|
+
}
|
|
146
|
+
for r in selected.values()
|
|
147
|
+
if r.enabled
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@app.get("/api/aliases", dependencies=auth)
|
|
152
|
+
async def aliases():
|
|
153
|
+
return {"items": await asyncio.to_thread(grq.list_aliases)}
|
|
154
|
+
|
|
155
|
+
@app.post("/api/aliases", dependencies=auth)
|
|
156
|
+
async def add_alias(payload: AliasInput):
|
|
157
|
+
await asyncio.to_thread(grq.add_alias, payload.item_id, payload.alias)
|
|
158
|
+
return {"ok": True}
|
|
159
|
+
|
|
160
|
+
@app.delete("/api/aliases", dependencies=auth)
|
|
161
|
+
async def delete_alias(payload: AliasInput):
|
|
162
|
+
await asyncio.to_thread(grq.delete_alias, payload.item_id, payload.alias)
|
|
163
|
+
return {"ok": True}
|
|
164
|
+
|
|
165
|
+
@app.get("/api/arbitration/nodes", dependencies=auth)
|
|
166
|
+
async def arbitration_nodes():
|
|
167
|
+
return {"items": runtime.arbitration.list_nodes()}
|
|
168
|
+
|
|
169
|
+
@app.put("/api/arbitration/nodes", dependencies=auth)
|
|
170
|
+
async def save_arbitration(payload: ArbitrationInput):
|
|
171
|
+
await asyncio.to_thread(runtime.arbitration.save_node, **payload.model_dump())
|
|
172
|
+
runtime.renderer.cache.entries.clear()
|
|
173
|
+
return {"ok": True}
|
|
174
|
+
|
|
175
|
+
return app
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class EmbeddedServer(uvicorn.Server):
|
|
179
|
+
@contextmanager
|
|
180
|
+
def capture_signals(self):
|
|
181
|
+
# 进程信号由 NoneBot 主服务器处理。
|
|
182
|
+
yield
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class AdminServer:
|
|
186
|
+
def __init__(self, runtime, config):
|
|
187
|
+
self.runtime, self.config = runtime, config
|
|
188
|
+
self.server = None
|
|
189
|
+
self.task = None
|
|
190
|
+
|
|
191
|
+
def start(self):
|
|
192
|
+
config = self.config
|
|
193
|
+
directory = config.aawarframe_cache_dir / "admin"
|
|
194
|
+
directory.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
195
|
+
token_file = directory / "password"
|
|
196
|
+
if config.aawarframe_admin_password:
|
|
197
|
+
token = config.aawarframe_admin_password.get_secret_value()
|
|
198
|
+
else:
|
|
199
|
+
if not token_file.exists():
|
|
200
|
+
fd = os.open(token_file, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
|
201
|
+
with os.fdopen(fd, "w") as stream:
|
|
202
|
+
stream.write(secrets.token_urlsafe(32) + "\n")
|
|
203
|
+
token_file.chmod(0o600)
|
|
204
|
+
token = token_file.read_text().strip()
|
|
205
|
+
if len(token) < 16:
|
|
206
|
+
raise ValueError("管理口令至少需要 16 个字符")
|
|
207
|
+
cert = config.aawarframe_admin_cert or directory / "cert.pem"
|
|
208
|
+
key = config.aawarframe_admin_key or directory / "key.pem"
|
|
209
|
+
if bool(config.aawarframe_admin_cert) != bool(config.aawarframe_admin_key):
|
|
210
|
+
raise ValueError("必须同时配置管理台证书和私钥")
|
|
211
|
+
if not config.aawarframe_admin_cert and not (cert.exists() and key.exists()):
|
|
212
|
+
host = config.aawarframe_admin_public_host or "localhost"
|
|
213
|
+
try:
|
|
214
|
+
ip_address(host)
|
|
215
|
+
san = "IP:" + host
|
|
216
|
+
except ValueError:
|
|
217
|
+
if not all(c.isalnum() or c in "-." for c in host):
|
|
218
|
+
raise ValueError("管理台域名无效") from None
|
|
219
|
+
san = "DNS:" + host
|
|
220
|
+
subprocess.run(
|
|
221
|
+
[
|
|
222
|
+
"openssl",
|
|
223
|
+
"req",
|
|
224
|
+
"-x509",
|
|
225
|
+
"-newkey",
|
|
226
|
+
"rsa:2048",
|
|
227
|
+
"-nodes",
|
|
228
|
+
"-keyout",
|
|
229
|
+
str(key),
|
|
230
|
+
"-out",
|
|
231
|
+
str(cert),
|
|
232
|
+
"-days",
|
|
233
|
+
"365",
|
|
234
|
+
"-subj",
|
|
235
|
+
"/CN=" + host,
|
|
236
|
+
"-addext",
|
|
237
|
+
"subjectAltName=" + san,
|
|
238
|
+
],
|
|
239
|
+
check=True,
|
|
240
|
+
capture_output=True,
|
|
241
|
+
timeout=20,
|
|
242
|
+
)
|
|
243
|
+
key.chmod(0o600)
|
|
244
|
+
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
|
245
|
+
context.load_cert_chain(cert, key)
|
|
246
|
+
app = create_app(self.runtime, token)
|
|
247
|
+
self.server = EmbeddedServer(
|
|
248
|
+
uvicorn.Config(
|
|
249
|
+
app,
|
|
250
|
+
host=config.aawarframe_admin_host,
|
|
251
|
+
port=config.aawarframe_admin_port,
|
|
252
|
+
ssl_certfile=str(cert),
|
|
253
|
+
ssl_keyfile=str(key),
|
|
254
|
+
access_log=True,
|
|
255
|
+
proxy_headers=False,
|
|
256
|
+
log_config=None,
|
|
257
|
+
log_level=None,
|
|
258
|
+
timeout_graceful_shutdown=5,
|
|
259
|
+
)
|
|
260
|
+
)
|
|
261
|
+
self.task = asyncio.create_task(self._serve(), name="aawarframe-admin")
|
|
262
|
+
self.task.add_done_callback(self._done)
|
|
263
|
+
logger.info("管理台 HTTPS 端口 %s;口令文件:%s", config.aawarframe_admin_port, token_file)
|
|
264
|
+
|
|
265
|
+
async def _serve(self):
|
|
266
|
+
try:
|
|
267
|
+
await self.server.serve()
|
|
268
|
+
except SystemExit as exc:
|
|
269
|
+
# 管理端口冲突不应终止机器人主进程。
|
|
270
|
+
raise RuntimeError("管理台未能启动,请检查端口和证书") from exc
|
|
271
|
+
|
|
272
|
+
def _done(self, task):
|
|
273
|
+
if not task.cancelled() and task.exception():
|
|
274
|
+
logger.error("管理台运行失败", exc_info=task.exception())
|
|
275
|
+
|
|
276
|
+
async def close(self):
|
|
277
|
+
if self.server:
|
|
278
|
+
self.server.should_exit = True
|
|
279
|
+
if self.task:
|
|
280
|
+
try:
|
|
281
|
+
await asyncio.wait_for(asyncio.shield(self.task), 8)
|
|
282
|
+
except TimeoutError:
|
|
283
|
+
self.task.cancel()
|
|
284
|
+
await asyncio.gather(self.task, return_exceptions=True)
|