Skip to content

Commit

Permalink
扔漂流瓶时添加类型校验#68
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdaYH committed May 10, 2024
1 parent 0e2f1a6 commit 248a374
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions nonebot_plugin_bottle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
get_content_preview,
whether_collapse,
)
from .exception import NotSupportMessage

__plugin_meta__ = PluginMetadata(
name="漂流瓶",
Expand Down Expand Up @@ -250,14 +251,17 @@ async def _(
)
user_name = user_info.get("card") or user_info.get("nickname")

add_index = await bottle_manager.add_bottle(
user_id=event.user_id,
group_id=event.group_id,
content=await serialize_message(message=args),
user_name=user_name,
group_name=group_name,
session=session,
)
try:
add_index = await bottle_manager.add_bottle(
user_id=event.user_id,
group_id=event.group_id,
content=await serialize_message(message=args),
user_name=user_name,
group_name=group_name,
session=session,
)
except NotSupportMessage as e:
await throw.finish(str(e))
await session.commit()
if add_index:
# 添加个人冷却
Expand Down

0 comments on commit 248a374

Please sign in to comment.