Skip to content

Commit

Permalink
在不支持的平台上发送提示
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Sep 13, 2023
1 parent e5361a4 commit 8e47bd8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/plugins/user/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
from nonebot.matcher import Matcher
from nonebot.params import Depends
from nonebot_plugin_session import SessionLevel
from nonebot_plugin_userinfo import EventUserInfo, UserInfo

from src.utils.annotated import MyUserInfo, Session

from . import utils
from .models import User


async def get_or_create_user(matcher: Matcher, session: Session, user_info: MyUserInfo):
async def get_or_create_user(
matcher: Matcher,
session: Session,
user_info: UserInfo | None = EventUserInfo(),
):
"""获取一个用户,如果不存在则创建"""
if (
session.platform == "unknown"
or user_info is None
or session.level == SessionLevel.LEVEL0
or not session.id1
):
Expand Down

0 comments on commit 8e47bd8

Please sign in to comment.