3
0

⬆️ 更新 2.5 资源

This commit is contained in:
xtaodada 2022-02-17 14:55:06 +08:00
parent a77eec4011
commit b2a1f39cf3
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
13 changed files with 33 additions and 29 deletions

View File

@ -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 - [Obtaining Telegram API ID](https://core.telegram.org/api/obtaining_api_id) 申请 API ID 与 API Hash
- 拉取项目 - 拉取项目
```bash ```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 cd Telegram_PaimonBot
``` ```
- 安装依赖 - 安装依赖

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -106,5 +106,8 @@
"贯虹之槊": "枪", "贯虹之槊": "枪",
"千岩古剑": "双手剑", "千岩古剑": "双手剑",
"钟离": "岩", "钟离": "岩",
"甘雨": "冰" "甘雨": "冰",
"证誓之明瞳": "法器",
"神乐之真意": "法器",
"八重神子": "雷"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

View File

@ -1,7 +1,8 @@
import re
import time import time
import datetime import datetime
import os import os
from re import findall
from bs4 import BeautifulSoup
from requests import get from requests import get
from io import BytesIO from io import BytesIO
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
@ -32,27 +33,27 @@ def generate_event():
for k in data: for k in data:
for i in raw_time_data["data"]["list"]: for i in raw_time_data["data"]["list"]:
if k["title"] in i["title"]: 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"]) content_bs = BeautifulSoup(i['content'], 'lxml')
time_limit_end = re.findall(r"起至[0-9]{1}.[0-9]{1}版本结束", i["content"]) for index, value in enumerate(content_bs.find_all("p")):
time_limit_start = re.findall(r"[0-9]{1}.[0-9]{1}版本更新后", i["content"]) if value.text == "〓任务开放时间〓":
if len(time_data) == 2: time_data = content_bs.find_all("p")[index + 1].text
k["act_begin_time"] = time_data[0] if "<t class=" in time_data:
k["act_end_time"] = time_data[1] time_data = findall("<[a-zA-Z]+.*?>([\s\S]*?)</[a-zA-Z]*?>", time_data)[0]
elif len(time_data) == 1 and len(time_limit_end) == 1: k["time_data"] = time_data
k["act_begin_time"] = time_data[0] elif value.text == "〓活动时间〓":
k["act_end_time"] = time_limit_end[0] time_data = content_bs.find_all("p")[index + 1].text
elif len(time_data) == 1 and len(time_limit_start) == 1: time_data = time_data.replace("</t>", "")[16:]
k["act_begin_time"] = time_limit_start[0] k["time_data"] = time_data
k["act_end_time"] = time_data[0] elif value.text == "〓祈愿介绍〓":
elif len(time_data) == 1: start_time = content_bs.find_all("tr")[1].td.find_all("p")[0].text
k["act_begin_time"] = time_data[0] if "<t class=" in start_time:
k["act_end_time"] = "永久开放" start_time = findall("<[a-zA-Z]+.*?>([\s\S]*?)</[a-zA-Z]*?>", start_time)[0]
elif len(time_data) > 2: end_time = findall("<[a-zA-Z]+.*?>([\s\S]*?)</[a-zA-Z]*?>",
k["act_begin_time"] = time_data[0] content_bs.find_all("tr")[1].td.find_all("p")[2].text)[0]
k["act_end_time"] = k["end_time"] if "<t class=" in end_time:
elif len(time_data) == 0: end_time = findall("<[a-zA-Z]+.*?>([\s\S]*?)</[a-zA-Z]*?>", end_time)[0]
k["act_begin_time"] = k["start_time"] + "(?)" time_data = start_time + "~" + end_time
k["act_end_time"] = k["end_time"] + "(?)" k["time_data"] = time_data
if "冒险助力礼包" in k["title"] or "纪行" in k["title"]: if "冒险助力礼包" in k["title"] or "纪行" in k["title"]:
continue continue
@ -91,7 +92,7 @@ def generate_event():
for index, value in enumerate(event_data['normal_event']): for index, value in enumerate(event_data['normal_event']):
img = Image.open(BytesIO(get(value["banner"]).content)) img = Image.open(BytesIO(get(value["banner"]).content))
base_draw.text((540, 300 + 45 + 390 + (390 + 90) * index + 1), 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") anchor="mm")
# base_img.paste(img,((index%2)*1080,300 + 390*(index//2))) # base_img.paste(img,((index%2)*1080,300 + 390*(index//2)))
base_img.paste(img, (0, 300 + (390 + 90) * index)) 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']): for index, value in enumerate(event_data['gacha_event']):
img = Image.open(BytesIO(get(value["banner"]).content)) 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)), 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") anchor="mm")
# base_img.paste(img,((index%2)*1080,600 + ((1 + len(event_data['normal_event']))//2)*390 + # base_img.paste(img,((index%2)*1080,600 + ((1 + len(event_data['normal_event']))//2)*390 +
# 533*(index//2))) # 533*(index//2)))

@ -1 +1 @@
Subproject commit 5760a38384e6dfdf95ec4ebdf410c3bee0537003 Subproject commit 5e5c711faea42625bdf0eea39ffdd85dada87b3e

View File

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