🤡小丑!浪费生命啊

This commit is contained in:
EillesWan 2024-07-19 02:04:47 +08:00
parent dd03dd6d3e
commit d0d347e4e3
11 changed files with 109 additions and 89 deletions

View File

@ -4,8 +4,8 @@
[![][banner]][lightyuki-link]
<h2>>尹灵温<<a href="https://bot.liteyuki.icu"> <span style="color: #a2d8f4">轻雪</span> <span style="color: #d0e9ff">6</span></a></h2>
<h4> <span style="color: #a2d8f4">✨ 轻量,高效,易于扩展✨</span></h4>
<h2>>尹灵温<<a href="https://bot.liteyuki.icu"> <span style="color: #007ebd">轻雪</span> <span style="color: #32383D">6</span></a></h2>
<h4> <span style="color: #007ebd">✨ 轻量,高效,易于扩展✨</span></h4>
[![][OneBot]][onebot-link]
[![][NoneBot2]][nonebot-link]

View File

@ -4,7 +4,7 @@ function applyStyle() {
// 插入现成的html文本
let title = item.getAttribute('data-title')
let tabStr =
"<div class='tab' style='display: flex; background-color: #d0e9ff'>" +
"<div class='tab' style='display: flex; background-color: #32383D'>" +
" <div class='tab-buttons'>" +
" <div class='tab-button' style='background-color: #FF5F57'></div>" +
" <div class='tab-button' style='background-color: #FFBD2E'></div>" +

View File

@ -135,7 +135,7 @@ weather.no_key=无天监司遥讯之玥,请于设增
status.friends=友
status.groups=羣
status.plugins=件
status.plugins=
status.resources=件资
status.bots=工造灵机
status.message_sent=方传

View File

@ -1,7 +1,7 @@
:root {
--main-text-color: #fff;
--sub-text-color: #ccc;
--tip-text-color: #999;
--main-text-color: #000;
--sub-text-color: #333;
--tip-text-color: #777;
--device-info-width: 240px;
}
@ -14,7 +14,7 @@ body {
background-repeat: repeat-y;
background-size: cover;
background-position: center;
text-shadow: 1px 1px 2px black;
text-shadow: 1px 1px 2px white;
margin: 20px;
}
@ -22,7 +22,7 @@ body {
/* border-radius: 60px; */
padding: 40px;
backdrop-filter: blur(10px);
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(255, 255, 255, 0.5);
margin-bottom: 20px;
}

View File

@ -31,7 +31,7 @@
}
/*MapleMono*/
@font-face {
/* @font-face {
font-family: 'MapleMono';
src: url('../fonts/MapleMono/MapleMono-Light.woff2') format('woff2');
font-weight: 200;
@ -69,8 +69,8 @@
src: url('../fonts/MapleMono/MapleMono-BoldItalic.woff2') format('woff2');
font-weight: 700;
font-style: italic;
}
} */
* {
font-family: 'MapleMono', 'MiSans', sans-serif;
font-family: 'MiSans', sans-serif;
}

View File

@ -1,7 +1,7 @@
:root {
--main-text-color: #fff;
--sub-text-color: #ccc;
--tip-text-color: #999;
--main-text-color: #000;
--sub-text-color: #333;
--tip-text-color: #777;
--device-info-width: 240px;
}
@ -9,17 +9,26 @@
display: flex;
}
.bot-icon-tags {
display: flex;
flex-direction:row;
justify-content: space-between;
/* margin-left: auto; */
}
.bot-icon {
display: flex;
width: 220px;
align-items: center;
justify-content: center;
margin-right: 20px;
margin-right: 15px;
/* margin-left: 20px; */
}
.bot-icon-img {
height: 220px;
width: 220px;
display: flex;
height: 210px;
width: 210px;
/* border-radius: 50%; */
}
@ -36,16 +45,19 @@
color: var(--sub-text-color);
font-size: 30px;
font-weight: 700;
line-height: 1.6;
line-height: 1.4;
text-align: end;
/* width: 700px; */
}
.bot-tag[suffix="1"]::after {
content: "|";
.bot-tag[suffix="1"]::before {
content: " | ";
display: inline-block;
margin: 0 5px;
height: 30%;
line-height: 50%;
/* margin: 0 5px; */
height: 20%;
line-height: 30%;
color: var(--tip-text-color);
/* text-align: end; */
}
/*修改bot-info 下hr样式*/
@ -55,6 +67,7 @@
background: var(--tip-text-color);
margin: 10px 0;
width: 100%;
/* text-align: end; */
}
#hardware-info {
@ -87,13 +100,13 @@
position: relative;
width: 100%;
height: 60px;
background-color: #ffffff44;
background-color: #00000044;
/* border-radius: 30px; */
align-items: center;
}
.disk-usage {
background-color: #a2d8f4;
background-color: #007ebd;
height: 100%;
/* border-radius: 30px; */
position: absolute;
@ -103,15 +116,15 @@
.disk-title {
position: absolute;
color: var(--main-text-color);
font-size: 24px;
margin-bottom: 10px;
font-size: 25px;
margin-bottom: 7px;
margin-left: 20px;
text-align: left;
z-index: 2;
}
#motto-text {
font-size: 36px;
font-size: 42px;
word-wrap: break-word;
color: var(--main-text-color);
text-align: center;
@ -119,16 +132,16 @@
}
#motto-from {
font-size: 30px;
font-size: 32px;
font-style: italic;
color: var(--sub-text-color);
text-align: right;
}
#addition-info {
font-size: 36px;
font-size: 32px;
word-wrap: break-word;
color: var(--main-text-color);
text-align: center;
margin: 30px 0 10px 0;
/* margin: 30px 0 10px 0; */
}

