mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 05:16:48 +08:00
commit
5db819738e
@ -214,5 +214,21 @@
|
|||||||
"desc": "基于 import hook 的插件管理",
|
"desc": "基于 import hook 的插件管理",
|
||||||
"author": "Jigsaw111",
|
"author": "Jigsaw111",
|
||||||
"repo": "Jigsaw111/nonebot_plugin_manager"
|
"repo": "Jigsaw111/nonebot_plugin_manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "nonebot_plugin_analysis_bilibili",
|
||||||
|
"link": "nonebot-plugin-analysis-bilibili",
|
||||||
|
"name": "bilibili视频、番剧解析",
|
||||||
|
"desc": "自动解析bilibili视频、番剧解析",
|
||||||
|
"author": "mengshouer",
|
||||||
|
"repo": "mengshouer/nonebot_plugin_analysis_bilibili"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "nonebot_plugin_localstore",
|
||||||
|
"link": "nonebot-plugin-localstore",
|
||||||
|
"name": "本地数据存储",
|
||||||
|
"desc": "存储插件数据至本地文件",
|
||||||
|
"author": "yanyongyu",
|
||||||
|
"repo": "nonebot/plugin-localstore"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -11,7 +11,7 @@ from nonebot.message import handle_event
|
|||||||
from nonebot.utils import escape_tag, logger_wrapper
|
from nonebot.utils import escape_tag, logger_wrapper
|
||||||
|
|
||||||
from .event import Event, GroupMessage, MessageEvent, MessageSource
|
from .event import Event, GroupMessage, MessageEvent, MessageSource
|
||||||
from .message import MessageType
|
from .message import MessageType, MessageSegment
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .bot import Bot
|
from .bot import Bot
|
||||||
@ -64,7 +64,7 @@ class ActionFailed(exception.ActionFailed):
|
|||||||
class InvalidArgument(exception.AdapterException):
|
class InvalidArgument(exception.AdapterException):
|
||||||
"""
|
"""
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
调用API的参数出错
|
调用API的参数出错
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ def argument_validation(function: _AnyCallable) -> _AnyCallable:
|
|||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
通过函数签名中的类型注解来对传入参数进行运行时校验
|
通过函数签名中的类型注解来对传入参数进行运行时校验
|
||||||
|
|
||||||
会在参数出错时释放 ``InvalidArgument`` 异常
|
会在参数出错时释放 ``InvalidArgument`` 异常
|
||||||
"""
|
"""
|
||||||
function = validate_arguments(config={
|
function = validate_arguments(config={
|
||||||
@ -138,6 +138,8 @@ def process_at(bot: "Bot", event: GroupMessage) -> GroupMessage:
|
|||||||
event.to_me = True
|
event.to_me = True
|
||||||
else:
|
else:
|
||||||
event.message_chain.insert(0, at)
|
event.message_chain.insert(0, at)
|
||||||
|
if not event.message_chain:
|
||||||
|
event.message_chain.append(MessageSegment.plain(''))
|
||||||
return event
|
return event
|
||||||
|
|
||||||
|
|
||||||
@ -175,4 +177,4 @@ async def process_event(bot: "Bot", event: Event) -> None:
|
|||||||
event = process_nick(bot, event)
|
event = process_nick(bot, event)
|
||||||
event = process_at(bot, event)
|
event = process_at(bot, event)
|
||||||
event = process_reply(bot, event)
|
event = process_reply(bot, event)
|
||||||
await handle_event(bot, event)
|
await handle_event(bot, event)
|
||||||
|
Loading…
Reference in New Issue
Block a user