diff --git a/README.md b/README.md index 3713453..80047d4 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Bot 实例: [@Genshin_All_Info_Bot](https://t.me/Genshin_All_Info_Bot) - [Obtaining Telegram API ID](https://core.telegram.org/api/obtaining_api_id) 申请 API ID 与 API Hash - 拉取项目 ```bash - git clone https://github.com/Xtao-Labs/Telegram_PaimonBot.git + git clone --recursive https://github.com/Xtao-Labs/Telegram_PaimonBot.git cd Telegram_PaimonBot ``` - 安装依赖 diff --git a/assets/characters/10000050.png b/assets/characters/10000050.png new file mode 100644 index 0000000..cd45ddf Binary files /dev/null and b/assets/characters/10000050.png differ diff --git a/assets/characters/10000057.png b/assets/characters/10000057.png new file mode 100644 index 0000000..65b7036 Binary files /dev/null and b/assets/characters/10000057.png differ diff --git a/assets/characters/10000058.png b/assets/characters/10000058.png new file mode 100644 index 0000000..a6714a3 Binary files /dev/null and b/assets/characters/10000058.png differ diff --git a/assets/characters/10000063.png b/assets/characters/10000063.png new file mode 100644 index 0000000..d0c155b Binary files /dev/null and b/assets/characters/10000063.png differ diff --git a/assets/characters/10000064.png b/assets/characters/10000064.png new file mode 100644 index 0000000..8aa5c41 Binary files /dev/null and b/assets/characters/10000064.png differ diff --git a/assets/gacha/type.json b/assets/gacha/type.json index df73b38..aedacd3 100644 --- a/assets/gacha/type.json +++ b/assets/gacha/type.json @@ -106,5 +106,8 @@ "贯虹之槊": "枪", "千岩古剑": "双手剑", "钟离": "岩", - "甘雨": "冰" -} \ No newline at end of file + "甘雨": "冰", + "证誓之明瞳": "法器", + "神乐之真意": "法器", + "八重神子": "雷" +} diff --git a/assets/gacha/武器/神乐之真意.png b/assets/gacha/武器/神乐之真意.png new file mode 100644 index 0000000..1a97892 Binary files /dev/null and b/assets/gacha/武器/神乐之真意.png differ diff --git a/assets/gacha/武器/证誓之明瞳.png b/assets/gacha/武器/证誓之明瞳.png new file mode 100644 index 0000000..9c58626 Binary files /dev/null and b/assets/gacha/武器/证誓之明瞳.png differ diff --git a/assets/gacha/角色/八重神子.png b/assets/gacha/角色/八重神子.png new file mode 100644 index 0000000..d8ca111 Binary files /dev/null and b/assets/gacha/角色/八重神子.png differ diff --git a/defs/event.py b/defs/event.py index 0c4419a..72c3880 100644 --- a/defs/event.py +++ b/defs/event.py @@ -1,7 +1,8 @@ -import re import time import datetime import os +from re import findall +from bs4 import BeautifulSoup from requests import get from io import BytesIO from PIL import Image, ImageDraw, ImageFont @@ -32,27 +33,27 @@ def generate_event(): for k in data: 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"] + "(?)" + content_bs = BeautifulSoup(i['content'], 'lxml') + for index, value in enumerate(content_bs.find_all("p")): + if value.text == "〓任务开放时间〓": + time_data = content_bs.find_all("p")[index + 1].text + if "([\s\S]*?)", time_data)[0] + k["time_data"] = time_data + elif value.text == "〓活动时间〓": + time_data = content_bs.find_all("p")[index + 1].text + time_data = time_data.replace("", "")[16:] + k["time_data"] = time_data + elif value.text == "〓祈愿介绍〓": + start_time = content_bs.find_all("tr")[1].td.find_all("p")[0].text + if "([\s\S]*?)", start_time)[0] + end_time = findall("<[a-zA-Z]+.*?>([\s\S]*?)", + content_bs.find_all("tr")[1].td.find_all("p")[2].text)[0] + if "([\s\S]*?)", end_time)[0] + time_data = start_time + "~" + end_time + k["time_data"] = time_data if "冒险助力礼包" in k["title"] or "纪行" in k["title"]: continue @@ -91,7 +92,7 @@ def generate_event(): for index, value in enumerate(event_data['normal_event']): img = Image.open(BytesIO(get(value["banner"]).content)) base_draw.text((540, 300 + 45 + 390 + (390 + 90) * index + 1), - value["act_begin_time"] + " —— " + value["act_end_time"], (255, 255, 255), ys_font(42), + value["time_data"], (255, 255, 255), ys_font(42), anchor="mm") # base_img.paste(img,((index%2)*1080,300 + 390*(index//2))) base_img.paste(img, (0, 300 + (390 + 90) * index)) @@ -99,7 +100,7 @@ def generate_event(): for index, value in enumerate(event_data['gacha_event']): img = Image.open(BytesIO(get(value["banner"]).content)) base_draw.text((540, 600 + 45 + (390 + 90) * len(event_data['normal_event']) + 533 + index * (533 + 90)), - value["act_begin_time"] + " —— " + value["act_end_time"], (255, 255, 255), ys_font(42), + value["time_data"], (255, 255, 255), ys_font(42), anchor="mm") # base_img.paste(img,((index%2)*1080,600 + ((1 + len(event_data['normal_event']))//2)*390 + # 533*(index//2))) diff --git a/genshinstats b/genshinstats index 5760a38..5e5c711 160000 --- a/genshinstats +++ b/genshinstats @@ -1 +1 @@ -Subproject commit 5760a38384e6dfdf95ec4ebdf410c3bee0537003 +Subproject commit 5e5c711faea42625bdf0eea39ffdd85dada87b3e diff --git a/plugins/start.py b/plugins/start.py index 3431c71..bbe2945 100644 --- a/plugins/start.py +++ b/plugins/start.py @@ -2,7 +2,7 @@ from ci import admin_id from pyrogram import Client from pyrogram.types import Message, CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton -HELP_MSG_PRE = 'PaimonBot 0.3.7beta By Xtao-Labs\n\n' \ +HELP_MSG_PRE = 'PaimonBot 0.3.8beta By Xtao-Labs\n\n' \ '🔅 以下是小派蒙我学会了的功能(部分):\n' HELP_MSG = """① [武器/今日武器] 查看今日武器材料和武器 ② [天赋/今日天赋] 查看今日天赋材料和角色