Fix small bugs and redesign some cards (#8)

* fix: 🐛 fix some config examples

* docs: 📝 add doc that install genshin.py with starrail support

* fix: 🐛 suring mysql won't think 'admin' as sys word

* feat(stats):  new design of stats card

* feat(gacha):  new design of gacha log card
This commit is contained in:
CWorld 2023-05-07 18:56:52 +08:00 committed by GitHub
parent a9dca3bf2a
commit 5616f0637c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 324 additions and 314 deletions

View File

@ -40,7 +40,7 @@ OWNER=0
# VERIFY_GROUPS=[] # VERIFY_GROUPS=[]
# logger 配置 可选配置项 # logger 配置 可选配置项
# LOGGER_NAME="TGPaimon" # LOGGER_NAME="HonkaiStarRailGram"
# 打印时的宽度 # 打印时的宽度
# LOGGER_WIDTH=180 # LOGGER_WIDTH=180
# log 文件存放目录 # log 文件存放目录
@ -80,12 +80,11 @@ LOGGER_FILTERED_NAMES=["uvicorn","ErrorPush","ApiHelper"]
# API_ID=12345 # API_ID=12345
# API_HASH="abcdefg" # API_HASH="abcdefg"
# ENKA_NETWORK_API 可选配置项 # ENKA_NETWORK_API 可选配置项(暂时无法使用)
# ENKA_NETWORK_API_AGENT="" # ENKA_NETWORK_API_AGENT=""
# Web Server # Web Server
# WEB_SWITCH=False # 是否开启 # WEB_ENABLE=False # 是否开启 WebServer
# WEB_URL=http://localhost:8080/
# WEB_HOST=localhost # WEB_HOST=localhost
# WEB_PORT=8080 # WEB_PORT=8080

1
.gitignore vendored
View File

@ -139,6 +139,7 @@ data/
plugins/genshin/daily/daily.json plugins/genshin/daily/daily.json
metadata/data/ metadata/data/
resources/assets/ resources/assets/
run.ps1
### private plugins ### ### private plugins ###
plugins/private plugins/private

View File

@ -13,7 +13,6 @@
基于 [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) 的 PaiGram 基于 [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) 的 PaiGram
![Alt](https://repobeats.axiom.co/api/embed/f73c1121006cb86196f83da2170242b7a97f8be0.svg "Repobeats analytics image") ![Alt](https://repobeats.axiom.co/api/embed/f73c1121006cb86196f83da2170242b7a97f8be0.svg "Repobeats analytics image")
## 环境需求 ## 环境需求
@ -37,6 +36,10 @@ poetry install
poetry run playwright install chromium poetry run playwright install chromium
``` ```
```bash
pip install git+https://github.com/PaiGramTeam/genshin.py@sr
```
#### 可选依赖项 #### 可选依赖项
```bash ```bash

View File

@ -193,7 +193,7 @@ def upgrade() -> None:
) )
try: try:
statement = "SELECT * FROM admin;" statement = "SELECT * FROM `admin`;"
old_user_table_data = connection.execute(text(statement)) old_user_table_data = connection.execute(text(statement))
except NoSuchTableError: except NoSuchTableError:
logger.warning("Table 'admin' doesn't exist") logger.warning("Table 'admin' doesn't exist")

View File

