nonebot-plugin-l4d2-server 1.3.5__tar.gz → 1.4.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.
Files changed (159) hide show
  1. nonebot_plugin_l4d2_server-1.4.2/PKG-INFO +500 -0
  2. nonebot_plugin_l4d2_server-1.4.2/README.md +462 -0
  3. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/__init__.py +272 -0
  4. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/api/l4d2.py +767 -0
  5. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/api/models.py +3 -0
  6. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words/LICENSE +21 -0
  7. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words/README.md +32 -0
  8. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//345/205/266/344/273/226/350/257/215/345/272/223.txt +158 -0
  9. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//345/217/215/345/212/250/350/257/215/345/272/223.txt +555 -0
  10. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//346/224/277/346/262/273/347/261/273/345/236/213.txt +322 -0
  11. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//346/226/260/346/200/235/346/203/263/345/220/257/350/222/231.txt +16 -0
  12. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//346/232/264/346/201/220/350/257/215/345/272/223.txt +176 -0
  13. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//346/266/211/346/236/252/346/266/211/347/210/206.txt +436 -0
  14. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//350/211/262/346/203/205/347/261/273/345/236/213.txt +303 -0
  15. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/block_words//350/264/252/350/205/220/350/257/215/345/272/223.txt +241 -0
  16. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/__init__.py +36 -0
  17. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/commands/admin.py +17 -5
  18. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/commands/ban.py +44 -12
  19. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/favorite.py +119 -0
  20. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/fuzzy_search.py +158 -0
  21. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/history.py +159 -0
  22. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/local.py +302 -0
  23. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/query.py +303 -0
  24. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/server_control.py +298 -0
  25. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/commands/server_mgmt.py +159 -0
  26. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/config.py +260 -0
  27. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/consts.py +18 -2
  28. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/enable_rule.py +44 -0
  29. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/fontconfig_env.py +39 -0
  30. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/http_helpers.py +115 -0
  31. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/messages.py +68 -0
  32. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/registry.py +352 -0
  33. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/__init__.py +2 -1
  34. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/background.py +11 -6
  35. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/chart.py +369 -0
  36. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/fonts/fonts.conf +88 -0
  37. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/fonts.py +65 -0
  38. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/Help.json +44 -12
  39. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help.py +0 -1
  40. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/server_card.py +37 -13
  41. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/server_list.py +163 -0
  42. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/templates/github.png +0 -0
  43. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/templates/l.png +0 -0
  44. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/templates/m.png +0 -0
  45. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/normal.html +28 -9
  46. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/templates/normal_old.html +218 -0
  47. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/style.css +78 -52
  48. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/render/templates/w.png +0 -0
  49. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/workshop.html +6 -7
  50. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/workshop.py +3 -1
  51. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/__init__.py +29 -0
  52. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/blocklist.py +179 -0
  53. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/errors.py +69 -0
  54. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/favorite.py +460 -0
  55. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/services/filter.py +39 -19
  56. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/history.py +342 -0
  57. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/history_hot.py +107 -0
  58. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/path_resolver.py +84 -0
  59. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/server_query.py +308 -0
  60. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/sourceban.py +84 -0
  61. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/watch.py +263 -0
  62. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/services/workshop.py +196 -0
  63. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server/store/groups.py +340 -0
  64. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/store/pages.py +3 -5
  65. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/version.py +1 -1
  66. nonebot_plugin_l4d2_server-1.4.2/nonebot_plugin_l4d2_server.egg-info/PKG-INFO +500 -0
  67. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server.egg-info/SOURCES.txt +39 -1
  68. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server.egg-info/requires.txt +2 -2
  69. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/pyproject.toml +8 -3
  70. nonebot_plugin_l4d2_server-1.4.2/tests/test_a2s_cache.py +578 -0
  71. nonebot_plugin_l4d2_server-1.4.2/tests/test_blocklist.py +324 -0
  72. nonebot_plugin_l4d2_server-1.4.2/tests/test_chart.py +107 -0
  73. nonebot_plugin_l4d2_server-1.4.2/tests/test_filter.py +101 -0
  74. nonebot_plugin_l4d2_server-1.4.2/tests/test_history_hot.py +215 -0
  75. nonebot_plugin_l4d2_server-1.4.2/tests/test_history_query.py +160 -0
  76. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/tests/test_migrate.py +33 -12
  77. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/tests/test_registry.py +3 -4
  78. nonebot_plugin_l4d2_server-1.4.2/tests/test_reload_paging.py +761 -0
  79. nonebot_plugin_l4d2_server-1.4.2/tests/test_watch.py +221 -0
  80. nonebot_plugin_l4d2_server-1.3.5/PKG-INFO +0 -252
  81. nonebot_plugin_l4d2_server-1.3.5/README.md +0 -214
  82. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/__init__.py +0 -68
  83. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/api/l4d2.py +0 -394
  84. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/commands/__init__.py +0 -9
  85. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/commands/local.py +0 -210
  86. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/commands/query.py +0 -169
  87. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/config.py +0 -102
  88. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/http_helpers.py +0 -71
  89. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/messages.py +0 -35
  90. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/registry.py +0 -199
  91. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/render/fonts.py +0 -15
  92. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/render/server_list.py +0 -99
  93. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/render/templates/normal_old.html +0 -245
  94. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/services/__init__.py +0 -13
  95. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/services/server_query.py +0 -155
  96. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/services/sourceban.py +0 -51
  97. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/services/workshop.py +0 -66
  98. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server/store/groups.py +0 -104
  99. nonebot_plugin_l4d2_server-1.3.5/nonebot_plugin_l4d2_server.egg-info/PKG-INFO +0 -252
  100. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/LICENSE +0 -0
  101. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/api/__init__.py +0 -0
  102. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/api/sources.py +0 -0
  103. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/backgrounds/background.jpg +0 -0
  104. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/fonts/loli.ttf +0 -0
  105. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//344/273/213/347/273/215.png" +0 -0
  106. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//344/273/273/345/212/241.png" +0 -0
  107. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//344/277/241/346/201/257.png" +0 -0
  108. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/205/254/345/221/212.png" +0 -0
  109. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/210/200/345/211/221.png" +0 -0
  110. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/210/207/346/215/242.png" +0 -0
  111. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/210/240/351/231/244.png" +0 -0
  112. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/210/267/346/226/260.png" +0 -0
  113. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/215/241/347/273/204.png" +0 -0
  114. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/223/252/351/207/214.png" +0 -0
  115. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/234/260/345/233/276.png" +0 -0
  116. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/257/274/345/205/245.png" +0 -0
  117. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/257/274/345/207/272.png" +0 -0
  118. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//345/275/261.png" +0 -0
  119. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/213/274/345/233/276.png" +0 -0
  120. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/216/242/347/264/242.png" +0 -0
  121. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/216/250/351/200/201.png" +0 -0
  122. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/224/266/351/233/206.png" +0 -0
  123. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/224/273/347/225/245.png" +0 -0
  124. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/233/264/346/226/260.png" +0 -0
  125. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/235/220/346/226/231.png" +0 -0
  126. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/237/245/350/257/242.png" +0 -0
  127. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/240/241/351/252/214.png" +0 -0
  128. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/257/217/346/234/210.png" +0 -0
  129. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/267/261/346/270/212.png" +0 -0
  130. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/267/273/345/212/240.png" +0 -0
  131. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//346/270/205/351/231/244.png" +0 -0
  132. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//347/212/266/346/200/201.png" +0 -0
  133. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//347/255/276/345/210/260.png" +0 -0
  134. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//347/273/221/345/256/232.png" +0 -0
  135. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//350/241/250.png" +0 -0
  136. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//350/241/250/346/203/205.png" +0 -0
  137. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//350/247/222/350/211/262.png" +0 -0
  138. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//350/256/260/345/275/225.png" +0 -0
  139. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//351/205/215/347/275/256.png" +0 -0
  140. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/icons//351/207/215/345/220/257.png" +0 -0
  141. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/textures/badge.png +0 -0
  142. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/textures/banner.png +0 -0
  143. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/textures/bg.jpg +0 -0
  144. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/textures/button.png +0 -0
  145. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/help/textures/icon.png +0 -0
  146. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/images.py +0 -0
  147. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/github.svg +0 -0
  148. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/l.svg +0 -0
  149. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/m.svg +0 -0
  150. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/vac.png +0 -0
  151. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/vac_white.png +0 -0
  152. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/vue.css +0 -0
  153. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/render/templates/w.svg +0 -0
  154. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/services/local_server.py +0 -0
  155. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/services/migrate.py +0 -0
  156. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server/store/__init__.py +0 -0
  157. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server.egg-info/dependency_links.txt +0 -0
  158. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/nonebot_plugin_l4d2_server.egg-info/top_level.txt +0 -0
  159. {nonebot_plugin_l4d2_server-1.3.5 → nonebot_plugin_l4d2_server-1.4.2}/setup.cfg +0 -0
