mirror of
				https://github.com/suyiiyii/nonebot-bison.git
				synced 2025-11-04 21:44:52 +08:00 
			
		
		
		
	🚚 修改 nonebot_bison 项目结构 (#211)
* 🎨 修改 nonebot_bison 目录位置 * auto fix by pre-commit hooks * 🚚 fix frontend build target * 🚚 use soft link * Revert "🚚 use soft link" This reverts commit de21f79d5ae1bd5515b04f42a4138cb25ddf3e62. * 🚚 modify dockerfile --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: felinae98 <731499577@qq.com>
This commit is contained in:
		
							parent
							
								
									3082587662
								
							
						
					
					
						commit
						90816796c7
					
				
							
								
								
									
										18
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
*.ini
 | 
			
		||||
*.yaml
 | 
			
		||||
*.yml
 | 
			
		||||
*.md
 | 
			
		||||
*.json
 | 
			
		||||
*.toml
 | 
			
		||||
*.xml
 | 
			
		||||
tests
 | 
			
		||||
node_modules
 | 
			
		||||
admin-frontend
 | 
			
		||||
data*
 | 
			
		||||
htmlcov
 | 
			
		||||
docker
 | 
			
		||||
dist
 | 
			
		||||
docs
 | 
			
		||||
.*
 | 
			
		||||
 | 
			
		||||
!pyproject.toml
 | 
			
		||||
@ -29,7 +29,7 @@
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "start": "react-scripts start",
 | 
			
		||||
    "build": "react-scripts build && cp -r -f build/* ../src/plugins/nonebot_bison/admin_page/dist",
 | 
			
		||||
    "build": "react-scripts build && cp -r -f build/* ../nonebot_bison/admin_page/dist",
 | 
			
		||||
    "test": "react-scripts test",
 | 
			
		||||
    "eject": "react-scripts eject",
 | 
			
		||||
    "lint": "eslint --fix src/**/*.ts src/**/*.tsx"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								bot.py
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								bot.py
									
									
									
									
									
								
							@ -1,3 +1,5 @@
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
 | 
			
		||||
import nonebot
 | 
			
		||||
from nonebot.adapters.onebot.v11 import Adapter as OneBotV11Adapter
 | 
			
		||||
 | 
			
		||||
@ -9,7 +11,8 @@ driver.register_adapter(OneBotV11Adapter)
 | 
			
		||||
 | 
			
		||||
nonebot.load_builtin_plugins("echo")
 | 
			
		||||
# nonebot.load_plugin("nonebot_plugin_help")
 | 
			
		||||
nonebot.load_plugins("src/plugins")
 | 
			
		||||
nonebot.load_plugin(Path(__file__).parent / "nonebot_bison")
 | 
			
		||||
nonebot.load_plugins("extra_plugins")
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    nonebot.run()
 | 
			
		||||
 | 
			
		||||
@ -41,8 +41,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
 | 
			
		||||
 | 
			
		||||
COPY --from=builder /runtime /usr/local
 | 
			
		||||
RUN playwright install chromium
 | 
			
		||||
ADD src /app/src
 | 
			
		||||
ADD bot.py /app/
 | 
			
		||||
ADD . /app/
 | 
			
		||||
RUN echo 'DATASTORE_DATA_DIR=/data' > .env
 | 
			
		||||
ENV HOST=0.0.0.0
 | 
			
		||||
CMD ["python", "bot.py"]
 | 
			
		||||
 | 
			
		||||
@ -41,8 +41,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
 | 
			
		||||
 | 
			
		||||
COPY --from=builder /runtime /usr/local
 | 
			
		||||
RUN playwright install chromium
 | 
			
		||||
ADD src /app/src
 | 
			
		||||
ADD bot.py /app/
 | 
			
		||||
ADD . /app/
 | 
			
		||||
RUN echo 'DATASTORE_DATA_DIR=/data' > .env && sed '/nonebot.load_builtin_plugins("echo")/a nonebot.load_plugin("nonebot_plugin_sentry")' -i bot.py
 | 
			
		||||
ENV HOST=0.0.0.0
 | 
			
		||||
CMD ["python", "bot.py"]
 | 
			
		||||
 | 
			
		||||
@ -7,8 +7,7 @@ license = "MIT"
 | 
			
		||||
homepage = "https://github.com/felinae98/nonebot-bison"
 | 
			
		||||
keywords = ["nonebot", "nonebot2", "qqbot"]
 | 
			
		||||
readme = "README.md"
 | 
			
		||||
packages = [{ include = "nonebot_bison", from = "./src/plugins/" }]
 | 
			
		||||
include = ["src/plugins/nonebot_bison/admin_page/dist/**/*"]
 | 
			
		||||
include = ["nonebot_bison/admin_page/dist/**/*"]
 | 
			
		||||
classifiers = [
 | 
			
		||||
  "Development Status :: 4 - Beta",
 | 
			
		||||
  "Operating System :: POSIX :: Linux",
 | 
			
		||||
@ -76,15 +75,8 @@ line_length = 88
 | 
			
		||||
skip_gitignore = true
 | 
			
		||||
 | 
			
		||||
[tool.nonebot]
 | 
			
		||||
plugins = ["src.plugins.nonebot_bison"]
 | 
			
		||||
plugins = ["nonebot_bison"]
 | 
			
		||||
 | 
			
		||||
[tool.pyright]
 | 
			
		||||
pythonVersion = "3.10"
 | 
			
		||||
pythonPlatform = "All"
 | 
			
		||||
executionEnvironments = [
 | 
			
		||||
  { root = "./tests", extraPaths = [
 | 
			
		||||
    "./",
 | 
			
		||||
    "./src/plugins/",
 | 
			
		||||
  ] },
 | 
			
		||||
  { root = "./" },
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@ -3,13 +3,14 @@ from nonebug.app import App
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def test_add_subscribe(app: App, init_scheduler):
 | 
			
		||||
    from nonebot_bison.config.db_config import config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target, User
 | 
			
		||||
    from nonebot_bison.types import Target as TTarget
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
    from sqlalchemy.ext.asyncio.session import AsyncSession
 | 
			
		||||
    from sqlalchemy.sql.expression import select
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config.db_config import config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target, User
 | 
			
		||||
    from nonebot_bison.types import Target as TTarget
 | 
			
		||||
 | 
			
		||||
    await config.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
        user_type="group",
 | 
			
		||||
@ -98,14 +99,15 @@ async def test_add_dup_sub(init_scheduler):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def test_del_subsribe(init_scheduler):
 | 
			
		||||
    from nonebot_bison.config.db_config import config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target
 | 
			
		||||
    from nonebot_bison.types import Target as TTarget
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
    from sqlalchemy.ext.asyncio.session import AsyncSession
 | 
			
		||||
    from sqlalchemy.sql.expression import select
 | 
			
		||||
    from sqlalchemy.sql.functions import func
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config.db_config import config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target
 | 
			
		||||
    from nonebot_bison.types import Target as TTarget
 | 
			
		||||
 | 
			
		||||
    await config.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
        user_type="group",
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,8 @@
 | 
			
		||||
async def test_migration(use_legacy_config):
 | 
			
		||||
    from nonebot_plugin_datastore.db import init_db
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config.config_legacy import config as config_legacy
 | 
			
		||||
    from nonebot_bison.config.db_config import config
 | 
			
		||||
    from nonebot_plugin_datastore.db import init_db
 | 
			
		||||
 | 
			
		||||
    config_legacy.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
@ -54,9 +55,10 @@ async def test_migration(use_legacy_config):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def test_migrate_dup(use_legacy_config):
 | 
			
		||||
    from nonebot_plugin_datastore.db import init_db
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config.config_legacy import config as config_legacy
 | 
			
		||||
    from nonebot_bison.config.db_config import config
 | 
			
		||||
    from nonebot_plugin_datastore.db import init_db
 | 
			
		||||
 | 
			
		||||
    config_legacy.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
 | 
			
		||||
@ -5,10 +5,11 @@ from pytest_mock import MockerFixture
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def test_create_config(init_scheduler):
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config.db_config import TimeWeightConfig, WeightConfig, config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target, User
 | 
			
		||||
    from nonebot_bison.types import Target as T_Target
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
 | 
			
		||||
    await config.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
@ -56,11 +57,12 @@ async def test_create_config(init_scheduler):
 | 
			
		||||
async def test_get_current_weight(init_scheduler, mocker: MockerFixture):
 | 
			
		||||
    from datetime import time
 | 
			
		||||
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import db_config
 | 
			
		||||
    from nonebot_bison.config.db_config import TimeWeightConfig, WeightConfig, config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target, User
 | 
			
		||||
    from nonebot_bison.types import Target as T_Target
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
 | 
			
		||||
    await config.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
@ -121,13 +123,14 @@ async def test_get_current_weight(init_scheduler, mocker: MockerFixture):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def test_get_platform_target(app: App, init_scheduler):
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
    from sqlalchemy.ext.asyncio.session import AsyncSession
 | 
			
		||||
    from sqlalchemy.sql.expression import select
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import db_config
 | 
			
		||||
    from nonebot_bison.config.db_config import TimeWeightConfig, WeightConfig, config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target, User
 | 
			
		||||
    from nonebot_bison.types import Target as T_Target
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
    from sqlalchemy.ext.asyncio.session import AsyncSession
 | 
			
		||||
    from sqlalchemy.sql.expression import select
 | 
			
		||||
 | 
			
		||||
    await config.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
@ -171,15 +174,16 @@ async def test_get_platform_target(app: App, init_scheduler):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def test_get_platform_target_subscribers(app: App, init_scheduler):
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
    from sqlalchemy.ext.asyncio.session import AsyncSession
 | 
			
		||||
    from sqlalchemy.sql.expression import select
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import db_config
 | 
			
		||||
    from nonebot_bison.config.db_config import TimeWeightConfig, WeightConfig, config
 | 
			
		||||
    from nonebot_bison.config.db_model import Subscribe, Target, User
 | 
			
		||||
    from nonebot_bison.types import Target as T_Target
 | 
			
		||||
    from nonebot_bison.types import User as T_User
 | 
			
		||||
    from nonebot_bison.types import UserSubInfo
 | 
			
		||||
    from nonebot_plugin_datastore.db import get_engine
 | 
			
		||||
    from sqlalchemy.ext.asyncio.session import AsyncSession
 | 
			
		||||
    from sqlalchemy.sql.expression import select
 | 
			
		||||
 | 
			
		||||
    await config.add_subscribe(
 | 
			
		||||
        user=123,
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,10 @@ async def app(tmp_path: Path, request: pytest.FixtureRequest, mocker: MockerFixt
 | 
			
		||||
    sys.path.append(str(Path(__file__).parent.parent / "src" / "plugins"))
 | 
			
		||||
 | 
			
		||||
    nonebot.require("nonebot_bison")
 | 
			
		||||
    from nonebot_plugin_datastore.config import plugin_config as datastore_config
 | 
			
		||||
    from nonebot_plugin_datastore.db import create_session, init_db
 | 
			
		||||
    from nonebot_plugin_htmlrender.browser import shutdown_browser
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison import plugin_config
 | 
			
		||||
    from nonebot_bison.config.db_model import (
 | 
			
		||||
        ScheduleTimeWeight,
 | 
			
		||||
@ -31,9 +35,6 @@ async def app(tmp_path: Path, request: pytest.FixtureRequest, mocker: MockerFixt
 | 
			
		||||
        Target,
 | 
			
		||||
        User,
 | 
			
		||||
    )
 | 
			
		||||
    from nonebot_plugin_datastore.config import plugin_config as datastore_config
 | 
			
		||||
    from nonebot_plugin_datastore.db import create_session, init_db
 | 
			
		||||
    from nonebot_plugin_htmlrender.browser import shutdown_browser
 | 
			
		||||
 | 
			
		||||
    plugin_config.bison_config_path = str(tmp_path / "legacy_config")
 | 
			
		||||
    plugin_config.bison_filter_log = False
 | 
			
		||||
@ -82,6 +83,7 @@ async def init_scheduler(app: App):
 | 
			
		||||
@pytest.fixture
 | 
			
		||||
async def use_legacy_config(app: App):
 | 
			
		||||
    import aiofiles
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config.config_legacy import config, get_config_path
 | 
			
		||||
 | 
			
		||||
    async with aiofiles.open(get_config_path()[0], "w") as f:
 | 
			
		||||
 | 
			
		||||
@ -13,6 +13,7 @@ from .utils import BotReply, fake_admin_user, fake_group_message_event
 | 
			
		||||
async def test_abort_add_on_platform(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
 | 
			
		||||
@ -60,6 +61,7 @@ async def test_abort_add_on_platform(app: App, init_scheduler):
 | 
			
		||||
async def test_abort_add_on_id(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
    from nonebot_bison.platform.weibo import Weibo
 | 
			
		||||
@ -117,6 +119,7 @@ async def test_abort_add_on_id(app: App, init_scheduler):
 | 
			
		||||
async def test_abort_add_on_cats(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
    from nonebot_bison.platform.weibo import Weibo
 | 
			
		||||
@ -194,6 +197,7 @@ async def test_abort_add_on_cats(app: App, init_scheduler):
 | 
			
		||||
async def test_abort_add_on_tag(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
    from nonebot_bison.platform.weibo import Weibo
 | 
			
		||||
@ -275,6 +279,7 @@ async def test_abort_add_on_tag(app: App, init_scheduler):
 | 
			
		||||
async def test_abort_del_sub(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import del_sub_matcher
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,7 @@ from .utils import BotReply, fake_admin_user, fake_group_message_event
 | 
			
		||||
async def test_configurable_at_me_true_failed(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher
 | 
			
		||||
    from nonebot_bison.plugin_config import plugin_config
 | 
			
		||||
 | 
			
		||||
@ -37,6 +38,7 @@ async def test_configurable_at_me_true_failed(app: App):
 | 
			
		||||
async def test_configurable_at_me_false(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
    from nonebot_bison.plugin_config import plugin_config
 | 
			
		||||
@ -62,6 +64,7 @@ async def test_configurable_at_me_false(app: App):
 | 
			
		||||
async def test_add_with_target(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
@ -185,6 +188,7 @@ async def test_add_with_target(app: App, init_scheduler):
 | 
			
		||||
async def test_add_with_target_no_cat(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
@ -244,6 +248,7 @@ async def test_add_with_target_no_cat(app: App, init_scheduler):
 | 
			
		||||
async def test_add_no_target(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
@ -293,6 +298,7 @@ async def test_add_no_target(app: App, init_scheduler):
 | 
			
		||||
async def test_platform_name_err(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
 | 
			
		||||
@ -328,6 +334,7 @@ async def test_platform_name_err(app: App):
 | 
			
		||||
async def test_add_with_get_id(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message, MessageSegment
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
@ -409,6 +416,7 @@ async def test_add_with_get_id(app: App):
 | 
			
		||||
async def test_add_with_bilibili_target_parser(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.event import Sender
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import add_sub_matcher, common_platform
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,7 @@ from .utils import fake_group_message_event, fake_private_message_event, fake_su
 | 
			
		||||
async def test_query_with_superuser_private(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import group_manage_matcher
 | 
			
		||||
 | 
			
		||||
    async with app.test_matcher(group_manage_matcher) as ctx:
 | 
			
		||||
@ -70,6 +71,7 @@ async def test_query_with_superuser_private(app: App):
 | 
			
		||||
async def test_query_with_abort_on_idx(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import group_manage_matcher
 | 
			
		||||
 | 
			
		||||
    async with app.test_matcher(group_manage_matcher) as ctx:
 | 
			
		||||
@ -105,6 +107,7 @@ async def test_query_with_abort_on_idx(app: App):
 | 
			
		||||
async def test_query_with_abort_on_command(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import group_manage_matcher
 | 
			
		||||
 | 
			
		||||
    async with app.test_matcher(group_manage_matcher) as ctx:
 | 
			
		||||
@ -149,6 +152,7 @@ async def test_query_with_abort_on_command(app: App):
 | 
			
		||||
async def test_query_with_superuser_group_tome(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config_manager import group_manage_matcher
 | 
			
		||||
 | 
			
		||||
    async with app.test_matcher(group_manage_matcher) as ctx:
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@ from .utils import fake_admin_user, fake_group_message_event
 | 
			
		||||
@pytest.mark.asyncio
 | 
			
		||||
async def test_query_sub(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import query_sub_matcher
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
@ -39,6 +40,7 @@ async def test_query_sub(app: App, init_scheduler):
 | 
			
		||||
async def test_del_sub(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import del_sub_matcher
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
@ -89,6 +91,7 @@ async def test_del_sub(app: App, init_scheduler):
 | 
			
		||||
async def test_del_empty_sub(app: App, init_scheduler):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.config import config
 | 
			
		||||
    from nonebot_bison.config_manager import del_sub_matcher
 | 
			
		||||
    from nonebot_bison.platform import platform_manager
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@ async def test_get_bots(app: App) -> None:
 | 
			
		||||
    from nonebot import get_driver
 | 
			
		||||
    from nonebot.adapters.onebot.v11 import Bot as BotV11
 | 
			
		||||
    from nonebot.adapters.onebot.v12 import Bot as BotV12
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.utils.get_bot import get_bots
 | 
			
		||||
 | 
			
		||||
    async with app.test_api() as ctx:
 | 
			
		||||
@ -31,6 +32,7 @@ async def test_refresh_bots(app: App) -> None:
 | 
			
		||||
    from nonebot import get_driver
 | 
			
		||||
    from nonebot.adapters.onebot.v11 import Bot as BotV11
 | 
			
		||||
    from nonebot.adapters.onebot.v12 import Bot as BotV12
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.types import User
 | 
			
		||||
    from nonebot_bison.utils.get_bot import get_bot, get_groups, refresh_bots
 | 
			
		||||
 | 
			
		||||
@ -66,6 +68,7 @@ async def test_get_bot_two_bots(app: App) -> None:
 | 
			
		||||
    from nonebot import get_driver
 | 
			
		||||
    from nonebot.adapters.onebot.v11 import Bot as BotV11
 | 
			
		||||
    from nonebot.adapters.onebot.v12 import Bot as BotV12
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.types import User
 | 
			
		||||
    from nonebot_bison.utils.get_bot import get_bot, get_groups, refresh_bots
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,7 @@ if typing.TYPE_CHECKING:
 | 
			
		||||
async def test_send_no_queue(app: App, mocker: MockerFixture):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.plugin_config import plugin_config
 | 
			
		||||
    from nonebot_bison.send import send_msgs
 | 
			
		||||
 | 
			
		||||
@ -40,6 +41,7 @@ async def test_send_queue(app: App, mocker: MockerFixture):
 | 
			
		||||
    import nonebot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message, MessageSegment
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison import send
 | 
			
		||||
    from nonebot_bison.plugin_config import plugin_config
 | 
			
		||||
    from nonebot_bison.send import MESSGE_SEND_INTERVAL, do_send_msgs, send_msgs
 | 
			
		||||
@ -84,6 +86,7 @@ def _merge_messge(nodes):
 | 
			
		||||
async def test_send_merge_no_queue(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message, MessageSegment
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.plugin_config import plugin_config
 | 
			
		||||
    from nonebot_bison.send import send_msgs
 | 
			
		||||
 | 
			
		||||
@ -187,6 +190,7 @@ async def test_send_merge_no_queue(app: App):
 | 
			
		||||
async def test_send_merge2_no_queue(app: App):
 | 
			
		||||
    from nonebot.adapters.onebot.v11.bot import Bot
 | 
			
		||||
    from nonebot.adapters.onebot.v11.message import Message, MessageSegment
 | 
			
		||||
 | 
			
		||||
    from nonebot_bison.plugin_config import plugin_config
 | 
			
		||||
    from nonebot_bison.send import send_msgs
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user