mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-10-21 16:27:15 +08:00
🐛 签到和米游币记录uid
This commit is contained in:
parent
185484cad6
commit
3cbfe8e9d2
@ -1,9 +1,10 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
import random
|
||||
import time
|
||||
from collections import defaultdict
|
||||
|
||||
from LittlePaimon.database.models import PrivateCookie, MihoyoBBSSub
|
||||
from LittlePaimon.database.models import PrivateCookie, MihoyoBBSSub, LastQuery
|
||||
from LittlePaimon.utils import logger, aiorequests
|
||||
from LittlePaimon.utils import scheduler
|
||||
from LittlePaimon.utils.api import random_text, random_hex, get_old_version_ds, get_ds
|
||||
@ -283,6 +284,8 @@ async def mhy_bbs_coin(user_id: str, uid: str) -> str:
|
||||
return '你尚未绑定Cookie和Stoken,请先用ysb指令绑定!'
|
||||
elif cookie.stoken is None:
|
||||
return '你绑定Cookie中没有login_ticket,请重新用ysb指令绑定!'
|
||||
await LastQuery.update_or_create(user_id=user_id,
|
||||
defaults={'uid': uid, 'last_time': datetime.datetime.now()})
|
||||
logger.info('米游币自动获取', '➤执行', {'用户': user_id, 'UID': uid, '的米游币获取': '......'})
|
||||
get_coin_task = MihoyoBBSCoin(cookie.stoken)
|
||||
result, msg = await get_coin_task.run()
|
||||
|
@ -1,11 +1,12 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
import random
|
||||
import time
|
||||
from nonebot import get_bot
|
||||
from collections import defaultdict
|
||||
from typing import Tuple
|
||||
from LittlePaimon import DRIVER
|
||||
from LittlePaimon.database.models import MihoyoBBSSub
|
||||
from LittlePaimon.database.models import MihoyoBBSSub, LastQuery
|
||||
from LittlePaimon.utils import logger, scheduler
|
||||
from LittlePaimon.utils.api import get_mihoyo_private_data, get_sign_reward_list
|
||||
from LittlePaimon.manager.plugin_manager import plugin_manager as pm
|
||||
@ -21,6 +22,8 @@ async def mhy_bbs_sign(user_id: str, uid: str) -> Tuple[SignResult, str]:
|
||||
:param uid: 原神uid
|
||||
:return: 签到成功天数或失败原因
|
||||
"""
|
||||
await LastQuery.update_or_create(user_id=user_id,
|
||||
defaults={'uid': uid, 'last_time': datetime.datetime.now()})
|
||||
sign_info = await get_mihoyo_private_data(uid, user_id, 'sign_info')
|
||||
if isinstance(sign_info, str):
|
||||
logger.info('米游社原神签到', '➤', {'用户': user_id, 'UID': uid}, '未绑定私人cookie', False)
|
||||
|
Loading…
Reference in New Issue
Block a user