3
0

🐛 0.3.7beta Fix some bugs.

This commit is contained in:
xtaodada 2022-02-12 16:17:47 +08:00
parent f306d9d1fb
commit a77eec4011
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
7 changed files with 45 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -1,3 +1,4 @@
import re
import time
import datetime
import os
@ -18,33 +19,40 @@ def generate_event():
"https://hk4e-api.mihoyo.com/common/hk4e_cn/announcement/api/getAnnList?game=hk4e&game_biz=hk4e_cn&lang=zh-cn"
"&bundle_id=hk4e_cn&platform=pc&region=cn_gf01&level=55&uid=100000000").json()
now_time = datetime.datetime.now().strftime('%Y-%m-%d')
raw_time_data = get(
"https://api-takumi.mihoyo.com/event/bbs_activity_calendar/getActList?"
"time={}&game_biz=ys_cn&page=1&tag_id=0".format(now_time)).json()
# raw_time_data = get(
# "https://api-takumi.mihoyo.com/event/bbs_activity_calendar/getActList?"
# "time={}&game_biz=ys_cn&page=1&tag_id=0".format(now_time)).json()
raw_time_data = get("https://hk4e-api.mihoyo.com/common/hk4e_cn/announcement/api/"
"getAnnContent?game=hk4e&game_biz=hk4e_cn&lang=zh-cn&bundle_id=hk4e_cn"
"&platform=pc&region=cn_gf01&level=55&uid=100000000").json()
data = raw_data["data"]["list"][1]["list"]
event_data = {"gacha_event": [], "normal_event": [], "other_event": []}
for k in data:
for i in raw_time_data["data"]["act_list"]:
if i["name"] == k["title"]:
k["act_begin_time"] = i["act_begin_time"]
k["act_end_time"] = i["act_end_time"]
elif "神铸赋形" in k["title"] and "神铸赋形" in i["name"]:
k["act_begin_time"] = i["act_begin_time"]
k["act_end_time"] = i["act_end_time"]
elif "传说任务" in k["title"]:
k["act_begin_time"] = k["start_time"]
k["act_end_time"] = "永久开放"
elif k["subtitle"] in i["name"]:
k["act_begin_time"] = i["act_begin_time"]
k["act_end_time"] = i["act_end_time"]
else:
k["act_begin_time"] = "{}-{}-{} {}".format(k["start_time"].split()[0].split("-")[0],
k["start_time"].split()[0].split("-")[1],
str(int(k["start_time"].split()[0].split("-")[2]) + 2),
"10:00:00(?)")
k["act_end_time"] = k["end_time"]
for i in raw_time_data["data"]["list"]:
if k["title"] in i["title"]:
time_data = re.findall(r"[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}", i["content"])
time_limit_end = re.findall(r"起至[0-9]{1}.[0-9]{1}版本结束", i["content"])
time_limit_start = re.findall(r"[0-9]{1}.[0-9]{1}版本更新后", i["content"])
if len(time_data) == 2:
k["act_begin_time"] = time_data[0]
k["act_end_time"] = time_data[1]
elif len(time_data) == 1 and len(time_limit_end) == 1:
k["act_begin_time"] = time_data[0]
k["act_end_time"] = time_limit_end[0]
elif len(time_data) == 1 and len(time_limit_start) == 1:
k["act_begin_time"] = time_limit_start[0]
k["act_end_time"] = time_data[0]
elif len(time_data) == 1:
k["act_begin_time"] = time_data[0]
k["act_end_time"] = "永久开放"
elif len(time_data) > 2:
k["act_begin_time"] = time_data[0]
k["act_end_time"] = k["end_time"]
elif len(time_data) == 0:
k["act_begin_time"] = k["start_time"] + "(?)"
k["act_end_time"] = k["end_time"] + "(?)"
if "冒险助力礼包" in k["title"] or "纪行" in k["title"]:
continue

View File

