Skip to content

Commit

Permalink
Revert "调整 user 命令展示的内容"
Browse files Browse the repository at this point in the history
This reverts commit 2952a84.
  • Loading branch information
he0119 committed Oct 6, 2023
1 parent 72b9664 commit 4e3712d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
8 changes: 3 additions & 5 deletions nonebot_plugin_user/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
)
from nonebot_plugin_session import SessionLevel

from . import migrations
from .annotated import UserSession as UserSession
from .utils import get_user, remove_bind, set_bind

Expand All @@ -36,7 +35,6 @@
supported_adapters=inherit_supported_adapters(
"nonebot_plugin_alconna", "nonebot_plugin_session", "nonebot_plugin_userinfo"
),
extra={"orm_version_location": migrations},
)

user_cmd = on_alconna(Alconna("user"), use_cmd_start=True)
Expand All @@ -47,11 +45,11 @@ async def _(session: UserSession):
await user_cmd.finish(
"\n".join(
[
f"平台:{session.platform}",
f"平台 ID:{session.pid}",
f"用户 ID:{session.uid}",
f"用户名:{session.name}",
f"创建日期:{session.created_at.strftime('%Y-%m-%d %H:%M:%S')}",
f"用户创建日期:{session.created_at.strftime('%Y-%m-%d %H:%M:%S')}",
f"用户所在平台 ID:{session.pid}",
f"用户所在平台:{session.platform}",
]
)
)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ expiringdict = "^1.2.2"
nb-cli = "^1.0.4"
nonebot-adapter-onebot = "^2.2.3"
nonebot-adapter-red = "^0.5.1"
nonebot-plugin-orm = {extras = ["default"], version = "^0.1.0"}
nonebot-plugin-orm = { extras = ["default"], version = "^0.1.0" }

[tool.poetry.group.test.dependencies]
nonebug = "^0.3.1"
Expand Down Expand Up @@ -55,8 +55,8 @@ ignore = ["E402", "E501", "C901", "UP037"]
[tool.nonebot]
adapters = [
{ name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" },
{ name = "OneBot V12", module_name = "nonebot.adapters.onebot.v12" },
{ name = "RedProtocol", module_name = "nonebot.adapters.red" },
{ name = "OneBot V12", module_name = "nonebot.adapters.onebot.v12" },
]
plugins = ["nonebot_plugin_user"]

Expand Down
16 changes: 8 additions & 8 deletions tests/test_bind_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def test_bind_group(app: App, patch_current_time, mocker: MockerFixture):
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -53,7 +53,7 @@ async def test_bind_group(app: App, patch_current_time, mocker: MockerFixture):
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:2\n用户名:nickname10\n创建日期:2023-09-14 10:46:10",
"用户 ID:2\n用户名:nickname10\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand Down Expand Up @@ -105,7 +105,7 @@ async def test_bind_group(app: App, patch_current_time, mocker: MockerFixture):
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -118,7 +118,7 @@ async def test_bind_group(app: App, patch_current_time, mocker: MockerFixture):
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand Down Expand Up @@ -151,7 +151,7 @@ async def test_bind_group_different_user(
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -173,7 +173,7 @@ async def test_bind_group_different_user(
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:2\n用户名:nickname10\n创建日期:2023-09-14 10:46:10",
"用户 ID:2\n用户名:nickname10\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand Down Expand Up @@ -225,7 +225,7 @@ async def test_bind_group_different_user(
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -238,7 +238,7 @@ async def test_bind_group_different_user(
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:2\n用户名:nickname10\n创建日期:2023-09-14 10:46:10",
"用户 ID:2\n用户名:nickname10\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
16 changes: 8 additions & 8 deletions tests/test_bind_private.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def test_bind_private(app: App, patch_current_time, mocker: MockerFixture)
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -51,7 +51,7 @@ async def test_bind_private(app: App, patch_current_time, mocker: MockerFixture)
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:2\n用户名:nickname10\n创建日期:2023-09-14 10:46:10",
"用户 ID:2\n用户名:nickname10\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand Down Expand Up @@ -88,7 +88,7 @@ async def test_bind_private(app: App, patch_current_time, mocker: MockerFixture)
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -101,7 +101,7 @@ async def test_bind_private(app: App, patch_current_time, mocker: MockerFixture)
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand Down Expand Up @@ -133,7 +133,7 @@ async def test_bind_private_invalid_token(
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -154,7 +154,7 @@ async def test_bind_private_invalid_token(
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:2\n用户名:nickname10\n创建日期:2023-09-14 10:46:10",
"用户 ID:2\n用户名:nickname10\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand Down Expand Up @@ -191,7 +191,7 @@ async def test_bind_private_invalid_token(
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:1\n用户 ID:1\n用户名:nickname1\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname1\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:1\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -204,7 +204,7 @@ async def test_bind_private_invalid_token(
ctx.receive_event(bot, event)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:2\n用户名:nickname10\n创建日期:2023-09-14 10:46:10",
"用户 ID:2\n用户名:nickname10\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
4 changes: 2 additions & 2 deletions tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def test_user(app: App, patch_current_time):
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:1\n用户名:nickname\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)
Expand All @@ -48,7 +48,7 @@ async def test_user(app: App, patch_current_time):
)
ctx.should_call_send(
event,
"平台:qq\n平台 ID:10\n用户 ID:1\n用户名:nickname\n创建日期:2023-09-14 10:46:10",
"用户 ID:1\n用户名:nickname\n用户创建日期:2023-09-14 10:46:10\n用户所在平台 ID:10\n用户所在平台:qq",
True,
)
ctx.should_finished(user_cmd)

0 comments on commit 4e3712d

Please sign in to comment.