Skip to content

Commit

Permalink
💡 在 _choose_cookie 方法中添加适当注释
Browse files Browse the repository at this point in the history
  • Loading branch information
suyiiyii committed Dec 24, 2024
1 parent 57e68ac commit 1031e9f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nonebot_bison/platform/bilibili/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ async def _get_next_user_cookie(self) -> CookieModel | None:
async def _choose_cookie(self, target: Target | None) -> CookieModel:
"""选择 cookie 的具体算法"""
if self._current_user_cookie is None:
# 若当前没有选定用户 cookie 则尝试获取
self._current_user_cookie = await self._get_next_user_cookie()
if self._current_user_cookie:
# 如果当前有选定的用户 cookie 则直接返回
return self._current_user_cookie
# 否则返回匿名 cookie
return (await config.get_cookie(self._site_name, is_anonymous=True))[0]

@override
Expand Down

0 comments on commit 1031e9f

Please sign in to comment.