2022-08-23 15:42:46 +00:00
|
|
|
|
import os
|
2021-07-17 00:57:03 +00:00
|
|
|
|
import time
|
2022-01-09 09:31:44 +00:00
|
|
|
|
import push
|
2021-05-24 08:16:52 +00:00
|
|
|
|
import login
|
|
|
|
|
import config
|
2021-07-17 00:57:03 +00:00
|
|
|
|
import random
|
2022-05-01 02:34:19 +00:00
|
|
|
|
import honkai2
|
2021-05-24 08:16:52 +00:00
|
|
|
|
import genshin
|
|
|
|
|
import setting
|
|
|
|
|
import mihoyobbs
|
2021-06-06 04:16:28 +00:00
|
|
|
|
import honkai3rd
|
2022-07-19 08:30:10 +00:00
|
|
|
|
import tearsofthemis
|
2022-08-27 13:51:38 +00:00
|
|
|
|
import cloud_genshin
|
2022-08-18 08:36:48 +00:00
|
|
|
|
from error import *
|
2022-01-06 05:49:25 +00:00
|
|
|
|
from loghelper import log
|
2021-05-24 08:16:52 +00:00
|
|
|
|
|
2021-10-25 14:53:34 +00:00
|
|
|
|
|
2021-05-24 08:16:52 +00:00
|
|
|
|
def main():
|
2021-10-25 14:53:34 +00:00
|
|
|
|
# 初始化,加载配置
|
2022-04-23 01:35:26 +00:00
|
|
|
|
return_data = "\n米游社: "
|
2022-01-06 05:49:25 +00:00
|
|
|
|
config.load_config()
|
2022-04-28 05:50:25 +00:00
|
|
|
|
if config.config["enable"]:
|
2021-10-25 14:53:34 +00:00
|
|
|
|
# 检测参数是否齐全,如果缺少就进行登入操作
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["account"]["login_ticket"] == "" or config.config["account"]["stuid"] == "" or \
|
|
|
|
|
config.config["account"]["stoken"] == "":
|
2021-12-02 02:53:30 +00:00
|
|
|
|
# 登入,如果没开启bbs全局没打开就无需进行登入操作
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["mihoyobbs"]["enable"]:
|
2021-12-02 02:53:30 +00:00
|
|
|
|
login.login()
|
2021-08-06 01:13:57 +00:00
|
|
|
|
time.sleep(random.randint(2, 8))
|
2021-10-25 14:53:34 +00:00
|
|
|
|
# 获取要使用的BBS列表,#判断是否开启bbs_Signin_multi
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["mihoyobbs"]["checkin_multi"]:
|
2021-10-25 14:53:34 +00:00
|
|
|
|
# 用这里的方案可以实现当让id在第一个的时候为主社区
|
2022-04-30 04:38:52 +00:00
|
|
|
|
for i in config.config["mihoyobbs"]["checkin_multi_list"]:
|
2021-06-06 05:04:18 +00:00
|
|
|
|
for i2 in setting.mihoyobbs_List:
|
2021-06-06 13:19:28 +00:00
|
|
|
|
if i == int(i2["id"]):
|
2021-06-06 05:04:18 +00:00
|
|
|
|
setting.mihoyobbs_List_Use.append(i2)
|
2021-05-26 10:11:27 +00:00
|
|
|
|
else:
|
2021-10-25 14:53:34 +00:00
|
|
|
|
# 关闭bbs_Signin_multi后只签到大别墅
|
2021-05-26 10:11:27 +00:00
|
|
|
|
for i in setting.mihoyobbs_List:
|
2021-06-06 13:19:28 +00:00
|
|
|
|
if int(i["id"]) == 5:
|
2021-05-26 10:11:27 +00:00
|
|
|
|
setting.mihoyobbs_List_Use.append(i)
|
2021-10-25 14:53:34 +00:00
|
|
|
|
# 米游社签到
|
2022-08-18 08:36:48 +00:00
|
|
|
|
ret_code = 0
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["mihoyobbs"]["enable"]:
|
2022-04-23 01:35:26 +00:00
|
|
|
|
bbs = mihoyobbs.Mihoyobbs()
|
2021-10-25 14:53:34 +00:00
|
|
|
|
if bbs.Task_do["bbs_Sign"] and bbs.Task_do["bbs_Read_posts"] and bbs.Task_do["bbs_Like_posts"] and \
|
|
|
|
|
bbs.Task_do["bbs_Share"]:
|
2022-04-23 01:35:26 +00:00
|
|
|
|
return_data += "\n" + f"今天已经全部完成了!\n" \
|
|
|
|
|
f"一共获得{mihoyobbs.today_have_get_coins}个米游币\n目前有{mihoyobbs.Have_coins}个米游币"
|
|
|
|
|
log.info(f"今天已经全部完成了!一共获得{mihoyobbs.today_have_get_coins}个米游币,目前有{mihoyobbs.Have_coins}个米游币")
|
2021-10-25 14:53:34 +00:00
|
|
|
|
else:
|
2022-04-23 01:35:26 +00:00
|
|
|
|
i = 0
|
|
|
|
|
while mihoyobbs.today_get_coins != 0 and i < 3:
|
|
|
|
|
if i > 0:
|
|
|
|
|
bbs.refresh_list()
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["mihoyobbs"]["checkin"]:
|
2022-04-23 01:35:26 +00:00
|
|
|
|
bbs.signing()
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["mihoyobbs"]["read_posts"]:
|
2022-04-23 01:35:26 +00:00
|
|
|
|
bbs.read_posts()
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["mihoyobbs"]["like_posts"]:
|
2022-04-23 01:35:26 +00:00
|
|
|
|
bbs.like_posts()
|
2022-04-30 04:38:52 +00:00
|
|
|
|
if config.config["mihoyobbs"]["share_post"]:
|
2022-04-23 01:35:26 +00:00
|
|
|
|
bbs.share_post()
|
|
|
|
|
bbs.get_tasks_list()
|
|
|
|
|
i += 1
|
|
|
|
|
return_data += "\n" + f"今天已经获得{mihoyobbs.today_have_get_coins}个米游币\n" \
|
|
|
|
|
f"还能获得{mihoyobbs.today_get_coins}个米游币\n目前有{mihoyobbs.Have_coins}个米游币"
|
|
|
|
|
log.info(f"今天已经获得{mihoyobbs.today_have_get_coins}个米游币,"
|
|
|
|
|
f"还能获得{mihoyobbs.today_get_coins}个米游币,目前有{mihoyobbs.Have_coins}个米游币")
|
2021-08-06 01:13:57 +00:00
|
|
|
|
time.sleep(random.randint(2, 8))
|
2021-06-01 11:16:01 +00:00
|
|
|
|
else:
|
2022-01-30 03:58:31 +00:00
|
|
|
|
return_data += "\n" + "米游社功能未启用!"
|
2022-01-06 05:49:25 +00:00
|
|
|
|
log.info("米游社功能未启用!")
|
2022-05-01 02:34:19 +00:00
|
|
|
|
# 崩坏2签到 config这里少了个n,下回config v6的时候再修复吧
|
|
|
|
|
if config.config["games"]["cn"]["hokai2"]["auto_checkin"]:
|
|
|
|
|
log.info("正在进行崩坏2签到")
|
|
|
|
|
honkai2_help = honkai2.Honkai2()
|
|
|
|
|
return_data += "\n\n" + honkai2_help.sign_account()
|
2021-08-06 01:13:57 +00:00
|
|
|
|
time.sleep(random.randint(2, 8))
|
2021-10-25 14:53:34 +00:00
|
|
|
|
# 崩坏3签到
|
2022-04-28 07:08:27 +00:00
|
|
|
|
if config.config["games"]["cn"]["honkai3rd"]["auto_checkin"]:
|
2022-01-06 05:49:25 +00:00
|
|
|
|
log.info("正在进行崩坏3签到")
|
2022-01-30 03:58:31 +00:00
|
|
|
|
honkai3rd_help = honkai3rd.Honkai3rd()
|
2022-01-30 08:12:12 +00:00
|
|
|
|
return_data += "\n\n" + honkai3rd_help.sign_account()
|
2022-07-27 02:52:39 +00:00
|
|
|
|
# 未定事件簿签到
|
2022-07-19 08:30:10 +00:00
|
|
|
|
if config.config["games"]["cn"]["tears_of_themis"]["auto_checkin"]:
|
|
|
|
|
log.info("正在进行未定事件簿签到")
|
|
|
|
|
tearsofthemis_help = tearsofthemis.Tears_of_themis()
|
|
|
|
|
return_data += "\n\n" + tearsofthemis_help.sign_account()
|
2022-05-01 02:34:19 +00:00
|
|
|
|
# 原神签到
|
|
|
|
|
if config.config["games"]["cn"]["genshin"]["auto_checkin"]:
|
|
|
|
|
log.info("正在进行原神签到")
|
|
|
|
|
genshin_help = genshin.Genshin()
|
2022-08-18 08:36:48 +00:00
|
|
|
|
genshin_message = genshin_help.sign_account()
|
|
|
|
|
if "触发验证码" in genshin_message:
|
|
|
|
|
ret_code = 3
|
|
|
|
|
return_data += "\n\n" + genshin_message
|
2022-05-01 02:34:19 +00:00
|
|
|
|
time.sleep(random.randint(2, 8))
|
2022-08-28 09:31:01 +00:00
|
|
|
|
if config.config['cloud_games']['genshin']["enable"]:
|
2022-08-27 13:51:38 +00:00
|
|
|
|
log.info("正在进行云原神签到")
|
2022-08-28 09:31:01 +00:00
|
|
|
|
if config.config['cloud_games']['genshin']['token'] == "":
|
2022-08-27 13:51:38 +00:00
|
|
|
|
log.info("token为空,跳过任务")
|
|
|
|
|
else:
|
2022-08-28 09:31:01 +00:00
|
|
|
|
cloud_ys = cloud_genshin.CloudGenshin()
|
|
|
|
|
data = cloud_ys.sign_account()
|
2022-08-28 10:48:36 +00:00
|
|
|
|
return_data += "\n\n" + data
|
2022-08-18 08:36:48 +00:00
|
|
|
|
return ret_code, return_data
|
2022-04-28 05:50:25 +00:00
|
|
|
|
elif config.config["account"]["cookie"] == "CookieError":
|
2022-04-25 08:07:37 +00:00
|
|
|
|
raise CookieError('Cookie expires')
|
2021-05-24 08:16:52 +00:00
|
|
|
|
else:
|
2022-01-06 05:49:25 +00:00
|
|
|
|
log.warning("Config未启用!")
|
2022-01-30 03:58:31 +00:00
|
|
|
|
return 1, "Config未启用!"
|
2021-10-25 14:53:34 +00:00
|
|
|
|
|
2021-05-24 08:16:52 +00:00
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-08-23 15:42:46 +00:00
|
|
|
|
if not os.path.exists(config.config_Path):
|
|
|
|
|
config.update_config()
|
2022-01-06 03:27:24 +00:00
|
|
|
|
try:
|
2022-01-30 03:58:31 +00:00
|
|
|
|
status_code, message = main()
|
2022-01-06 05:49:25 +00:00
|
|
|
|
except CookieError:
|
2022-03-10 08:17:05 +00:00
|
|
|
|
status_code = 1
|
|
|
|
|
message = "账号Cookie出错!"
|
2022-01-06 05:49:25 +00:00
|
|
|
|
log.error("账号Cookie有问题!")
|
2022-01-30 03:58:31 +00:00
|
|
|
|
push.push(status_code, message)
|
2022-08-28 09:31:01 +00:00
|
|
|
|
pass
|