@ -609,6 +609,7 @@ async def draw_pic(uid, message: Message, nickname="1", mode=2, role_level=None)
char_img_icon = i["image"]
char_weapon_star = i['weapon']['rarity']
char_weapon_level = i['weapon']['level']
char_weapon_jinglian = i['weapon']['affix_level']
char_weapon_icon = i['weapon']['icon']
@ -638,7 +639,7 @@ async def draw_pic(uid, message: Message, nickname="1", mode=2, role_level=None)
weapon_bg = Image.open(getText(char_weapon_star, 3))
charpic.paste(weapon_bg, (72, 10), weapon_bg)
charpic_temp.paste(char_img, (81, 13), charpic_mask)
charpic_temp.paste(char_stand, (335, -99), char_stand_mask)
charpic_temp.paste(char_stand, (395, -99), char_stand_mask)
charpic_temp.paste(char_fg, (0, 0), char_fg)
charpic_temp.paste(weapon_img, (141, 72), weaponpic_mask)
# temp = Image.composite(weapon_img, basedb, weaponpic_mask)
@ -669,14 +670,17 @@ async def draw_pic(uid, message: Message, nickname="1", mode=2, role_level=None)
char_draw = ImageDraw.Draw(charpic)
char_draw.text((182, 39), i["name"], new_color, ys_font(22))
char_draw.text((272, 45), f'Lv.{str(char_level)}', new_color, ys_font(18))
char_draw.text((188, 30), i["name"] + " " + f'Lv.{str(char_level)}', new_color, ys_font(22))
# char_draw.text((272, 45), f'Lv.{str(char_level)}', new_color, ys_font(18))
# char_draw.text((104.5,91.5),f'{str(char_weapon_jinglian)}',new_color,ys_font(10))
char_draw.text((267, 77), f'{str(char_mingzuo)}', new_color, ys_font(18))
char_draw.text((209, 77), f'{str(i["fetter"])}' if str(char_name) != "旅行者" else "10", new_color,
ys_font(18))
char_draw.text((222, 87), f'{str(i["fetter"])}' if str(char_name) != "旅行者" else "10", new_color,
ys_font(15), anchor="mm")
char_draw.text((255, 87), f'{str(char_mingzuo)}', new_color, ys_font(15), anchor="mm")
char_draw.text((218, 67), f'{str(char_weapon_level)}{str(char_weapon_jinglian)}', new_color, ys_font(15),
anchor="lm")
char_crop = (0, 800 + 110 * num)
num += 1
bg_img.paste(charpic, char_crop, charpic)

View File

@ -23,7 +23,11 @@ async def mihoyo_msg(client: Client, message: Message):
try:
mes = text.replace('添加', '').strip()
if not mes:
return await message.reply_text("获取 Cookie 请登录https://account.mihoyo.com/#/login 后按F12运行\n<code>var cookie=document.cookie;var ask=confirm('Cookie:'+cookie+'\\n\\nDo you want to copy the cookie to the clipboard?');if(ask==true){copy(cookie);msg=cookie}else{msg='Cancel'}</code>\n然后点击OK即可", quote=True)
return await message.reply_text("获取 Cookie 请登录https://account.mihoyo.com/#/login 后按F12运行\n"
"<code>var cookie=document.cookie;var ask=confirm"
"('Cookie:'+cookie+'\\n\\nDo you want to copy the cookie to "
"the clipboard?');if(ask==true){copy(cookie);msg=cookie}else"
"{msg='Cancel'}</code>\n然后点击OK即可", quote=True)
await deal_ck(mes, userid)
await message.reply(f'添加Cookies成功\n'
f'Cookies属于个人重要信息如果你是在不知情的情况下添加'

View File

@ -2,7 +2,7 @@ from ci import admin_id
from pyrogram import Client
from pyrogram.types import Message, CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton
HELP_MSG_PRE = '<a href="https://git.io/JcbTD">PaimonBot</a> 0.3.6beta By Xtao-Labs\n\n' \
HELP_MSG_PRE = '<a href="https://git.io/JcbTD">PaimonBot</a> 0.3.7beta By Xtao-Labs\n\n' \
'🔅 以下是小派蒙我学会了的功能(部分):\n'
HELP_MSG = """① [武器/今日武器] 查看今日武器材料和武器
[天赋/今日天赋] 查看今日天赋材料和角色