mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-31 04:30:29 +08:00
新增:开始获取米游币 & 添加Stokne;修复:活动列表
This commit is contained in:
parent
7e63649a55
commit
e439cd9f58
@ -70,6 +70,7 @@ if(ask==true){copy("添加stoken" + cookie);msg=cookie}else{msg='Cancel'}
|
||||
- [@AMEKENN](https://github.com/AMEKENN) - 米游社签到部分的代码指导
|
||||
- [@lgc233](https://github.com/lgc2333) - 众多优秀PR贡献
|
||||
- [@RemKeeper](https://github.com/RemKeeper) - 简易Cookies获取文档
|
||||
- [@珊瑚宫千花](https://space.bilibili.com/398528056) - 角色别名Json提供
|
||||
- [@wudifeixue](https://github.com/wudifeixue) - PR贡献 & Bug报告
|
||||
- [@ZhouYingSASA](https://github.com/ZhouYingSASA) - PR贡献 & Bug报告
|
||||
|
||||
|
@ -15,7 +15,7 @@ from mihoyo_libs.get_mihoyo_bbs_data import *
|
||||
sv = Service('genshinuid')
|
||||
hoshino_bot = get_bot()
|
||||
|
||||
FILE_PATH = os.path.join(os.path.dirname(__file__), 'mys')
|
||||
FILE_PATH = os.path.josin(os.path.join(os.path.dirname(__file__), 'mihoyo_libs'),'mihoyo_bbs')
|
||||
INDEX_PATH = os.path.join(FILE_PATH, 'index')
|
||||
Texture_PATH = os.path.join(FILE_PATH, 'texture2d')
|
||||
|
||||
@ -241,6 +241,25 @@ async def clean_cache():
|
||||
async def draw_event():
|
||||
await draw_event_pic()
|
||||
|
||||
@sv.on_fullmatch('开始获取米游币')
|
||||
async def send_mihoyo_coin(bot: HoshinoBot, ev: CQEvent):
|
||||
await bot.send(ev, "开始操作……", at_sender=True)
|
||||
try:
|
||||
qid = ev.sender["user_id"]
|
||||
im_mes = await mihoyo_coin(int(qid))
|
||||
im = im_mes
|
||||
except TypeError or AttributeError:
|
||||
im = "没有找到绑定信息。"
|
||||
logger.exception("获取米游币失败")
|
||||
except Exception as e:
|
||||
im = "发生错误 {},请检查后台输出。".format(e)
|
||||
logger.exception("获取米游币失败")
|
||||
finally:
|
||||
try:
|
||||
await bot.send(ev, im, at_sender=True)
|
||||
except ActionFailed as e:
|
||||
await bot.send(ev, "机器人发送消息失败:{}".format(e.info['wording']))
|
||||
logger.exception("发送签到信息失败")
|
||||
|
||||
@sv.on_fullmatch('全部重签')
|
||||
async def _(bot: HoshinoBot, ev: CQEvent):
|
||||
@ -347,12 +366,9 @@ async def setting(ctx):
|
||||
if '添加 ' in message:
|
||||
try:
|
||||
mes = message.replace('添加 ', '')
|
||||
await deal_ck(mes, userid)
|
||||
im = await deal_ck(mes, userid)
|
||||
await hoshino_bot.send_msg(self_id=sid, user_id=userid, group_id=gid,
|
||||
message=f'添加Cookies成功!\nCookies属于个人重要信息,如果你是在不知情的情况下添加,'
|
||||
f'请马上修改米游社账户密码,保护个人隐私!\n————\n'
|
||||
f'如果需要【开启自动签到】和【开启推送】还需要使用命令“绑定uid”绑定你的uid。\n'
|
||||
f'例如:绑定uid123456789。')
|
||||
message=im)
|
||||
except ActionFailed as e:
|
||||
await hoshino_bot.send_msg(self_id=sid, user_id=userid, group_id=gid,
|
||||
message="机器人发送消息失败:{}".format(e))
|
||||
|
@ -1,4 +1,3 @@
|
||||
from sre_constants import SUCCESS
|
||||
import time
|
||||
import random
|
||||
import string
|
||||
@ -7,11 +6,6 @@ from httpx import AsyncClient
|
||||
|
||||
from get_data import old_version_get_ds_token,random_hex
|
||||
|
||||
Today_getcoins = 0
|
||||
Today_have_getcoins = 0 # 这个变量以后可能会用上,先留着了
|
||||
Have_coins = 0
|
||||
|
||||
|
||||
# 米游社的API列表
|
||||
bbs_Cookieurl = "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}"
|
||||
bbs_Cookieurl2 = "https://api-takumi.mihoyo.com/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}"
|
||||
@ -82,6 +76,9 @@ class mihoyobbs_coin:
|
||||
"bbs_Share": False
|
||||
}
|
||||
self.mihoyobbs_List_Use = []
|
||||
self.Today_getcoins = 0
|
||||
self.Today_have_getcoins = 0 # 这个变量以后可能会用上,先留着了
|
||||
self.Have_coins = 0
|
||||
|
||||
async def task_run(self):
|
||||
await self.Load_Mihoyobbs_List_Use()
|
||||
@ -102,9 +99,6 @@ class mihoyobbs_coin:
|
||||
|
||||
# 获取任务列表,用来判断做了哪些任务
|
||||
async def Get_taskslist(self):
|
||||
global Today_getcoins
|
||||
global Today_have_getcoins
|
||||
global Have_coins
|
||||
#log.info("正在获取任务列表")
|
||||
async with AsyncClient() as client:
|
||||
req = await client.get(url = bbs_Taskslist, headers = self.headers)
|
||||
@ -113,11 +107,11 @@ class mihoyobbs_coin:
|
||||
return "你的Cookies已失效。"
|
||||
#log.error("获取任务列表失败,你的cookie可能已过期,请重新设置cookie。")
|
||||
else:
|
||||
Today_getcoins = data["data"]["can_get_points"]
|
||||
Today_have_getcoins = data["data"]["already_received_points"]
|
||||
Have_coins = data["data"]["total_points"]
|
||||
self.Today_getcoins = data["data"]["can_get_points"]
|
||||
self.Today_have_getcoins = data["data"]["already_received_points"]
|
||||
self.Have_coins = data["data"]["total_points"]
|
||||
# 如果当日可获取米游币数量为0直接判断全部任务都完成了
|
||||
if Today_getcoins == 0:
|
||||
if self.Today_getcoins == 0:
|
||||
self.Task_do["bbs_Sign"] = True
|
||||
self.Task_do["bbs_Read_posts"] = True
|
||||
self.Task_do["bbs_Like_posts"] = True
|
||||
@ -125,10 +119,10 @@ class mihoyobbs_coin:
|
||||
else:
|
||||
# 如果第0个大于或等于62则直接判定任务没做
|
||||
if data["data"]["states"][0]["mission_id"] >= 62:
|
||||
#log.info(f"新的一天,今天可以获得{Today_getcoins}个米游币")
|
||||
#log.info(f"新的一天,今天可以获得{self.Today_getcoins}个米游币")
|
||||
pass
|
||||
else:
|
||||
#log.info(f"似乎还有任务没完成,今天还能获得{Today_getcoins}")
|
||||
#log.info(f"似乎还有任务没完成,今天还能获得{self.Today_getcoins}")
|
||||
for i in data["data"]["states"]:
|
||||
# 58是讨论区签到
|
||||
if i["mission_id"] == 58:
|
||||
|
Loading…
x
Reference in New Issue
Block a user