View File

@ -2,7 +2,7 @@ body {
background-repeat: repeat-y;
background-size: cover;
background-position: center;
color: white;
color: black;
/* // 上10px左右10px下0px // margin: 24 px; */
margin: 20px;
}
@ -11,7 +11,7 @@ body {
border-radius: 30px;
padding: 30px;
backdrop-filter: blur(10px);
background-color: rgba(0, 0, 0, 0.3);
background-color: rgba(255, 255, 255, 0.3);
margin-bottom: 20px;
}
@ -52,7 +52,7 @@ body {
.bot-icon {
/* border-radius: 50%; */
height: 200px;
background-color: white;
background-color: black;
}
.bot-name,
@ -87,21 +87,21 @@ body {
margin: 0 5px;
height: 50%;
line-height: 50%;
color: #ccc;
color: #333;
}
.motto-text {
font-size: 36px;
color: #fff;
color: #000;
}
.motto-author {
font-size: 30px;
font-style: italic;
color: #ccc;
color: #333;
}
.addition-info {
font-size: 32px;
color: #fff;
color: #000;
}

View File

@ -19,7 +19,7 @@ function createPieChartOption(title, data) {
left: 'center',
top: 'center',
textStyle: {
color: '#fff',
color: '#000',
fontSize: 30,
lineHeight: 36
}
@ -27,9 +27,9 @@ function createPieChartOption(title, data) {
tooltip: {
show: true,
trigger: 'item',
backgroundColor: '#fff',
backgroundColor: '#000',
},
color: data.length === 3 ? ['#00a6ff', '#a2d8f4', "#ffffff44"] : ['#a2d8f4', '#ffffff44'],
color: data.length === 3 ? ['#053349', '#007ebd', "#00000044"] : ['#007ebd', '#00000044'],
series: [
{
name: 'info',
@ -128,11 +128,11 @@ function main() {
botInfoDiv.querySelector('.bot-name').innerText = bot['name']
let tagArray = [
bot['protocol_name'],
bot['app_name'],
`${localData['groups']} ${bot['groups']}`,
`${localData['friends']} ${bot['friends']}`,
`${localData['message_sent']} ${bot['message_sent']}`,
`${localData['message_received']} ${bot['message_received']}`,
`${bot['app_name']}`,
`${localData['groups']}${bot['groups']}`,
`${localData['friends']}${bot['friends']}`,
`${localData['message_sent']}${bot['message_sent']}`,
`${localData['message_received']}${bot['message_received']}`,
]
// 添加一些标签
tagArray.forEach(
@ -141,7 +141,7 @@ function main() {
tagSpan.className = 'bot-tag'
tagSpan.innerText = tag
// 给最后一个标签不添加后缀
tagSpan.setAttribute('suffix', index === tagArray.length - 1 ? '0' : '1')
tagSpan.setAttribute('suffix', (index === 0)||(tag[0] == '\n') ? '0' : '1')
botInfoDiv.querySelector('.bot-tags').appendChild(tagSpan)
}
)
@ -154,16 +154,16 @@ function main() {
let liteyukiInfoDiv = document.importNode(document.getElementById('bot-template').content, true) // 复制模板
liteyukiInfoDiv.className = 'info-box bot-info'
liteyukiInfoDiv.querySelector('.bot-icon-img').setAttribute('src', './img/liteyuki.png')
liteyukiInfoDiv.querySelector('.bot-name').innerText = liteyukiData['name']
liteyukiInfoDiv.querySelector('.bot-name').innerText = `${liteyukiData['name']} - 睿乐`
let tagArray = [
`Liteyuki ${liteyukiData['version']}`,
`灵温 ${liteyukiData['version']}`,
`Nonebot ${liteyukiData['nonebot']}`,
liteyukiData['python'],
`${liteyukiData['python']}`,
liteyukiData['system'],
`${localData['plugins']} ${liteyukiData['plugins']}`,
`${localData['resources']} ${liteyukiData['resources']}`,
`${localData['bots']} ${liteyukiData['bots']}`,
`${localData['plugins']}${liteyukiData['plugins']}`,
`${localData['resources']}${liteyukiData['resources']}`,
`${localData['bots']}${liteyukiData['bots']}`,
`${localData['runtime']} ${secondsToTextTime(liteyukiData['runtime'])}`,
]
tagArray.forEach(
@ -172,7 +172,7 @@ function main() {
tagSpan.className = 'bot-tag'
tagSpan.innerText = tag
// 给最后一个标签不添加后缀
tagSpan.setAttribute('suffix', index === tagArray.length - 1 ? '0' : '1')
tagSpan.setAttribute('suffix', (index === 0)||(tag[0] == '\n') ? '0' : '1')
liteyukiInfoDiv.querySelector('.bot-tags').appendChild(tagSpan)
}
)

View File

@ -70,7 +70,7 @@
botName.innerText = bot.name;
if (bot.self) {
// 添加颜色
botName.style.color = '#d0e9ff';
botName.style.color = '#32383D';
}
botDetail.appendChild(botName);
@ -88,7 +88,7 @@
tagSpan.className = 'tag';
if (bot.self) {
// 添加颜色
tagSpan.style.color = '#a2d8f4';
tagSpan.style.color = '#007ebd';
}
botTags.appendChild(tagSpan);
if (index === bot.tags.length - 1) {
@ -147,17 +147,17 @@
//文字颜色
lineHeight: 36,
color: '#fff',
color: '#000',
fontSize: 30
}
},
tooltip: {
show: true,
trigger: "item",
backgroundColor: "#ffffff00",
backgroundColor: "#00000000",
// {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
},
color: ['#a2d8f4', "#ffffff44", '#00a6ff'],
color: ['#007ebd', "#00000044", '#053349'],
series: [
{
name: 'info',
@ -196,20 +196,20 @@
}
// data为百分比最大值为100
return {
background: '#d0e9ff',
background: '#32383D',
title: {
text: title,
left: '5%',
top: 'center',
textStyle: {
color: '#fff',
color: '#000',
fontSize: 30
}
},
tooltip: {
show: true,
trigger: "item",
backgroundColor: "#ffffff",
backgroundColor: "#000000",
},
grid: {
left: '0',
@ -234,7 +234,7 @@
data: [percent],
itemStyle: {
normal: {
color: '#a2d8f4',
color: '#007ebd',
barBorderRadius: [50, 0, 0, 50]
}
},
@ -246,7 +246,7 @@
data: [100 - percent],
itemStyle: {
normal: {
color: '#d0e9ff',
color: '#32383D',
barBorderRadius: [fillet, 50, 50, fillet]
}
},

View File

@ -12,17 +12,20 @@
<body>
<template id="bot-template">
<div class="info-box bot-info">
<div class="bot-icon">
<div class="info-box bot-info" style="justify-content: space-between;">
<div class="bot-icon" style="text-align:start;">
<img class="bot-icon-img" src="" alt="bot-icon">
</div>
<div class="bot-detail">
<div class="bot-name">
<div class="bot-name" style="text-align:start">
TriM-Liteyuki
</div>
<hr>
<div class="bot-tags">
<!-- tag span-->
<div class="bot-icon-tags">
<!-- <div style="text-align:start; width: 10px;"> <img src="./img/empty.png"></div> -->
<div class="bot-tags">
<!-- tag span-->
</div>
</div>
</div>
</div>

View File

@ -6,8 +6,9 @@ import time
import nonebot
__NAME__ = "LiteyukiBot"
__VERSION__ = "6.3.2" # 60201
__NAME__ = "LiteyukiBot-Trim"
__VERSION__ = "6.3.3" # 60201
# __VERSION_I__ = 99060303
import requests
@ -18,32 +19,32 @@ from git import Repo
major, minor, patch = map(int, __VERSION__.split("."))
__VERSION_I__ = major * 10000 + minor * 100 + patch
__VERSION_I__ = 99000000 + major * 10000 + minor * 100 + patch
def register_bot():
url = "https://api.liteyuki.icu/register"
data = {
"name" : __NAME__,
"version" : __VERSION__,
"version_i": __VERSION_I__,
"python" : f"{platform.python_implementation()} {platform.python_version()}",
"os" : f"{platform.system()} {platform.version()} {platform.machine()}"
"name": __NAME__,
"version": __VERSION__,
"version_i": __VERSION_I__,
"python": f"{platform.python_implementation()} {platform.python_version()}",
"os": f"{platform.system()} {platform.version()} {platform.machine()}",
}
try:
nonebot.logger.info("Waiting for register to Liteyuki...")
nonebot.logger.info("正在等待 Liteyuki 注册服务器…")
resp = requests.post(url, json=data, timeout=(10, 15))
if resp.status_code == 200:
data = resp.json()
if liteyuki_id := data.get("liteyuki_id"):
with open("data/liteyuki/liteyuki.json", "wb") as f:
f.write(json.dumps(data).encode("utf-8"))
nonebot.logger.success(f"Register {liteyuki_id} to Liteyuki successfully")
nonebot.logger.success(f"成功将 {liteyuki_id} 注册到 Liteyuki 服务器")
else:
raise ValueError(f"Register to Liteyuki failed: {data}")
raise ValueError(f"无法向 Liteyuki 服务器注册:{data}")
except Exception as e:
nonebot.logger.warning(f"Register to Liteyuki failed, but it's no matter: {e}")
nonebot.logger.warning(f"向 Liteyuki 服务器注册失败,但无所谓:{e}")
def init():
@ -56,21 +57,25 @@ def init():
auto_migrate()
init_log()
if sys.version_info < (3, 10):
nonebot.logger.error("Requires Python3.10+ to run, please upgrade your Python Environment.")
nonebot.logger.error(
"此应用需要 Python3.10 以上的版本运行,你需要更新自己的 Python 运行环境了。"
)
exit(1)
try:
# 检测git仓库
repo = Repo(".")
except Exception as e:
nonebot.logger.error(f"Failed to load git repository: {e}, please clone this project from GitHub instead of downloading the zip file.")
nonebot.logger.error(
f"无法读取 Git 仓库 {e}你是否是从仓库内下载的Zip文件请使用git clone。"
)
temp_data: TempConfig = common_db.where_one(TempConfig(), default=TempConfig())
temp_data: TempConfig = common_db.where_one(TempConfig(), default=TempConfig()) # type: ignore
temp_data.data["start_time"] = time.time()
common_db.save(temp_data)
# 在加载完成语言后再初始化日志
nonebot.logger.info("Liteyuki is initializing...")
nonebot.logger.info("尹灵温 正在初始化…")
if not os.path.exists("data/liteyuki/liteyuki.json"):
register_bot()
@ -80,7 +85,6 @@ def init():
f.write("[tool.nonebot]\n")
nonebot.logger.info(
f"Run Liteyuki with Python{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} "
f"at {sys.executable}"
f"正在 {sys.executable} Python{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} 上运行 尹灵温"
)
nonebot.logger.info(f"{__NAME__} {__VERSION__}({__VERSION_I__}) is running")
nonebot.logger.info(f"{__NAME__} {__VERSION__}({__VERSION_I__}) 正在运行")