Skip to content

Commit 8fb8a4d

Browse files
committed
🐛 fix too long meesage
1 parent 5e71715 commit 8fb8a4d

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

nonebot_plugin_manager/__init__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ async def _(matcher: Matcher, bot: Bot, event: Event):
1919
plugin = matcher.plugin_name
2020

2121
conv = {
22-
"user": [event.user_id] if hasattr(event, "user_id") else [],
23-
"group": [event.group_id] if hasattr(event, "group_id") else [],
22+
"user": [event.user_id] if hasattr(event, "user_id") else [], # type: ignore
23+
"group": [event.group_id] if hasattr(event, "group_id") else [], # type: ignore
2424
}
2525

2626
if (
2727
hasattr(event, "user_id")
2828
and not hasattr(event, "group_id")
29-
and str(event.user_id) in bot.config.superusers
29+
and str(event.user_id) in bot.config.superusers # type: ignore
3030
):
3131
conv["user"] = []
3232
conv["group"] = []
@@ -38,7 +38,7 @@ async def _(matcher: Matcher, bot: Bot, event: Event):
3838
}
3939
)
4040

41-
if not plugin_manager.get_plugin(conv=conv, perm=1)[plugin]:
41+
if plugin and not plugin_manager.get_plugin(conv=conv, perm=1)[plugin]:
4242
raise IgnoredException(f"Nonebot Plugin Manager has blocked {plugin} !")
4343

4444

@@ -57,5 +57,11 @@ async def _(bot: Bot, event: MessageEvent, args: Namespace = ShellCommandArgs())
5757

5858
if hasattr(args, "handle"):
5959
message = getattr(Handle, args.handle)(args)
60-
if message:
61-
await bot.send(event, message)
60+
if message is not None:
61+
message = message.split("\n")
62+
i = 1
63+
while len(message) > 30:
64+
await bot.send(event, "\n".join(message[:30]) + f"\n【第{i}页】")
65+
message = message[31:]
66+
i = i + 1
67+
await bot.send(event, "\n".join(message[:30]) + "\n【完】")

nonebot_plugin_manager/handle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ def unblock(cls, args: Namespace) -> str:
163163

164164
@classmethod
165165
def install(cls, args: Namespace) -> str:
166-
pass
166+
return ""
167167

168168
@classmethod
169169
def uninstall(cls, args: Namespace) -> str:
170-
pass
170+
return ""

poetry.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "nonebot_plugin_manager"
3-
version = "0.5.11"
3+
version = "0.5.12"
44
description = "Nonebot Plugin Manager base on import hook"
55
authors = ["Jigsaw <[email protected]>"]
66
license = "MIT"
@@ -20,7 +20,7 @@ black = {version = "^21.9b0", allow-prereleases = true}
2020

2121
[tool.black]
2222
line-length = 88
23-
target-version = ["py37", "py38", "py39", "py310"]
23+
target-version = ["py38", "py39", "py310"]
2424
include = '\.pyi?$'
2525
extend-exclude = '''
2626
'''

0 commit comments

Comments
 (0)