mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 09:37:30 +00:00
🐛 Fix the missing account_id
field when setting the Cookies
This commit is contained in:
parent
69eb33bcf9
commit
c5e5878c5e
@ -75,6 +75,12 @@ class CookiesModel(BaseModel):
|
||||
if self.account_id_v2 is None and self.account_mid_v2:
|
||||
self.account_id_v2 = user_id
|
||||
|
||||
def set_uid(self, user_id: int):
|
||||
if self.account_id is None and self.cookie_token:
|
||||
self.account_id = user_id
|
||||
if self.ltuid is None and self.ltoken:
|
||||
self.ltuid = user_id
|
||||
|
||||
def check(self) -> bool:
|
||||
"""检查Cookies是否完整
|
||||
:return: 成功返回 True 失败返回 False
|
||||
|
@ -297,12 +297,15 @@ class AccountCookiesPlugin(Plugin.Conversation):
|
||||
await message.reply_text("Stoken 非法,请重新绑定。", reply_markup=ReplyKeyboardRemove())
|
||||
return ConversationHandler.END
|
||||
try:
|
||||
if client.account_id is None and cookies.is_v2:
|
||||
logger.info("检测到用户 %s[%s] 使用 V2 Cookie 正在尝试获取 account_id", user.full_name, user.id)
|
||||
if cookies.account_id is None:
|
||||
logger.info("正在尝试获取用户 %s[%s] account_id", user.full_name, user.id)
|
||||
account_info = await client.get_user_info()
|
||||
account_id = account_info.accident_id
|
||||
account_cookies_plugin_data.account_id = account_id
|
||||
if cookies.is_v2:
|
||||
cookies.set_v2_uid(account_id)
|
||||
else:
|
||||
cookies.set_uid(account_id)
|
||||
logger.success("获取用户 %s[%s] account_id[%s] 成功", user.full_name, user.id, account_id)
|
||||
else:
|
||||
account_cookies_plugin_data.account_id = client.account_id
|
||||
|
Loading…
Reference in New Issue
Block a user