@ -1,341 +1,342 @@
@font-face { @font-face {
font-family: "tttgbnumber"; font-family: "tttgbnumber";
src: url("./../../fonts/tttgbnumber.ttf"); src: url("./../../fonts/tttgbnumber.ttf");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
* { .header {
margin: 0; background: #e0dad3 url(./img/starrail.png) no-repeat right;
padding: 0; box-shadow: 0 0 8px #72a2ae79;
box-sizing: border-box; }
user-select: none;
.frame {
border-color: #cdbea8;
} }
body { body {
font-size: 18px; font-size: 18px;
color: #1e1f20; color: #1e1f20;
font-family: PingFangSC-Medium, PingFang SC, sans-serif; font-family: PingFangSC-Medium, PingFang SC, sans-serif;
transform: scale(1.5); transform: scale(1.5);
transform-origin: 0 0; transform-origin: 0 0;
width: 510px; width: 510px;
} }
.container { .container {
width: 510px; width: 510px;
padding: 20px 15px 10px 15px; padding: 20px 15px 10px 15px;
background-color: #f5f6fb; background-color: #f5f6fb;
} }
.head_box { .head_box {
border-radius: 9999px; border-radius: 9999px;
font-family: tttgbnumber, sans-serif; font-family: tttgbnumber, sans-serif;
padding: 10px 20px; padding: 10px 20px;
position: relative; position: relative;
box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%); box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%);
} }
.head_box .id_text { .head_box .id_text {
font-size: 24px; font-size: 24px;
} }
.head_box .day_text { .head_box .day_text {
font-size: 20px; font-size: 20px;
} }
.head_box .starrail_logo { .head_box .starrail_logo {
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 30px; right: 30px;
width: 120px; width: 120px;
} }
.logo { .logo {
font-size: 12px; font-size: 12px;
font-family: "tttgbnumber", serif; font-family: "tttgbnumber", serif;
text-align: center; text-align: center;
color: #7994a7; color: #7994a7;
position: relative; position: relative;
padding-left: 10px; padding-left: 10px;
} }
.data_box { .data_box {
border-radius: 15px; border-radius: 15px;
margin-top: 20px; margin-top: 20px;
margin-bottom: 10px; margin-bottom: 10px;
padding: 20px 0 5px 10px; padding: 20px 0 5px 10px;
background: #fff; background: #fff;
box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%); box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%);
position: relative; position: relative;
} }
.tab_lable { .tab_lable {
position: absolute; position: absolute;
top: -10px; top: -10px;
left: -8px; left: -8px;
background: #d4b98c; background: #d4b98c;
color: #fff; color: #fff;
font-size: 14px; font-size: 14px;
padding: 3px 10px; padding: 3px 10px;
border-radius: 15px 0 15px 15px; border-radius: 15px 0 15px 15px;
z-index: 20; z-index: 20;
} }
.data_line { .data_line {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
margin-bottom: 14px; margin-bottom: 14px;
padding-right: 10px; padding-right: 10px;
} }
.data_line_item { .data_line_item {
width: 100px; width: 100px;
text-align: center; text-align: center;
/* margin: 0 20px; */ /* margin: 0 20px; */
} }
.num { .num {
font-family: tttgbnumber, serif; font-family: tttgbnumber, serif;
font-size: 24px; font-size: 24px;
} }
.num .unit { .num .unit {
font-size: 12px; font-size: 12px;
} }
.data_box .lable { .data_box .lable {
font-size: 14px; font-size: 14px;
color: #7f858a; color: #7f858a;
line-height: 1; line-height: 1;
margin-top: 3px; margin-top: 3px;
} }
.info_box_border { .info_box_border {
border-radius: 15px; border-radius: 15px;
/* margin-top: 20px; */ /* margin-top: 20px; */
margin-bottom: 20px; margin-bottom: 20px;
padding: 6px 0 5px 10px; padding: 6px 0 5px 10px;
background: #fff; background: #fff;
box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%); box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%);
position: relative; position: relative;
} }
.card_list { .card_list {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
} }
.card_list .item { .card_list .item {
margin: 0 8px 10px 0; margin: 0 8px 10px 0;
border-radius: 7px; border-radius: 7px;
box-shadow: 0 2px 6px 0 rgb(132 93 90 / 30%); box-shadow: 0 2px 6px 0 rgb(132 93 90 / 30%);
height: 90px; height: 90px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
background: #e7e5d9; background: #e7e5d9;
} }
.card_list .item img { .card_list .item img {
width: 70px; width: 70px;
height: 70px; height: 70px;
border-radius: 7px 7px 20px 0; border-radius: 7px 7px 20px 0;
} }
.card_list .item.star5 img { .card_list .item.star5 img {
background-image: url(./../../genshin/abyss/background/roleStarBg5.png); background-image: url(./../../genshin/abyss/background/roleStarBg5.png);
width: 100%; width: 100%;
height: 70px; height: 70px;
/* filter: brightness(1.1); */ /* filter: brightness(1.1); */
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.card_list .item.star4 img { .card_list .item.star4 img {
width: 100%; width: 100%;
height: 70px; height: 70px;
background-image: url(./../../genshin/abyss/background/roleStarBg4.png); background-image: url(./../../genshin/abyss/background/roleStarBg4.png);
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.card_list .item .num { .card_list .item .num {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
z-index: 9; z-index: 9;
font-size: 18px; font-size: 18px;
text-align: center; text-align: center;
color: #fff; color: #fff;
border-radius: 3px; border-radius: 3px;
padding: 1px 5px; padding: 1px 5px;
background: rgb(0 0 0 / 50%); background: rgb(0 0 0 / 50%);
font-family: "tttgbnumber", serif; font-family: "tttgbnumber", serif;
} }
.card_list .item .name, .card_list .item .name,
.card_list .item .num_name { .card_list .item .num_name {
position: absolute; position: absolute;
top: 71px; top: 71px;
left: 0; left: 0;
z-index: 9; z-index: 9;
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 16px; height: 16px;
line-height: 18px; line-height: 18px;
} }
.card_list .item .num_name { .card_list .item .num_name {
font-family: "tttgbnumber", serif; font-family: "tttgbnumber", serif;
font-size: 16px; font-size: 16px;
} }
.base_info { .base_info {
position: relative; position: relative;
padding-left: 10px; padding-left: 10px;
margin: 5px 10px; margin: 5px 10px;
} }
.uid::before { .uid::before {
content: " "; content: " ";
position: absolute; position: absolute;
width: 5px; width: 5px;
height: 24px; height: 24px;
border-radius: 1px; border-radius: 1px;
left: 0; left: 0;
top: 0; top: 0;
background: #d3bc8d; background: #d3bc8d;
} }
.label_301 { .label_301 {
background-color: rgb(235 106 75); background-color: rgb(235 106 75);
} }
.label_302 { .label_302 {
background-color: #e69449; background-color: #e69449;
} }
.label_200 { .label_200 {
background-color: #757cc8; background-color: #757cc8;
} }
.label { .label {
color: #fff; color: #fff;
border-radius: 10px; border-radius: 10px;
font-size: 12px; font-size: 12px;
padding: 2px 7px; padding: 2px 7px;
vertical-align: 2px; vertical-align: 2px;
} }
.ritem { .ritem {
display: flex; display: flex;
font-size: 12px; font-size: 12px;
margin-bottom: 5px; margin-bottom: 5px;
} }
.info_role { .info_role {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0 0 5px 9px; padding: 0 0 5px 9px;
} }
.ritem .role { .ritem .role {
width: 20px; width: 20px;
height: 20px; height: 20px;
background-color: #ffb285; background-color: #ffb285;
border-radius: 100%; border-radius: 100%;
} }
.ritem .weapon_box { .ritem .weapon_box {
overflow: hidden; overflow: hidden;
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 100%; border-radius: 100%;
} }
.ritem .weapon { .ritem .weapon {
width: 20px; width: 20px;
height: 20px; height: 20px;
background-color: #ffb285; background-color: #ffb285;
border-radius: 100%; border-radius: 100%;
transform: scale(1.5); transform: scale(1.5);
-webkit-transform: scale(1.5); -webkit-transform: scale(1.5);
} }
.ritem .role_text { .ritem .role_text {
margin: 2px 3px 0 2px; margin: 2px 3px 0 2px;
display: flex; display: flex;
align-items: baseline; align-items: baseline;
} }
.ritem .role_name { .ritem .role_name {
width: 24px; width: 24px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
} }
.ritem .role_num { .ritem .role_num {
width: 24px; width: 24px;
} }
.line_box { .line_box {
height: 32px; height: 32px;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
font-size: 12px; font-size: 12px;
color: #7d7d7d; color: #7d7d7d;
padding-bottom: 5px; padding-bottom: 5px;
} }
.line_box .line { .line_box .line {
height: 2px; height: 2px;
flex-grow: 1; flex-grow: 1;
background-color: #ebebeb; background-color: #ebebeb;
margin: 0 10px; margin: 0 10px;
} }
.red { .red {
color: #f21000; color: #f21000;
} }
.orange { .orange {
color: #ff8d00; color: #ff8d00;
} }
.green { .green {
color: #12d88c; color: #12d88c;
} }
.blue { .blue {
color: #4169e1; color: #4169e1;
} }
.purple { .purple {
color: #7500ff; color: #7500ff;
} }
.minimum { .minimum {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
z-index: 9; z-index: 9;
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
color: #fff; color: #fff;
border-radius: 3px; border-radius: 3px;
padding: 1px 3px; padding: 1px 3px;
background-color: rgb(0 0 0 / 80%); background-color: rgb(0 0 0 / 80%);
font-family: "tttgbnumber", serif; font-family: "tttgbnumber", serif;
} }
.hasMore { .hasMore {
font-size: 12px; font-size: 12px;
margin: 6px 0; margin: 6px 0;
color: #7f858a; color: #7f858a;
} }

View File

@ -1,88 +1,80 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/> <meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="shortcut icon" href="#"/> <link rel="stylesheet" type="text/css" href="gacha_log.css" />
<link rel="stylesheet" type="text/css" href="gacha_log.css"/> <link type="text/css" href="../../styles/public.css" rel="stylesheet" />
<link rel="preload" href="./../../fonts/tttgbnumber.ttf" as="font"> <link rel="preload" href="./img/starrail.png" as="image" />
<link rel="preload" href="./img/提纳里.png" as="image"> <script src="../../js/tailwindcss-3.1.8.js"></script>
<link rel="preload" href="./../../genshin/abyss/background/roleStarBg5.png" as="image"> <title>Title</title>
<link rel="preload" href="./../../genshin/abyss/background/roleStarBg4.png" as="image"> </head>
<style> <body id="container" class="body_box">
.head_box { <div class="container">
background-position: right center; <div class="info_box">
background: #fff url(./img/提纳里.png) no-repeat; <div class="header p-2 rounded-xl bg-contain mb-6">
background-size: cover; <div class="frame p-4 flex-col rounded-lg border-solid border-2">
} <h2 class="font-bold italic">ID: {{ uid }}</h2>
</style> <h2 class="italic">
<title></title> {{ allNum }}抽
</head> <span class="label text-neutral-600 label_{{type}}"
<body id="container" class="body_box"> >{{ typeName }}</span
<div class="container"> >
<div class="info_box">
<div class="head_box">
<div class="id_text">
ID: {{ uid }}
</div>
<h2 class="day_text">
{{ allNum }}抽
<span class="label label_{{type}}">{{ typeName }}</span>
</h2> </h2>
<img class="starrail_logo" src="./../../bot/help/background/starrail.png" alt=""/> </div>
</div> </div>
<div class="data_box"> <div class="data_box">
<div class="tab_lable">数据总览</div> <div class="tab_lable">数据总览</div>
{% for val in line %} {% for val in line %}
<div class="data_line"> <div class="data_line">
{% for item in val %} {% for item in val %}
<div class="data_line_item"> <div class="data_line_item">
<div class="num">{{item.num}}<span class="unit">{{item.unit}}</span></div> <div class="num">
<div class="lable">{{item.lable}}</div> {{item.num}}<span class="unit">{{item.unit}}</span>
</div> </div>
{% endfor %} <div class="lable">{{item.lable}}</div>
</div> </div>
{% endfor %} {% endfor %}
</div>
{% endfor %}
<div class="line_box"> <div class="line_box">
<span class="line"></span> <span class="line"></span>
<span class="text">五星历史 {{firstTime}} ~ {{lastTime}}</span> <span class="text">五星历史 {{firstTime}} ~ {{lastTime}}</span>
<span class="line"></span> <span class="line"></span>
</div>
<div class="card_list">
{% for val in fiveLog %}
<div class="item star5">
{% if val.isUp %}
<span class="minimum">UP</span>
{% endif %}
<img class="role" src="{{ val.icon }}" alt="" />
<!-- <div class="num">{{val.num}}</div>-->
<div class="num_name">{{ val.count }}</div>
</div> </div>
{% endfor %}
</div>
<div class="line_box">
<span class="line"></span>
<span class="text">四星最近历史</span>
<span class="line"></span>
</div>
<div class="card_list"> <div class="card_list">
{% for val in fiveLog %} {% for val in fourLog %}
<div class="item star5"> <div class="item star4">
{% if val.isUp %} <img class="role" src="{{ val.icon }}" alt="" />
<span class="minimum">UP</span> <!-- <div class="num">{{val.num}}</div>-->
{% endif %} <div class="num_name">{{ val.count }}</div>
<img class="role" src="{{ val.icon }}" alt=""/>
<!-- <div class="num">{{val.num}}</div>-->
<div class="num_name">{{ val.count }}</div>
</div>
{% endfor %}
</div>
<div class="line_box">
<span class="line"></span>
<span class="text">四星最近历史</span>
<span class="line"></span>
</div>
<div class="card_list">
{% for val in fourLog %}
<div class="item star4">
<img class="role" src="{{ val.icon }}" alt=""/>
<!-- <div class="num">{{val.num}}</div>-->
<div class="num_name">{{ val.count }}</div>
</div>
{% endfor %}
</div> </div>
{% endfor %}
</div>
</div> </div>
<div class="logo"> Template By Yunzai-Bot</div> <div class="logo">Template By Yunzai-Bot</div>
</div>
</div> </div>
</div> </body>
</body> </html>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

View File

@ -13,18 +13,25 @@
</head> </head>
<body class="text-neutral-600"> <body class="text-neutral-600">
<div class="mx-auto max-w-[600px] py-8"> <div class="mx-auto max-w-[600px] py-8">
<div class="header p-6 flex mb-8 rounded-xl bg-cover justify-between"> <div class="header p-2 rounded-xl bg-cover mb-6">
<div class="flex flex-col items-center justify-center"> <div
<h1 class="text-4xl italic name mb-2 px-2"> class="frame-pic p-4 flex justify-between rounded-lg border-solid border-2"
{{ info.nickname }} >
<span class="text-lg">lv.{{ info.level }}</span> <div class="flex flex-col items-center justify-center">
</h1> <h1 class="name text-4xl italic mb-2 px-2 text-shadow">
<h1 class="italic uid px-10">UID - {{ uid }}</h1> {{ info.nickname }}
<span class="text-lg">lv.{{ info.level }}</span>
</h1>
<h1 class="italic uid px-10">UID - {{ uid }}</h1>
</div>
</div> </div>
</div> </div>
<div class="box pt-4 rounded-xl overflow-hidden"> <div class="box p-2 rounded-xl overflow-hidden">
<div> <div class="frame rounded-lg border-solid border-2">
<h2 class="box-title text-center text-xl ring text-neutral-100 p-1"> <h2
class="title font-semibold pt-4 text-center text-xl text-neutral-700 p-1"
>
<img src="./items/star.png" class="inline-block w-4" />
数据总览 数据总览
</h2> </h2>
<div class="p-6 grid grid-cols-4 gap-4 text-center"> <div class="p-6 grid grid-cols-4 gap-4 text-center">
@ -35,10 +42,10 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div>
<div class="about text-center leading-8 text-xs opacity-50"> <div class="about text-center leading-8 text-xs opacity-50">
所有数据会有一小时延迟 以游戏内为准 此处仅供参考 所有数据会有一小时延迟 以游戏内为准 此处仅供参考
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,49 +1,56 @@
body { body {
background-color: #f5f6fb; background-color: #f5f6fb;
} }
.header { .header {
background-image: url(../../bot/help/background/header.png); background-image: url(../../bot/help/background/header.png);
box-shadow: 0 0 8px rgb(123 242 248 / 50%); box-shadow: 0 0 8px #72a2ae79;
} }
.box { .box {
background-color: #fdfdf3; background-color: #f4f2e4;
box-shadow: 0 0 8px rgb(123 242 248 / 50%); box-shadow: 0 0 8px #72a2ae79;
}
.box-title {
background-color: #43849abb;
--tw-ring-color: #43849a;
} }
.pointer-bar { .pointer-bar {
width: 95%; width: 95%;
height: 8px; height: 8px;
display: inline-block; display: inline-block;
background-color: rgb(0, 0, 0, 0.2); background-color: rgb(0, 0, 0, 0.2);
border-radius: 0.25rem; border-radius: 0.25rem;
} }
.pointer-progress-bar { .pointer-progress-bar {
border-radius: 0.25rem; border-radius: 0.25rem;
height: 100%; height: 100%;
background: #fff6e2; background: #fff6e2;
} }
.name { .name {
background: linear-gradient(to bottom, #FFFFEE, #FFEEFF, #EEFFFF); color: #ffffee;
background-clip: text; text-shadow: 0 0.08em 0.1em #00000093, 0 0.1em 0.3em rgba(0, 0, 0, 0.4);
-webkit-background-clip: text;
color: transparent;
} }
.uid { .uid {
color: #fff; color: #fff;
background: linear-gradient(to right, rgb(0, 0, 0, 0), #5ddddd, rgb(0, 0, 0, 0)); background: linear-gradient(
to right,
rgb(0, 0, 0, 0),
#3f7587 25%,
#3f7587 75%,
rgb(0, 0, 0, 0)
);
} }
.about { .about {
background-color: #e0dad3; background-color: #e0dad3;
color: #8a4d30; color: #8a4d30;
}
.frame-pic {
border-color: #fdfdf356;
}
.frame {
border-color: #cdbea8;
} }