mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-11 01:27:29 +08:00
🤡小丑!浪费生命啊
This commit is contained in:
parent
dd03dd6d3e
commit
d0d347e4e3
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
[![][banner]][lightyuki-link]
|
[![][banner]][lightyuki-link]
|
||||||
|
|
||||||
<h2>>尹灵温<<a href="https://bot.liteyuki.icu"> <span style="color: #a2d8f4">轻雪</span> <span style="color: #d0e9ff">6</span></a></h2>
|
<h2>>尹灵温<<a href="https://bot.liteyuki.icu"> <span style="color: #007ebd">轻雪</span> <span style="color: #32383D">6</span></a></h2>
|
||||||
<h4> <span style="color: #a2d8f4">✨ 轻量,高效,易于扩展✨</span></h4>
|
<h4> <span style="color: #007ebd">✨ 轻量,高效,易于扩展✨</span></h4>
|
||||||
|
|
||||||
[![][OneBot]][onebot-link]
|
[![][OneBot]][onebot-link]
|
||||||
[![][NoneBot2]][nonebot-link]
|
[![][NoneBot2]][nonebot-link]
|
||||||
|
@ -4,7 +4,7 @@ function applyStyle() {
|
|||||||
// 插入现成的html文本
|
// 插入现成的html文本
|
||||||
let title = item.getAttribute('data-title')
|
let title = item.getAttribute('data-title')
|
||||||
let tabStr =
|
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-buttons'>" +
|
||||||
" <div class='tab-button' style='background-color: #FF5F57'></div>" +
|
" <div class='tab-button' style='background-color: #FF5F57'></div>" +
|
||||||
" <div class='tab-button' style='background-color: #FFBD2E'></div>" +
|
" <div class='tab-button' style='background-color: #FFBD2E'></div>" +
|
||||||
|
@ -135,7 +135,7 @@ weather.no_key=无天监司遥讯之玥,请于设增
|
|||||||
|
|
||||||
status.friends=友
|
status.friends=友
|
||||||
status.groups=羣
|
status.groups=羣
|
||||||
status.plugins=件
|
status.plugins=附件
|
||||||
status.resources=件资
|
status.resources=件资
|
||||||
status.bots=工造灵机
|
status.bots=工造灵机
|
||||||
status.message_sent=方传
|
status.message_sent=方传
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
:root {
|
:root {
|
||||||
--main-text-color: #fff;
|
--main-text-color: #000;
|
||||||
--sub-text-color: #ccc;
|
--sub-text-color: #333;
|
||||||
--tip-text-color: #999;
|
--tip-text-color: #777;
|
||||||
--device-info-width: 240px;
|
--device-info-width: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ body {
|
|||||||
background-repeat: repeat-y;
|
background-repeat: repeat-y;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
text-shadow: 1px 1px 2px black;
|
text-shadow: 1px 1px 2px white;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ body {
|
|||||||
/* border-radius: 60px; */
|
/* border-radius: 60px; */
|
||||||
padding: 40px;
|
padding: 40px;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*MapleMono*/
|
/*MapleMono*/
|
||||||
@font-face {
|
/* @font-face {
|
||||||
font-family: 'MapleMono';
|
font-family: 'MapleMono';
|
||||||
src: url('../fonts/MapleMono/MapleMono-Light.woff2') format('woff2');
|
src: url('../fonts/MapleMono/MapleMono-Light.woff2') format('woff2');
|
||||||
font-weight: 200;
|
font-weight: 200;
|
||||||
@ -69,8 +69,8 @@
|
|||||||
src: url('../fonts/MapleMono/MapleMono-BoldItalic.woff2') format('woff2');
|
src: url('../fonts/MapleMono/MapleMono-BoldItalic.woff2') format('woff2');
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
} */
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-family: 'MapleMono', 'MiSans', sans-serif;
|
font-family: 'MiSans', sans-serif;
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
:root {
|
:root {
|
||||||
--main-text-color: #fff;
|
--main-text-color: #000;
|
||||||
--sub-text-color: #ccc;
|
--sub-text-color: #333;
|
||||||
--tip-text-color: #999;
|
--tip-text-color: #777;
|
||||||
--device-info-width: 240px;
|
--device-info-width: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9,17 +9,26 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bot-icon-tags {
|
||||||
|
display: flex;
|
||||||
|
flex-direction:row;
|
||||||
|
justify-content: space-between;
|
||||||
|
/* margin-left: auto; */
|
||||||
|
}
|
||||||
|
|
||||||
.bot-icon {
|
.bot-icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 220px;
|
width: 220px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-right: 20px;
|
margin-right: 15px;
|
||||||
|
/* margin-left: 20px; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.bot-icon-img {
|
.bot-icon-img {
|
||||||
height: 220px;
|
display: flex;
|
||||||
width: 220px;
|
height: 210px;
|
||||||
|
width: 210px;
|
||||||
/* border-radius: 50%; */
|
/* border-radius: 50%; */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,16 +45,19 @@
|
|||||||
color: var(--sub-text-color);
|
color: var(--sub-text-color);
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1.6;
|
line-height: 1.4;
|
||||||
|
text-align: end;
|
||||||
|
/* width: 700px; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.bot-tag[suffix="1"]::after {
|
.bot-tag[suffix="1"]::before {
|
||||||
content: "|";
|
content: " | ";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0 5px;
|
/* margin: 0 5px; */
|
||||||
height: 30%;
|
height: 20%;
|
||||||
line-height: 50%;
|
line-height: 30%;
|
||||||
color: var(--tip-text-color);
|
color: var(--tip-text-color);
|
||||||
|
/* text-align: end; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*修改bot-info 下hr样式*/
|
/*修改bot-info 下hr样式*/
|
||||||
@ -55,6 +67,7 @@
|
|||||||
background: var(--tip-text-color);
|
background: var(--tip-text-color);
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
/* text-align: end; */
|
||||||
}
|
}
|
||||||
|
|
||||||
#hardware-info {
|
#hardware-info {
|
||||||
@ -87,13 +100,13 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
background-color: #ffffff44;
|
background-color: #00000044;
|
||||||
/* border-radius: 30px; */
|
/* border-radius: 30px; */
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.disk-usage {
|
.disk-usage {
|
||||||
background-color: #a2d8f4;
|
background-color: #007ebd;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
/* border-radius: 30px; */
|
/* border-radius: 30px; */
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -103,15 +116,15 @@
|
|||||||
.disk-title {
|
.disk-title {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
font-size: 24px;
|
font-size: 25px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 7px;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#motto-text {
|
#motto-text {
|
||||||
font-size: 36px;
|
font-size: 42px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -119,16 +132,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#motto-from {
|
#motto-from {
|
||||||
font-size: 30px;
|
font-size: 32px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: var(--sub-text-color);
|
color: var(--sub-text-color);
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
#addition-info {
|
#addition-info {
|
||||||
font-size: 36px;
|
font-size: 32px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 30px 0 10px 0;
|
/* margin: 30px 0 10px 0; */
|
||||||
}
|
}
|
@ -2,7 +2,7 @@ body {
|
|||||||
background-repeat: repeat-y;
|
background-repeat: repeat-y;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
color: white;
|
color: black;
|
||||||
/* // 上10px,左右10px,下0px // margin: 24 px; */
|
/* // 上10px,左右10px,下0px // margin: 24 px; */
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
@ -11,7 +11,7 @@ body {
|
|||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
background-color: rgba(0, 0, 0, 0.3);
|
background-color: rgba(255, 255, 255, 0.3);
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ body {
|
|||||||
.bot-icon {
|
.bot-icon {
|
||||||
/* border-radius: 50%; */
|
/* border-radius: 50%; */
|
||||||
height: 200px;
|
height: 200px;
|
||||||
background-color: white;
|
background-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bot-name,
|
.bot-name,
|
||||||
@ -87,21 +87,21 @@ body {
|
|||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
height: 50%;
|
height: 50%;
|
||||||
line-height: 50%;
|
line-height: 50%;
|
||||||
color: #ccc;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.motto-text {
|
.motto-text {
|
||||||
font-size: 36px;
|
font-size: 36px;
|
||||||
color: #fff;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.motto-author {
|
.motto-author {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: #ccc;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.addition-info {
|
.addition-info {
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
color: #fff;
|
color: #000;
|
||||||
}
|
}
|
@ -19,7 +19,7 @@ function createPieChartOption(title, data) {
|
|||||||
left: 'center',
|
left: 'center',
|
||||||
top: 'center',
|
top: 'center',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#fff',
|
color: '#000',
|
||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
lineHeight: 36
|
lineHeight: 36
|
||||||
}
|
}
|
||||||
@ -27,9 +27,9 @@ function createPieChartOption(title, data) {
|
|||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: 'item',
|
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: [
|
series: [
|
||||||
{
|
{
|
||||||
name: 'info',
|
name: 'info',
|
||||||
@ -128,11 +128,11 @@ function main() {
|
|||||||
botInfoDiv.querySelector('.bot-name').innerText = bot['name']
|
botInfoDiv.querySelector('.bot-name').innerText = bot['name']
|
||||||
let tagArray = [
|
let tagArray = [
|
||||||
bot['protocol_name'],
|
bot['protocol_name'],
|
||||||
bot['app_name'],
|
`${bot['app_name']}`,
|
||||||
`${localData['groups']} ${bot['groups']}`,
|
`${localData['groups']}${bot['groups']}`,
|
||||||
`${localData['friends']} ${bot['friends']}`,
|
`${localData['friends']}${bot['friends']}`,
|
||||||
`${localData['message_sent']} ${bot['message_sent']}`,
|
`${localData['message_sent']}${bot['message_sent']}`,
|
||||||
`${localData['message_received']} ${bot['message_received']}`,
|
`${localData['message_received']}${bot['message_received']}`,
|
||||||
]
|
]
|
||||||
// 添加一些标签
|
// 添加一些标签
|
||||||
tagArray.forEach(
|
tagArray.forEach(
|
||||||
@ -141,7 +141,7 @@ function main() {
|
|||||||
tagSpan.className = 'bot-tag'
|
tagSpan.className = 'bot-tag'
|
||||||
tagSpan.innerText = 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)
|
botInfoDiv.querySelector('.bot-tags').appendChild(tagSpan)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -154,16 +154,16 @@ function main() {
|
|||||||
let liteyukiInfoDiv = document.importNode(document.getElementById('bot-template').content, true) // 复制模板
|
let liteyukiInfoDiv = document.importNode(document.getElementById('bot-template').content, true) // 复制模板
|
||||||
liteyukiInfoDiv.className = 'info-box bot-info'
|
liteyukiInfoDiv.className = 'info-box bot-info'
|
||||||
liteyukiInfoDiv.querySelector('.bot-icon-img').setAttribute('src', './img/liteyuki.png')
|
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 = [
|
let tagArray = [
|
||||||
`Liteyuki ${liteyukiData['version']}`,
|
`灵温 ${liteyukiData['version']}`,
|
||||||
`Nonebot ${liteyukiData['nonebot']}`,
|
`Nonebot ${liteyukiData['nonebot']}`,
|
||||||
liteyukiData['python'],
|
`${liteyukiData['python']}`,
|
||||||
liteyukiData['system'],
|
liteyukiData['system'],
|
||||||
`${localData['plugins']} ${liteyukiData['plugins']}`,
|
`${localData['plugins']}${liteyukiData['plugins']}`,
|
||||||
`${localData['resources']} ${liteyukiData['resources']}`,
|
`${localData['resources']}${liteyukiData['resources']}`,
|
||||||
`${localData['bots']} ${liteyukiData['bots']}`,
|
`${localData['bots']}${liteyukiData['bots']}`,
|
||||||
`${localData['runtime']} ${secondsToTextTime(liteyukiData['runtime'])}`,
|
`${localData['runtime']} ${secondsToTextTime(liteyukiData['runtime'])}`,
|
||||||
]
|
]
|
||||||
tagArray.forEach(
|
tagArray.forEach(
|
||||||
@ -172,7 +172,7 @@ function main() {
|
|||||||
tagSpan.className = 'bot-tag'
|
tagSpan.className = 'bot-tag'
|
||||||
tagSpan.innerText = 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)
|
liteyukiInfoDiv.querySelector('.bot-tags').appendChild(tagSpan)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
botName.innerText = bot.name;
|
botName.innerText = bot.name;
|
||||||
if (bot.self) {
|
if (bot.self) {
|
||||||
// 添加颜色
|
// 添加颜色
|
||||||
botName.style.color = '#d0e9ff';
|
botName.style.color = '#32383D';
|
||||||
}
|
}
|
||||||
botDetail.appendChild(botName);
|
botDetail.appendChild(botName);
|
||||||
|
|
||||||
@ -88,7 +88,7 @@
|
|||||||
tagSpan.className = 'tag';
|
tagSpan.className = 'tag';
|
||||||
if (bot.self) {
|
if (bot.self) {
|
||||||
// 添加颜色
|
// 添加颜色
|
||||||
tagSpan.style.color = '#a2d8f4';
|
tagSpan.style.color = '#007ebd';
|
||||||
}
|
}
|
||||||
botTags.appendChild(tagSpan);
|
botTags.appendChild(tagSpan);
|
||||||
if (index === bot.tags.length - 1) {
|
if (index === bot.tags.length - 1) {
|
||||||
@ -147,17 +147,17 @@
|
|||||||
//文字颜色
|
//文字颜色
|
||||||
|
|
||||||
lineHeight: 36,
|
lineHeight: 36,
|
||||||
color: '#fff',
|
color: '#000',
|
||||||
fontSize: 30
|
fontSize: 30
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: "item",
|
trigger: "item",
|
||||||
backgroundColor: "#ffffff00",
|
backgroundColor: "#00000000",
|
||||||
// {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
|
// {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
|
||||||
},
|
},
|
||||||
color: ['#a2d8f4', "#ffffff44", '#00a6ff'],
|
color: ['#007ebd', "#00000044", '#053349'],
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: 'info',
|
name: 'info',
|
||||||
@ -196,20 +196,20 @@
|
|||||||
}
|
}
|
||||||
// data为百分比,最大值为100
|
// data为百分比,最大值为100
|
||||||
return {
|
return {
|
||||||
background: '#d0e9ff',
|
background: '#32383D',
|
||||||
title: {
|
title: {
|
||||||
text: title,
|
text: title,
|
||||||
left: '5%',
|
left: '5%',
|
||||||
top: 'center',
|
top: 'center',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#fff',
|
color: '#000',
|
||||||
fontSize: 30
|
fontSize: 30
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: "item",
|
trigger: "item",
|
||||||
backgroundColor: "#ffffff",
|
backgroundColor: "#000000",
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: '0',
|
left: '0',
|
||||||
@ -234,7 +234,7 @@
|
|||||||
data: [percent],
|
data: [percent],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
color: '#a2d8f4',
|
color: '#007ebd',
|
||||||
barBorderRadius: [50, 0, 0, 50]
|
barBorderRadius: [50, 0, 0, 50]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -246,7 +246,7 @@
|
|||||||
data: [100 - percent],
|
data: [100 - percent],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
color: '#d0e9ff',
|
color: '#32383D',
|
||||||
barBorderRadius: [fillet, 50, 50, fillet]
|
barBorderRadius: [fillet, 50, 50, fillet]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12,20 +12,23 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<template id="bot-template">
|
<template id="bot-template">
|
||||||
<div class="info-box bot-info">
|
<div class="info-box bot-info" style="justify-content: space-between;">
|
||||||
<div class="bot-icon">
|
<div class="bot-icon" style="text-align:start;">
|
||||||
<img class="bot-icon-img" src="" alt="bot-icon">
|
<img class="bot-icon-img" src="" alt="bot-icon">
|
||||||
</div>
|
</div>
|
||||||
<div class="bot-detail">
|
<div class="bot-detail">
|
||||||
<div class="bot-name">
|
<div class="bot-name" style="text-align:start">
|
||||||
TriM-Liteyuki
|
TriM-Liteyuki
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
<div class="bot-icon-tags">
|
||||||
|
<!-- <div style="text-align:start; width: 10px;"> <img src="./img/empty.png"></div> -->
|
||||||
<div class="bot-tags">
|
<div class="bot-tags">
|
||||||
<!-- tag span-->
|
<!-- tag span-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="device-info">
|
<template id="device-info">
|
||||||
|
@ -6,8 +6,9 @@ import time
|
|||||||
|
|
||||||
import nonebot
|
import nonebot
|
||||||
|
|
||||||
__NAME__ = "LiteyukiBot"
|
__NAME__ = "LiteyukiBot-Trim"
|
||||||
__VERSION__ = "6.3.2" # 60201
|
__VERSION__ = "6.3.3" # 60201
|
||||||
|
# __VERSION_I__ = 99060303
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
@ -18,32 +19,32 @@ from git import Repo
|
|||||||
|
|
||||||
|
|
||||||
major, minor, patch = map(int, __VERSION__.split("."))
|
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():
|
def register_bot():
|
||||||
url = "https://api.liteyuki.icu/register"
|
url = "https://api.liteyuki.icu/register"
|
||||||
data = {
|
data = {
|
||||||
"name" : __NAME__,
|
"name": __NAME__,
|
||||||
"version" : __VERSION__,
|
"version": __VERSION__,
|
||||||
"version_i": __VERSION_I__,
|
"version_i": __VERSION_I__,
|
||||||
"python" : f"{platform.python_implementation()} {platform.python_version()}",
|
"python": f"{platform.python_implementation()} {platform.python_version()}",
|
||||||
"os" : f"{platform.system()} {platform.version()} {platform.machine()}"
|
"os": f"{platform.system()} {platform.version()} {platform.machine()}",
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
nonebot.logger.info("Waiting for register to Liteyuki...")
|
nonebot.logger.info("正在等待 Liteyuki 注册服务器…")
|
||||||
resp = requests.post(url, json=data, timeout=(10, 15))
|
resp = requests.post(url, json=data, timeout=(10, 15))
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
if liteyuki_id := data.get("liteyuki_id"):
|
if liteyuki_id := data.get("liteyuki_id"):
|
||||||
with open("data/liteyuki/liteyuki.json", "wb") as f:
|
with open("data/liteyuki/liteyuki.json", "wb") as f:
|
||||||
f.write(json.dumps(data).encode("utf-8"))
|
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:
|
else:
|
||||||
raise ValueError(f"Register to Liteyuki failed: {data}")
|
raise ValueError(f"无法向 Liteyuki 服务器注册:{data}")
|
||||||
|
|
||||||
except Exception as e:
|
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():
|
def init():
|
||||||
@ -56,21 +57,25 @@ def init():
|
|||||||
auto_migrate()
|
auto_migrate()
|
||||||
init_log()
|
init_log()
|
||||||
if sys.version_info < (3, 10):
|
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)
|
exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 检测git仓库
|
# 检测git仓库
|
||||||
repo = Repo(".")
|
repo = Repo(".")
|
||||||
except Exception as e:
|
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()
|
temp_data.data["start_time"] = time.time()
|
||||||
common_db.save(temp_data)
|
common_db.save(temp_data)
|
||||||
|
|
||||||
# 在加载完成语言后再初始化日志
|
# 在加载完成语言后再初始化日志
|
||||||
nonebot.logger.info("Liteyuki is initializing...")
|
nonebot.logger.info("尹灵温 正在初始化…")
|
||||||
|
|
||||||
if not os.path.exists("data/liteyuki/liteyuki.json"):
|
if not os.path.exists("data/liteyuki/liteyuki.json"):
|
||||||
register_bot()
|
register_bot()
|
||||||
@ -80,7 +85,6 @@ def init():
|
|||||||
f.write("[tool.nonebot]\n")
|
f.write("[tool.nonebot]\n")
|
||||||
|
|
||||||
nonebot.logger.info(
|
nonebot.logger.info(
|
||||||
f"Run Liteyuki with Python{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} "
|
f"正在 {sys.executable} Python{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} 上运行 尹灵温"
|
||||||
f"at {sys.executable}"
|
|
||||||
)
|
)
|
||||||
nonebot.logger.info(f"{__NAME__} {__VERSION__}({__VERSION_I__}) is running")
|
nonebot.logger.info(f"{__NAME__} {__VERSION__}({__VERSION_I__}) 正在运行")
|
||||||
|
Loading…
Reference in New Issue
Block a user