@@ -0,0 +1,500 @@
1
+ Metadata-Version: 2.4
2
+ Name: nonebot-plugin-l4d2-server
3
+ Version: 1.4.2
4
+ Summary: L4D2 server related operations plugin for NoneBot2
5
+ Author-email: Agnes_Digital <Z735803792@163.com>
6
+ License: GPLv3
7
+ Project-URL: homepage, https://github.com/Agnes4m/nonebot_plugin_l4d2_server
8
+ Keywords: steam,game,l4d2,nonebot2,plugin,favorites,subscription
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: <4.0,>=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: nonebot2>=2.1.0
22
+ Requires-Dist: nonebot2[fastapi]>=2.3.3
23
+ Requires-Dist: nonebot-plugin-htmlkit>=0.1.0rc5
24
+ Requires-Dist: nonebot-plugin-apscheduler>=0.5.0
25
+ Requires-Dist: nonebot-adapter-onebot>=2.4.4
26
+ Requires-Dist: nonebot-plugin-alconna>=0.50.0
27
+ Requires-Dist: aiohttp>=3.8.4
28
+ Requires-Dist: jinja2>=3.0.0
29
+ Requires-Dist: httpx>=0.22.0
30
+ Requires-Dist: python-a2s>=1.4.1
31
+ Requires-Dist: ujson>=5.10.0
32
+ Requires-Dist: pillow>10.0.0
33
+ Requires-Dist: pyunpack>=0.3
34
+ Requires-Dist: aiofiles>=24.1.0
35
+ Requires-Dist: beautifulsoup4>=4.12.0
36
+ Requires-Dist: lxml>=6.0.2
37
+ Dynamic: license-file
38
+
39
+ <!-- markdownlint-disable MD026 MD031 MD033 MD036 MD041 MD046 MD051 -->
40
+ <div align="center">
41
+ <img src="https://raw.githubusercontent.com/Agnes4m/nonebot_plugin_l4d2_server/main/image/logo.png" width="180" height="180" alt="AgnesDigitalLogo">
42
+ <br>
43
+ <p><img src="https://s2.loli.net/2022/06/16/xsVUGRrkbn1ljTD.png" width="240" alt="NoneBotPluginText"></p>
44
+ </div>
45
+
46
+ <div align="center">
47
+
48
+ # nonebot_plugin_l4d2_server 1.4.2
49
+
50
+ _✨Nonebot & Left 4 Dead 2 server 操作 ✨_
51
+
52
+ <div align = "center">
53
+ <a href="https://agnes4m.github.io/l4d2/" target="_blank">文档</a> &nbsp; · &nbsp;
54
+ <a href="https://agnes4m.github.io/l4d2/reader/#%E5%8A%9F%E8%83%BD-%E6%8C%87%E4%BB%A4-%F0%9F%A4%94" target="_blank">指令列表</a> &nbsp; · &nbsp;
55
+ <a href="https://agnes4m.github.io/l4d2/bug/">常见问题</a>
56
+ </div><br>
57
+
58
+ <img src="https://img.shields.io/badge/python-3.9+-blue?logo=python&logoColor=edb641" alt="python">
59
+ <a href ="LICENSE">
60
+ <img src="https://img.shields.io/github/license/Agnes4m/nonebot_plugin_l4d2_server" alt="l4logo">
61
+ </a>
62
+ <img src="https://img.shields.io/badge/nonebot-2.1.0+-red.svg" alt="NoneBot">
63
+ <a href="https://pypi.python.org/pypi/nonebot_plugin_l4d2_server">
64
+ <img src="https://img.shields.io/pypi/v/nonebot_plugin_l4d2_server?logo=python&logoColor=edb641" alt="python">
65
+ </a>
66
+ </br>
67
+ <a href="https://github.com/astral-sh/ruff">
68
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json" alt="ruff">
69
+ </a>
70
+ <a href="https://github.com/psf/black">
71
+ <img src="https://img.shields.io/badge/code%20style-black-000000.svg?logo=python&logoColor=edb641" alt="black">
72
+ </a>
73
+
74
+ <img src="https://img.shields.io/badge/alconna-0.58.3+-red.svg" alt="NoneBot">
75
+
76
+ <a href="https://github.com/Agnes4m/nonebot_plugin_l4d2_server/issues">
77
+ <img alt="GitHub issues" src="https://img.shields.io/github/issues/Agnes4m/nonebot_plugin_l4d2_server" alt="issues">
78
+ </a>
79
+
80
+ <a href="https://pypi.python.org/pypi/nonebot_plugin_l4d2_server">
81
+ <img src="https://img.shields.io/pypi/dm/nonebot_plugin_l4d2_server" alt="pypi download">
82
+ </a>
83
+ </br>
84
+ <a href="https://jq.qq.com/?_wv=1027&k=HdjoCcAe">
85
+ <img src="https://img.shields.io/badge/QQ%E7%BE%A4-399365126-orange?style=flat-square" alt="QQ Chat Group">
86
+ </a>
87
+ </div>
88
+
89
+ ## 功能
90
+
91
+ - `l4d2帮助` 帮助指令
92
+
93
+ ### 自定义服务器
94
+
95
+ - 在 json 文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云 1 输出 1 号服务器
96
+
97
+ ### SourceBans++
98
+
99
+ - 通过 [SourceBans++](https://sbpp.github.io/) 获取服务器的 ban 信息,自动导入ip
100
+
101
+ ### 配置管理
102
+
103
+ - l4 图片开启/关闭 超管指令 可以修改输出单图是否为图片输出
104
+ - l4 查找用户 在已知服务器中查找
105
+ - l4 工坊下载 提供创意工坊 id 下载到服务器和群聊
106
+
107
+ ### 自定义服务器列表背景图片
108
+
109
+ `/云` 等组查询输出的服务器列表(HTML)图支持自定义背景。`/云1` 这类具体服查询**不受影响**,固定使用深蓝灰纯色背景。
110
+
111
+ ```
112
+ <data_dir>/custom_backgrounds/ ← 放任意张图即可;插件会随机抽一张
113
+ ```
114
+
115
+ `<data_dir>` 固定为 `<cwd>/data/nonebot_plugin_l4d2_server/`(见下文「数据目录」),
116
+ **不可通过配置改位置**。旧版本里 `L4_PATH` 这个旋钮已经移除,现在设了也不生效。
117
+
118
+ 使用步骤:
119
+
120
+ 1. 找到 `<data_dir>/custom_backgrounds/`(即 `<cwd>/data/nonebot_plugin_l4d2_server/custom_backgrounds/`,与 `云.json` 等组文件同级);
121
+ 2. 把你想要的背景图放入该目录,支持 `.jpg` / `.jpeg` / `.png` 格式,可放多张;
122
+ 3. 完成。下一次查询即会使用新背景。
123
+
124
+ > 目录会在插件启动时自动创建,无需手动建。
125
+
126
+ **查找顺序**:
127
+
128
+ - `/云`(服务器列表):从 `<data_dir>/custom_backgrounds/` 所有图片中**随机抽一张**;目录为空时回退到内置 `background.jpg`
129
+ - `/云1`(单服务器卡):固定使用深蓝灰纯色背景(`#496D89`),不加载任何图片
130
+
131
+ **选择规则**:
132
+
133
+ - 目录中有多张图时,每次查询**随机抽取**一张;
134
+ - 想只用某张图,把其余图片删掉或移走;
135
+ - 替换同名图片会按文件修改时间自动重新加载,无需重启;
136
+ - **建议尺寸**:宽幅横图(如 1920×1080),列表图会按高度铺满并横向平铺。
137
+
138
+ ## 安装
139
+
140
+ 以下提到的方法 任选**其一** 即可
141
+
142
+ <details open>
143
+ <summary>[推荐] 使用 nb-cli 安装</summary>
144
+ 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
145
+
146
+ ```bash
147
+ nb plugin install nonebot-plugin-l4d2-server
148
+ ```
149
+
150
+ </details>
151
+
152
+ <details>
153
+ <summary>使用包管理器安装</summary>
154
+ 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
155
+
156
+ <details>
157
+ <summary>pip</summary>
158
+
159
+ ```bash
160
+ pip install nonebot-plugin-l4d2-server
161
+ ```
162
+
163
+ </details>
164
+ <details>
165
+ <summary>pdm</summary>
166
+
167
+ ```bash
168
+ pdm add nonebot-plugin-l4d2-server
169
+ ```
170
+
171
+ </details>
172
+ <details>
173
+ <summary>poetry</summary>
174
+
175
+ ```bash
176
+ poetry add nonebot-plugin-l4d2-server
177
+ ```
178
+
179
+ </details>
180
+ <details>
181
+ <summary>conda</summary>
182
+
183
+ ```bash
184
+ conda install nonebot-plugin-l4d2-server
185
+ ```
186
+
187
+ </details>
188
+ </details>
189
+
190
+ ### 出图依赖:nonebot-plugin-htmlkit
191
+
192
+ 出图走 `nonebot-plugin-htmlkit` → [litehtml](https://github.com/litehtml/litehtml),
193
+ 纯 C++ 本地渲染,**不再需要 Chromium / Playwright**,也不用 `playwright install`,
194
+ Windows / Linux 都有预编译 wheel,装上即用(比原来的 Playwright 方案省几百 MB
195
+ 内存和一次浏览器冷启动)。
196
+
197
+ 代价是 litehtml 的 CSS 支持比 Chromium 少:`display:flex`、`display:grid`、
198
+ `calc()`、`position:absolute` 这类都不支持,模板必须用块级 / 表格 / 浮动布局。
199
+ `render/templates/` 下的模板已按这个约束重写。
200
+
201
+ 另外两个限制值得注意:
202
+
203
+ - **不渲染 SVG**。litehtml 的图片解码走位图,`<img src="x.svg">` 会直接空白,
204
+ 所以平台图标与 GitHub 图标都改成了同目录下的 `.png`(由原 `.svg` 按 52px
205
+ 栅格化,页面上仍按 13px 显示)。以后加图标请一并提供 PNG。
206
+ - **不支持 `backdrop-filter`**。原方案靠 `blur(2px)` 压住背景图上的文字,
207
+ 现在改用提高白色底的不透明度(`.outer-frame` 0.72、`.server-card` 0.85)来
208
+ 保证对比度。
209
+
210
+ > 如果从旧版本升级过来,可以把 `playwright` 卸载、`~/.cache/ms-playwright`
211
+ > 目录删掉,省 300 MB+ 空间。
212
+
213
+ ## 主要功能
214
+
215
+ - [x] 求生服务器-本地多路径操作(传地图等)
216
+ - [x] 批量查询指定 ip 服务器状态和玩家
217
+ - [x] 组查询(如 `云`)默认只列有人的服务器,`云全` 列出全部(含没人 / 不在线);上百台自动拆成多张图
218
+ - [x] connect 指令直接呼出服务器信息
219
+ - [x] 根据用户名,在已知服务器搜索玩家信息
220
+ - [x] **服务器订阅 / 收藏 + 定时推送**(v1.4.0):上线 / 离线 / 玩家数突变时自动通知群
221
+ - [x] **单服 CRUD 指令**(v1.4.0):不用手动编辑 JSON
222
+ - [x] **创意工坊批量并发下载**(v1.4.0):流式写入 + 进度回报
223
+ - [x] **组查询快扫**:两轮短超时探测 + 离线负缓存,67 台组冷查询 5.7-7.7s → 2.2-2.6s,且在线服识别更准
224
+ - [x] **历史巡检**:每小时记录全组在线状态,离线服指数退避、有人的服额外加密采样,供 `l4热力图` / `l4趋势` / `l4热门地图` 使用
225
+ - [x] **在线趋势折线图**:`l4趋势 云 1 7`,按真实采样时间轴画人数曲线,比格状热力图直观
226
+ - [x] **热门地图排行**:`l4热门地图 云 30`,统计组内地图使用热度
227
+ - [x] **服务器恢复提醒**:群里查一台离线服会登记,默认每 3 分钟复查,恢复后 @ 当时查询的人
228
+
229
+ ## 新指令速览(v1.4.0)
230
+
231
+ | 指令 | 别名 | 权限 | 用途 |
232
+ |---|---|---|---|
233
+ | `l4收藏 <组> <id>` | `l4fav`、`l4_favorite` | — | 在群聊触发,自动记住本群为推送目标 |
234
+ | `l4取关 <组> <id>` | `l4unfav`、`l4_unfavorite` | — | 取消本群订阅(不影响其他群) |
235
+ | `l4收藏列表` | `l4favlist`、`l4_list_favorites` | — | 列出本群订阅 |
236
+ | `l4通知目标 <组> <id> <群号>` | `l4notifytarget` | SUPERUSER | 把订阅的推送目标改成别的群 |
237
+ | `l4添加服务器 <组> host:port` | `l4_add_server`、`l4addserver` | SUPERUSER | 新增单服到指定组 |
238
+ | `l4删除服务器 <组> <id或ip>` | `l4_del_server`、`l4delserver` | SUPERUSER | 删除组内单服 |
239
+ | `l4修改服务器 <组> <id> <新ip>` | `l4_edit_server`、`l4editserver` | SUPERUSER | 改单服 ip |
240
+ | `l4查看组 <组>` | `l4showgroup`、`l4列服务器` | SUPERUSER | 列组成员 + 在线状态 |
241
+ | `l4创意工坊 id1,id2 id3` | — | `l4_permission_set` | 批量并发下载(逗号/空格/换行分隔) |
242
+ | `l4热力图 <组> [天数]` | `l4_heatmap`、`l4heatmap` | — | 整组按星期×小时的在线总人数(1-30 天) |
243
+ | `l4趋势 <组> [天数]` | `l4_trend`、`l4trend`、`l4趋势图` | — | 整组在线人数折线图,按真实采样时间轴绘制(1-30 天) |
244
+ | `l4热门地图 [组] [天数]` | `l4_topmaps`、`l4topmaps`、`l4地图排行` | — | 地图热度排行;不传组名统计全部组(1-90 天) |
245
+
246
+ 服务器组维护类指令同样需要 **SUPERUSER**,因为它们会整体改写或清空组数据:
247
+
248
+ | 指令 | 别名 | 用途 |
249
+ |---|---|---|
250
+ | `l4添加组 <组> <SourceBans URL>` | `l4addban`、`l4添加ban` | 从 SourceBans 页面拉取并导入一个服务器组 |
251
+ | `l4刷新组` | `l4reloadsb` | 重新拉取全部组的 SourceBans 页面 |
252
+ | `l4列组` | `l4listgroup`、`l4listgroups` | 列出已配置的组 |
253
+ | `l4删除组 <组>` | `l4delgroup` | 删除整个组及其分页配置 |
254
+ | `l4删除页 <组> <页码>` | `l4delpage` | 删除某个组的一页分页映射 |
255
+ | `l4导出组 <组>` | `l4exportgroup` | 导出该组的服务器清单(JSON) |
256
+ | `l4导出全部组` | `l4exportgroups` | 导出所有组 |
257
+
258
+ > 这几个曾经没有权限限制,任意群成员都能执行 `l4delgroup` 删掉整个组;现已统一为 SUPERUSER。
259
+
260
+ ## 数据目录
261
+
262
+ 数据目录固定为 `<cwd>/data/nonebot_plugin_l4d2_server/`,由
263
+ `services/path_resolver.py` 直接拼接,**不依赖 `nonebot-plugin-localstore`**
264
+ (`LOCALSTORE_USE_CWD` 设成什么都不影响)。这样做的原因是 localstore 的
265
+ `get_plugin_data_dir()` 会按调用栈反推插件名,本插件以子模块加载时会被算到
266
+ `.../services/` 子目录下,与用户预期的 cwd 相对路径不一致。
267
+
268
+ 首次启动时若目标目录为空,会自动从旧位置复制一次(旧目录保留,
269
+ 供手动确认后删除):插件根自带的 `data/L4D2/`、
270
+ `<cwd>/data/nonebot_plugin_l4d2_server/services/`。
271
+
272
+ `.env` 里可调的性能 / 行为字段:
273
+
274
+ ```dotenv
275
+ # A2S 性能
276
+ L4_A2S_CONCURRENCY=8 # 同时最多几台服务器在查(信号量上限)
277
+ L4_A2S_TIMEOUT=2.5 # 单次 ainfo / aplayers 超时秒
278
+ L4_A2S_CACHE_TTL=15 # 结果缓存秒;0=不缓存
279
+
280
+ # 组查询快扫(/云 这类整组查询专用)
281
+ L4_A2S_PROBE_TIMEOUT=1.0 # 首轮探测超时秒;0=关闭快扫,退回 L4_A2S_TIMEOUT
282
+ L4_A2S_PROBE_PASSES=2 # 探测轮数,每轮只重试上轮失败的服(1~3)
283
+ L4_A2S_PROBE_CONCURRENCY=16 # 探测阶段独立并发,不占用 L4_A2S_CONCURRENCY
284
+ L4_A2S_NEGATIVE_TTL=60 # 连不上的服记住这么久并跳过;0=关闭
285
+
286
+ # 订阅 / 巡检
287
+ L4_FAVORITE_CHECK_INTERVAL=300 # 收藏巡检间隔秒;0=关闭后台巡检,只在查服指令时请求
288
+ L4_FAVORITE_PLAYER_DELTA=5 # 玩家数变化超过此值才推送
289
+ L4_HISTORY_INTERVAL=3600 # 历史记录周期秒;0=关闭(热力图会没有数据)
290
+ L4_HISTORY_DEAD_RETRY_MAX=7200 # 离线服最长重试间隔秒,从上面的周期起翻倍封顶;0=不退避
291
+ L4_HISTORY_HOT_INTERVAL=300 # 热服加密采样周期秒;0=关闭
292
+ L4_HISTORY_HOT_WINDOW=7200 # 只加密采样这段时间内有过玩家的服;0=关闭
293
+
294
+ # 恢复提醒(群里查离线服时自动登记)
295
+ L4_WATCH_INTERVAL=180 # 复查周期秒;0=关闭功能(查离线服不再自动通知)
296
+ L4_WATCH_TTL=86400 # 登记有效期秒,超时还没恢复就丢弃;0=不过期
297
+ L4_WATCH_MAX=200 # 名单上限条数,超出丢最早的一条;0=不限
298
+
299
+ # 工坊
300
+ L4_WORKSHOP_CONCURRENCY=3 # 批量下载并发上限(1~8)
301
+
302
+ # 出图
303
+ L4_IMAGE_PAGE_SIZE=30 # 组查询每张图最多几台服,超出自动分多张发送(1~200)
304
+ L4_RENDER_TIMEOUT=15 # 单页出图超时秒;超时 / 渲染失败时改用简易图
305
+ L4_JPEG_QUALITY=82 # 列表 JPEG 质量(40~95);调低可减小体积、加快上传
306
+ L4_RENDER_CACHE_TTL=0 # 出图结果缓存秒;0=不缓存。开启后相同 HTML 直接复用图片,
307
+ # 配合 L4_A2S_CACHE_TTL 可让短时间内的重复查询几乎零耗时
308
+ L4_PLAYERS=4 # 卡片里最多显示几名玩家;减少可缩短卡片、加快出图
309
+ L4_NAME_STRIP_PATTERN='^Anne云服#\d+' # 列表里去掉的服务器名前缀(正则),默认只匹配 Anne 云服:Anne云服#57[普通药役] → [普通药役];留空不处理
310
+
311
+ # 屏蔽
312
+ L4_BLOCK_KEYWORDS='["广告", "外挂|cheat"]' # 关键词正则列表(不区分大小写),见下文「屏蔽与关键词」
313
+ L4_BLOCK_BUILTIN_WORDS=false # 启用内置中文敏感词库(约 2100 词,命中的词打码成 *,默认关闭)
314
+ ```
315
+
316
+ ## 屏蔽与关键词
317
+
318
+ ### 关键词过滤(已实现)
319
+
320
+ 在 `.env` 里用 JSON 列表配置正则,不区分大小写:
321
+
322
+ ```dotenv
323
+ L4_BLOCK_KEYWORDS='["广告", "外挂|cheat"]'
324
+ ```
325
+
326
+ - **服务器名命中**:整台服务器不出现在 `云` / `云全` / `l4全服` / `l4查找` / `l4查人` / `tj` / `zl` / `kl` 的结果里;`云5`、`connect <ip>` 这类单服查询只回「该服务器已被屏蔽」。
327
+ - **玩家名命中**:只隐藏这个玩家(列表卡片、单服查询、查人),服务器照常显示,人数仍按 A2S 上报;`tj` / `zl` / `kl` 的判断仍按真实玩家列表。
328
+ - 非法正则会记一条警告并跳过,不影响其它关键词。收藏推送和历史记录不受影响。
329
+
330
+ 过滤在 `services/blocklist.py`,接在 A2S 结果和输出之间。
331
+
332
+ ### 敏感词库(打码)
333
+
334
+ 和上面的关键词不同,敏感词库**只打码不隐藏**:服务器名、玩家名里命中的词替换成 `*`(如 `出售按摩棒` → `出售***`),服务器和玩家照常显示。几千到几万个词的词表难免混着常用词,打码比整台隐藏温和。
335
+
336
+ - **内置词库**:`.env` 设 `L4_BLOCK_BUILTIN_WORDS=true` 打开。收录 [konsheng/Sensitive-lexicon](https://github.com/konsheng/Sensitive-lexicon)(MIT)的政治、反动、暴恐、涉枪涉爆、色情、贪腐等 8 个分类,约 2100 个词,已删掉和 L4D2 用语、常见昵称冲突的词;来源、删改和没收录的分类见 `nonebot_plugin_l4d2_server/block_words/README.md`。
337
+ - **自定义词表**:把 `.txt` 放到 `<data_dir>/block_words/`(启动时自动创建),每行一个词,`#` 开头是注释,由管理员发 `l4刷新` 生效(该指令现需 SUPERUSER)。不管内置词库开没开都会加载。
338
+ - 少于 2 个字的词不加载;中文按子串匹配,纯字母数字的词(如 `xjp`)按整词匹配,不会误伤 `SirPlease` 这种英文名;全角字符按半角算。不在线服的占位名「服务器无响应」不打码。
339
+
340
+ > 同一仓库的 GFW补充词库、零时-Tencent 等大词表包含手枪、冲锋枪、炸弹、电击器、燃烧瓶、嗑药、服务器等 L4D2 常用词,直接放进 `block_words/` 会把正常的服务器名和玩家名打码,建议先删掉这些词再用。
341
+
342
+ ### 其它思路(未实现)
343
+
344
+ 1. **SourceBans 自动同步**:定时拉 SourceBans banlist 落到本地
345
+ `<data_dir>/blocklist.json`。注意 A2S 只返回玩家名,拿不到 SteamID,
346
+ 只能按名字匹配被封玩家。
347
+ 2. **本地 JSON 黑名单**:管理员 `l4黑名单 add <ip>` 写入
348
+ `<data_dir>/blocklist.json`;查询结果按黑名单过滤。
349
+ 3. **SourceMod HTTP 聊天镜像**:服务器装 SM 插件暴露 HTTP 接口,
350
+ 机器人拉聊天记录后正则匹配违规词,命中后通过 RCON 自动 kick。
351
+
352
+ 这几种如要实现,可以复用 `services/blocklist.py` 的过滤入口;
353
+ `consts.BLOCKLIST_FILENAME` 已预留给本地黑名单文件。
354
+
355
+ ## [数据结构](./docs/standand.md)
356
+
357
+ > 服务器组文件存放位置:`<data_dir>/<组名>.json`。
358
+ > `<data_dir>` 固定为 `<cwd>/data/nonebot_plugin_l4d2_server/`(见上文「数据目录」)。
359
+ > 旧版 `<data_dir>/l4d2/` 子目录与 `<data_dir>/l4d2.json` 单文件
360
+ > 都会在启动时自动迁移。
361
+
362
+ 收藏相关数据:
363
+
364
+ - `<data_dir>/favorites.json` — 收藏条目列表
365
+ - `<data_dir>/notify_state.json` — 上次推送状态(避免抖动刷屏)
366
+
367
+ ## env 设置
368
+
369
+ 全部字段定义在 `nonebot_plugin_l4d2_server/config.py` 的 `ConfigModel`,
370
+ 在 `.env` / `.env.dev` / `.env.prod` 里用 `L4_*` 大写覆盖。上面的「数据目录」
371
+ 一节有带注释的示例;下面是完整清单。
372
+
373
+ ### 行为开关
374
+
375
+ | 字段 | 默认 | 说明 |
376
+ |---|---|---|
377
+ | `L4_ENABLE` | `true` | 总开关。`false` 时所有指令在规则层被拦截(仍注册但不响应),改了立即生效 |
378
+ | `L4_IMAGE` | `true` | 关掉后 `l4help` / `云` / `云1` 全部走纯文字 |
379
+ | `L4_CONNECT` | `true` | 查服回复末尾是否追加 `connect host:port` |
380
+ | `L4_SHOW_IP` | `true` | 单服卡片底部是否画 `host:port` |
381
+ | `L4_PLAYERS` | `4` | 单服卡片最多显示几名玩家 |
382
+ | `L4_STYLE` | `"default"` | 组卡片模板,`default` 或 `old` |
383
+ | `L4_FONT` | `""` | PIL 字体路径;空则用包内 `render/fonts/loli.ttf`。路径不存在只 warning 回退 |
384
+ | `L4_PERMISSION` | `1` | `l4本地上传` / `l4本地改名` / `l4本地删除` / `l4创意工坊` 的最低权限位(1=SUPERUSER … 4=群员) |
385
+ | `L4_LOCAL` | `[]` | 本地 L4D2 服务器路径列表(JSON 数组) |
386
+ | `L4_MAP_INDEX` | `0` | `L4_LOCAL` 里操作第几个服务器 |
387
+
388
+ ### 查询 / 提醒
389
+
390
+ | 字段 | 默认 | 说明 |
391
+ |---|---|---|
392
+ | `L4_WATCH_INTERVAL` | `180` | 恢复提醒复查周期秒;0=关闭。群里查一台离线服时登记,恢复后 @ 当时查询的人 |
393
+ | `L4_WATCH_TTL` | `86400` | 登记有效期秒,超时还没恢复就丢弃,避免永久死服占名单;0=不过期 |
394
+ | `L4_WATCH_MAX` | `200` | 名单上限条数,超出丢最早一条;0=不限 |
395
+
396
+ ### 出图
397
+
398
+ | 字段 | 默认 | 说明 |
399
+ |---|---|---|
400
+ | `L4_IMAGE_PAGE_SIZE` | `30` | 组查询每张图最多几台服,超出自动分多张(1~200) |
401
+ | `L4_IMAGE_MAX_SERVERS` | `0` | 组内服数超过此值时不出图、只回文字提示;0=不限 |
402
+ | `L4_RENDER_TIMEOUT` | `15` | 单页出图超时秒,超时改用简易图 |
403
+ | `L4_JPEG_QUALITY` | `82` | 列表 JPEG 质量(40~95) |
404
+ | `L4_RENDER_CACHE_TTL` | `0` | 出图结果缓存秒;0=不缓存 |
405
+ | `L4_NAME_STRIP_PATTERN` | `'^Anne云服#\d+'` | 列表里去掉的服务器名前缀(正则),留空不处理 |
406
+
407
+ ### 屏蔽
408
+
409
+ | 字段 | 默认 | 说明 |
410
+ |---|---|---|
411
+ | `L4_BLOCK_KEYWORDS` | `[]` | 关键词正则列表,命中的服务器整台隐藏、玩家只隐藏本人 |
412
+ | `L4_BLOCK_BUILTIN_WORDS` | `false` | 启用内置中文敏感词库(约 2100 词,只打码不隐藏) |
413
+
414
+ ### 性能 / 巡检
415
+
416
+ 见上文「数据目录」里的 dotenv 示例,共 10 项:`L4_A2S_CONCURRENCY`、
417
+ `L4_A2S_TIMEOUT`、`L4_A2S_CACHE_TTL`、`L4_A2S_PROBE_TIMEOUT`、
418
+ `L4_A2S_PROBE_PASSES`、`L4_A2S_PROBE_CONCURRENCY`、`L4_A2S_NEGATIVE_TTL`、
419
+ `L4_FAVORITE_CHECK_INTERVAL`、`L4_FAVORITE_PLAYER_DELTA`、
420
+ `L4_WORKSHOP_CONCURRENCY`;以及历史记录的 5 项 `L4_HISTORY_INTERVAL`、
421
+ `L4_HISTORY_RETENTION_DAYS`(默认 `30`,每天 04:00 清理更早的记录)、
422
+ `L4_HISTORY_DEAD_RETRY_MAX`、`L4_HISTORY_HOT_INTERVAL`、`L4_HISTORY_HOT_WINDOW`;
423
+ 恢复提醒的 3 项 `L4_WATCH_INTERVAL`、`L4_WATCH_TTL`、`L4_WATCH_MAX`
424
+ (见上一节表格)。
425
+
426
+ ## 和 0.x.x 更改部分
427
+
428
+ - **服务器组指令(`云`、`云1` 等)规则层拒绝非数字后缀**:之前输入 `云云` 会被解析为「组 `云` + args=`云`」然后静默退出,现在直接在 nonebot 规则层拒绝,不会进入 handler,也不会被本插件拦截后续处理。`云1` / `云12` 仍正常触发单服查询;
429
+ - **单服务器查询(`云1`)合并图片与 `connect host:port` 文本**:图片和 `connect host:port` 文本作为一条合并消息发出(受 `l4_connect` 配置控制),方便直接点链接加入服务器;
430
+ - **单服务器卡(`云1`)长内容自动换行**:服务器名、地图名、connect IP 等超出 380px 卡片宽度时,会按像素宽度自动换行展示,图片高度随行数自动撑高;
431
+ - **服务器列表(`云`)地图名溢出处理**:`.map-name` CSS 增加 `text-overflow: ellipsis`,超长地图名以省略号截断,不再撑破卡片;
432
+ - **查服背景图按渲染类型拆分目录**(后续调整):`/云`(服务器列表)从 `<data_dir>/custom_backgrounds/` 根目录的所有图片中随机抽一张,目录为空时回退到内置 `background.jpg`;`/云1`(单服务器卡)固定使用深蓝灰纯色,不加载任何图片。详见「自定义服务器列表背景图片」;
433
+ - **数据路径统一由 `services/path_resolver.py` 决定**:组文件、sb_pages、自定义背景图、迁移脚本都从 `<cwd>/data/nonebot_plugin_l4d2_server/` 派生,不再各自写死相对路径。`l4_path` 配置项已移除(设了也不生效)。
434
+
435
+ ## v1.4.2 相对 v1.4.1 的变化
436
+
437
+ - **安全修复**:`l4删除组` / `l4删除页` / `l4导出组` / `l4添加组` / `l4刷新组`
438
+ 等服务器组维护指令补上 **SUPERUSER** 鉴权(此前任意群成员都能删掉整个组)。
439
+ - **修复管理指令全部失效**:部署方 `.env` 里的 `SUPERUSER=[...]`(单数)是错的,
440
+ NoneBot 2.x 只认 `SUPERUSERS`(复数,且 QQ 号要写成字符串)。配置拼写修正后,
441
+ 原先依赖 `permission=SUPERUSER` 的指令才真正生效;历史查询类指令改为全员可用。
442
+ - **查询提速**:整组查询(如 `/云`)改两轮短超时快扫 + 离线负缓存,67 台组冷查询
443
+ 5.7-7.7s → 2.2-2.6s;`tj` / `zl` / `kl` 筛选改整组一次批量查询。
444
+ - **出图修复**:查服列表背景不再横向平铺成三份;fontconfig 字体配置随包发布,
445
+ 中英数字体统一;出图栈改用 nonebot-plugin-htmlkit(litehtml),不再需要 Playwright。
446
+ 服务器需要 glibc ≥ 2.34 并装好中文字体(如 `fonts-noto-cjk`)。
447
+ - **历史数据新用途**:`l4趋势 <组> [天数]` 画整组在线人数折线图,
448
+ `l4热力图 <组> [天数]` 输出 7×24 色块热力图(均为 PIL 图片),
449
+ `l4热门地图 [组] [天数]` 按组内地图使用热度排行。
450
+ - **服务器恢复提醒**:群里查一台离线服会登记,默认每 3 分钟复查,恢复后 @ 当时
451
+ 查询的人(只提醒恢复,不做掉线告警)。可用 `L4_WATCH_INTERVAL` / `L4_WATCH_TTL`
452
+ / `L4_WATCH_MAX` 调整。
453
+ - **历史巡检优化**:周期默认 300s → 3600s,离线服指数退避,有人的服额外加密采样
454
+ (`L4_HISTORY_HOT_INTERVAL`),热力图有人时段每小时 12 个样本。
455
+
456
+ ## v1.4.0 相对 v1.3.x 的变化
457
+
458
+ - **数据目录**:固定为 `<cwd>/data/nonebot_plugin_l4d2_server/`,由
459
+ `services/path_resolver.py` 直接拼接,不依赖 `nonebot-plugin-localstore`
460
+ (v1.4.0 曾有 `L4_USE_LOCALSTORE` / `L4_LOCALSTORE_SUBDIR`,现已移除)。
461
+ - **A2S 性能**:批量查询加 `asyncio.Semaphore` 上限
462
+ (`l4_a2s_concurrency`),单次超时可配(`l4_a2s_timeout`),
463
+ 结果缓存 `l4_a2s_cache_ttl` 秒(deepcopy 防止下游 mutate);
464
+ SourceBans `refresh_all_pages` 改并发。
465
+ - **收藏 / 订阅**:新增 `l4收藏` / `l4取关` / `l4收藏列表` /
466
+ `l4通知目标`;scheduler 周期巡检(`l4_favorite_check_interval`),
467
+ 上线 / 离线 / 玩家数突变时按群推送。
468
+ - **单服 CRUD**:新增 `l4添加服务器` / `l4删除服务器` / `l4修改服务器` /
469
+ `l4查看组`,ID 稳定不再重排。
470
+ - **创意工坊批量**:`l4创意工坊 123,456 789` 并发下载
471
+ (`l4_workshop_concurrency`),流式写入 + 进度回报。
472
+ - **`tj` / `zl` / `kl` 注册时序 bug**:改为在 `_on_startup` 内调用
473
+ `register_picker_handlers()`,避免导入时 `registry.commands` 还没填。
474
+ - **统一异常类型**:`services/errors.py` 提供 `L4Error` / `L4ServerUnreachableError` /
475
+ `L4TimeoutError` / `L4InvalidInputError` / `L4NotFoundError` / `L4HTTPError`,
476
+ 后续 handler 收敛 `except L4Error`。
477
+ - **`http_helpers.save_url_to_file` dead code** 修复;
478
+ 新增 `stream_download` 流式下载接口。
479
+ - **`http_helpers.STREAM_CHUNK_SIZE` / `STREAM_TIMEOUT`** 新常量。
480
+
481
+ ## 其他
482
+
483
+ - anne 部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过 core 插件调用
484
+ - 如果您有发现 BUG 或者更好的建议,欢迎提 Issue & Pr
485
+ - 如果本插件对你有帮助,不要忘了点个 Star~
486
+ - 本项目仅供学习使用,请勿用于商业用途
487
+ - [更新日志](./docs/update.md)
488
+ - [GPL-3.0 License](https://github.com/Agnes4m/nonebot_plugin_l4d2_server/blob/main/LICENSE) ©[@Agnes4m](https://github.com/Agnes4m)
489
+
490
+ ## 🌐 感谢
491
+
492
+ - [nonebot2](https://github.com/nonebot/nonebot2)- 聊天机器人的基础框架
493
+ - [饼干](https://github.com/lgc2333) - 指导 nonebot2 框架的函数使用
494
+ - [wuyi](https://github.com/KimigaiiWuyi/) - 指导 pil 作图
495
+
496
+ - 感谢以下服主大力支持
497
+ - Michaela's | 机器人功能测试反馈
498
+ - 东 | 提供 docker 部署方法等建议 | [电信服 anne 游戏群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=6i7r5aJ7Jyg0ejby4rt9GWmFRF53nV1K&authKey=ekMsWepBZPL26%2BfJAG%2F95JD0fhvH39%2BIGVyKOvNlXVDbpIclJlly4kXqukL7JhWR&noverify=0&group_code=883237206)
499
+ - 迷茫 | 催命更新 byd
500
+ - ArcPav | 积极反馈 bug,提供改进思路