feat: 新的背景图

fix: 命令冲突
docs: 添加了命令头和nickname冲突的解释
This commit is contained in:
远野千束 2024-04-06 04:23:01 +08:00
parent 468a534d85
commit bc856b4aa9
32 changed files with 213 additions and 11638 deletions

View File

@ -16,6 +16,7 @@ tag:
其中`/path/to/python`是你要用来运行Bot的可执行文件 其中`/path/to/python`是你要用来运行Bot的可执行文件
- 为什么我启动后机器人没有反应? - 为什么我启动后机器人没有反应?
- 请检查配置文件的`command_start`或`superusers`,确认你有权限使用命令并按照正确的命令发送 - 请检查配置文件的`command_start`或`superusers`,确认你有权限使用命令并按照正确的命令发送
- 确认命令头没有和`nickname{}`冲突,例如一个命令是`help`,但是`Bot`昵称有一个`help`那么将会被解析为nickname而不是命令
- 怎么登录聊天平台例如QQ - 怎么登录聊天平台例如QQ
- 你有这个问题说明你不是很了解这个项目,本项目不负责实现登录功能,只负责处理和回应消息,登录功能由实现端(协议端)提供, - 你有这个问题说明你不是很了解这个项目,本项目不负责实现登录功能,只负责处理和回应消息,登录功能由实现端(协议端)提供,
@ -41,6 +42,7 @@ tag:
使用其他项目连接请先自行查阅文档若有困难请联系对应开发者而不是Liteyuki的开发者 使用其他项目连接请先自行查阅文档若有困难请联系对应开发者而不是Liteyuki的开发者
### 鸣谢 ### 鸣谢
- [Nonebot2](https://nonebot.dev)提供的框架支持 - [Nonebot2](https://nonebot.dev)提供的框架支持
- [nonebot-plugin-htmlrender](https://github.com/kexue-z/nonebot-plugin-htmlrender/tree/master)提供的渲染功能 - [nonebot-plugin-htmlrender](https://github.com/kexue-z/nonebot-plugin-htmlrender/tree/master)提供的渲染功能
- [nonebot-plugin-alconna](https://github.com/ArcletProject/nonebot-plugin-alconna)提供的命令解析功能 - [nonebot-plugin-alconna](https://github.com/ArcletProject/nonebot-plugin-alconna)提供的命令解析功能

View File

@ -14,7 +14,7 @@ category: 使用手册
```shell ```shell
[S]reload-liteyuki # 重载轻雪 [S]reload-liteyuki # 重载轻雪
[S]update-liteyuki # 更新轻雪 [S]update-liteyuki # 更新轻雪
[S]liteyuki # 查看轻雪信息 [S]liteecho # 查看当前bot
[S]config set <key> value # 添加配置项,若存在则会覆盖,输入值会被执行,以便于转换为正确的值,"10"和10是不一样的 [S]config set <key> value # 添加配置项,若存在则会覆盖,输入值会被执行,以便于转换为正确的值,"10"和10是不一样的
[S]config get [key] # 查询配置项不带key返回配置项列表推荐私聊使用 [S]config get [key] # 查询配置项不带key返回配置项列表推荐私聊使用
[S]switch-image-mode # 切换图片模式该功能需要commit:505468b及以后的Lagrange.OneBot在普通图片和Markdown图片之间切换后者更大但有失败的可能 [S]switch-image-mode # 切换图片模式该功能需要commit:505468b及以后的Lagrange.OneBot在普通图片和Markdown图片之间切换后者更大但有失败的可能

View File

@ -22,9 +22,9 @@ driver = get_driver()
markdown_image = common_db.first(StoredConfig(), default=StoredConfig()).config.get("markdown_image", False) markdown_image = common_db.first(StoredConfig(), default=StoredConfig()).config.get("markdown_image", False)
cmd_liteyuki = on_alconna( liteyuki = on_alconna(
Alconna( command=Alconna(
"liteyuki" "liteecho",
), ),
permission=SUPERUSER permission=SUPERUSER
) )
@ -73,9 +73,9 @@ switch_image_mode = on_alconna(
) )
@cmd_liteyuki.handle() @liteyuki.handle()
async def _(bot: T_Bot): async def _(bot: T_Bot):
await cmd_liteyuki.finish(f"Hello, Liteyuki!\nBot {bot.self_id}\nLiteyukiID {config.get('liteyuki_id', 'No')}") await liteyuki.finish(f"Hello, Liteyuki!\nBot {bot.self_id}")
@update_liteyuki.handle() @update_liteyuki.handle()

View File

@ -1,4 +1,4 @@
import os import os.path
import nonebot.plugin import nonebot.plugin
@ -7,15 +7,19 @@ from liteyuki.utils.data_manager import InstalledPlugin, plugin_db
from liteyuki.utils.resource import load_resource_from_dir from liteyuki.utils.resource import load_resource_from_dir
from liteyuki.utils.tools import check_for_package from liteyuki.utils.tools import check_for_package
THIS_PLUGIN_NAME = os.path.basename(os.path.dirname(__file__)) # 加载默认资源和语言
RESOURCE_PATH = "liteyuki/resources" RESOURCE_PATH = "liteyuki/resources"
load_resource_from_dir(RESOURCE_PATH) load_resource_from_dir(RESOURCE_PATH)
init_log()
# 加载其他资源包
if os.path.exists("resources"):
for resource in os.listdir("resources"):
load_resource_from_dir(os.path.join("resources", resource))
nonebot.plugin.load_plugins("liteyuki/plugins") nonebot.plugin.load_plugins("liteyuki/plugins")
nonebot.plugin.load_plugins("plugins") nonebot.plugin.load_plugins("plugins")
init_log() # 从数据库读取已安装的插件
installed_plugins: list[InstalledPlugin] = plugin_db.all(InstalledPlugin()) installed_plugins: list[InstalledPlugin] = plugin_db.all(InstalledPlugin())
if installed_plugins: if installed_plugins:
for installed_plugin in installed_plugins: for installed_plugin in installed_plugins:

View File

@ -8,8 +8,6 @@ from liteyuki.utils.ly_typing import T_Bot, T_MessageEvent, v11
from liteyuki.utils.message import Markdown as md from liteyuki.utils.message import Markdown as md
md_test = on_command("mdts", aliases={"会话md"}, permission=SUPERUSER) md_test = on_command("mdts", aliases={"会话md"}, permission=SUPERUSER)
md_group = on_command("mdg", aliases={"群md"}, permission=SUPERUSER)
md_conv = on_command("md", block=False, permission=SUPERUSER)
placeholder = { placeholder = {
"&#91;": "[", "&#91;": "[",
@ -30,21 +28,6 @@ async def _(bot: T_Bot, event: T_MessageEvent, arg: v11.Message = CommandArg()):
session_id=event.user_id if event.message_type == "private" else event.group_id session_id=event.user_id if event.message_type == "private" else event.group_id
) )
ignore_msg_ids = []
last_sent = None
@md_conv.handle()
async def _(bot: v11.Bot, event: T_MessageEvent, arg: v11.Message = CommandArg()):
if str(event.user_id) == str(bot.self_id) and str(bot.self_id) in ["2751454815"]:
nonebot.logger.info("开始处理:%s" % str(event.message_id))
data = await md.send_md(str(arg), bot, message_type=event.message_type,
session_id=event.user_id if event.message_type == "private" else event.group_id)
await bot.delete_msg(message_id=event.message_id)
__author__ = "snowykami" __author__ = "snowykami"
__plugin_meta__ = PluginMetadata( __plugin_meta__ = PluginMetadata(
name="轻雪Markdown测试", name="轻雪Markdown测试",

File diff suppressed because it is too large Load Diff

View File

@ -1,81 +0,0 @@
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiEyp8kv8JHgFVrJJbecmNE.woff2) format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiEyp8kv8JHgFVrJJnecmNE.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiEyp8kv8JHgFVrJJfecg.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* devanagari */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiByp8kv8JHgFVrLEj6Z11lFc-K.woff2) format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiByp8kv8JHgFVrLEj6Z1JlFc-K.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiByp8kv8JHgFVrLEj6Z1xlFQ.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* devanagari */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiByp8kv8JHgFVrLCz7Z11lFc-K.woff2) format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiByp8kv8JHgFVrLCz7Z1JlFc-K.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(https://ks.liteyuki.icu:809/812/static/font/pxiByp8kv8JHgFVrLCz7Z1xlFQ.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

View File

@ -1,6 +0,0 @@
/**
* Owl Carousel v2.3.4
* Copyright 2013-2018 David Deutsch
* Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
*/
.owl-carousel,.owl-carousel .owl-item{-webkit-tap-highlight-color:transparent;position:relative}.owl-carousel{display:none;width:100%;z-index:1}.owl-carousel .owl-stage{position:relative;-ms-touch-action:pan-Y;touch-action:manipulation;-moz-backface-visibility:hidden}.owl-carousel .owl-stage:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}.owl-carousel .owl-stage-outer{position:relative;overflow:hidden;-webkit-transform:translate3d(0,0,0)}.owl-carousel .owl-item,.owl-carousel .owl-wrapper{-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.owl-carousel .owl-item{min-height:1px;float:left;-webkit-backface-visibility:hidden;-webkit-touch-callout:none}.owl-carousel .owl-item img{display:block;width:100%}.owl-carousel .owl-dots.disabled,.owl-carousel .owl-nav.disabled{display:none}.no-js .owl-carousel,.owl-carousel.owl-loaded{display:block}.owl-carousel .owl-dot,.owl-carousel .owl-nav .owl-next,.owl-carousel .owl-nav .owl-prev{cursor:pointer;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel .owl-nav button.owl-next,.owl-carousel .owl-nav button.owl-prev,.owl-carousel button.owl-dot{background:0 0;color:inherit;border:none;padding:0!important;font:inherit}.owl-carousel.owl-loading{opacity:0;display:block}.owl-carousel.owl-hidden{opacity:0}.owl-carousel.owl-refresh .owl-item{visibility:hidden}.owl-carousel.owl-drag .owl-item{-ms-touch-action:pan-y;touch-action:pan-y;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel.owl-grab{cursor:move;cursor:grab}.owl-carousel.owl-rtl{direction:rtl}.owl-carousel.owl-rtl .owl-item{float:right}.owl-carousel .animated{animation-duration:1s;animation-fill-mode:both}.owl-carousel .owl-animated-in{z-index:0}.owl-carousel .owl-animated-out{z-index:1}.owl-carousel .fadeOut{animation-name:fadeOut}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.owl-height{transition:height .5s ease-in-out}.owl-carousel .owl-item .owl-lazy{opacity:0;transition:opacity .4s ease}.owl-carousel .owl-item .owl-lazy:not([src]),.owl-carousel .owl-item .owl-lazy[src^=""]{max-height:0}.owl-carousel .owl-item img.owl-lazy{transform-style:preserve-3d}.owl-carousel .owl-video-wrapper{position:relative;height:100%;background:#000}.owl-carousel .owl-video-play-icon{position:absolute;height:80px;width:80px;left:50%;top:50%;margin-left:-40px;margin-top:-40px;background:url(http://demo.mxyhn.xyz:8020/cssthemes6/3.31ZF02/css/owl.video.play.png) no-repeat;cursor:pointer;z-index:1;-webkit-backface-visibility:hidden;transition:transform .1s ease}.owl-carousel .owl-video-play-icon:hover{-ms-transform:scale(1.3,1.3);transform:scale(1.3,1.3)}.owl-carousel .owl-video-playing .owl-video-play-icon,.owl-carousel .owl-video-playing .owl-video-tn{display:none}.owl-carousel .owl-video-tn{opacity:0;height:100%;background-position:center center;background-repeat:no-repeat;background-size:contain;transition:opacity .4s ease}.owl-carousel .owl-video-frame{position:relative;z-index:1;height:100%;width:100%}

View File

@ -1,68 +0,0 @@
@media (max-width: 1120px) {}
@media (max-width: 992px) {
.hero_area {
height: auto;
}
.custom_nav-container .nav_search-btn {
background-position: center;
margin-top: 10px;
}
.slider_section {
padding-top: 45px;
padding-bottom: 75px;
}
.info_items {
width: 100%;
}
}
@media (max-width: 768px) {
.contact_section .form_container {
padding: 45px 0;
}
.info_items {
flex-direction: column;
align-items: center;
}
.contact_section .heading_container {
justify-content: center;
}
.contact_section .heading_container h2::before {
left: 50%;
transform: translateX(-50%);
}
.contact_section button {
margin: 45px auto 0 auto;
}
}
@media (max-width: 576px) {
.slider_section .detail-box h1 {
font-size: 3rem;
}
}
@media (max-width: 480px) {}
@media (max-width: 420px) {
.slider_section .detail-box h1 {
letter-spacing: .3rem;
}
}
@media (max-width: 360px) {}
@media (min-width: 1200px) {
.container {
max-width: 1170px;
}
}

View File

@ -1,623 +1,17 @@
body { body {
font-family: "Poppins", sans-serif; background-repeat: repeat-y;
color: #000000; background-size: cover;
background-color: #ffffff; background-position: center;
} color: white;
/ / 上10px左右10px下0px / / margin: 24 px;
.layout_padding { margin: 20px;
padding-top: 120px;
padding-bottom: 120px; }
}
.info-box {
.layout_padding2 { border-radius: 30px;
padding-top: 45px; padding: 30px;
padding-bottom: 45px; backdrop-filter: blur(60px);
} background-color: rgba(0, 0, 0, 0.3);
margin-bottom: 20px;
.layout_padding2-top { }
padding-top: 45px;
}
.layout_padding2-bottom {
padding-bottom: 45px;
}
.layout_padding-top {
padding-top: 120px;
}
.layout_padding-bottom {
padding-bottom: 120px;
}
.heading_container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
text-align: center;
}
.heading_container h2 {
font-weight: bold;
position: relative;
padding-bottom: 15px;
text-transform: uppercase;
}
.heading_container h2::before {
content: "";
position: absolute;
bottom: 0;
left: 50%;
width: 55px;
height: 5px;
background-color: #a2d8f4;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}
/*header section*/
.hero_area {
height: 100vh;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
background-image: url(https://ks.liteyuki.icu:809/812/static/image/hero-bg.png);
background-size: cover;
background-attachment: fixed;
background-position: center;
}
.sub_page .hero_area {
height: auto;
}
.sub_page .who_section.layout_padding {
padding-top: 0;
}
.hero_area.sub_pages {
height: auto;
}
.header_section .container-fluid {
padding-right: 25px;
padding-left: 25px;
}
.header_section .nav_container {
margin: 0 auto;
}
.custom_nav-container.navbar-expand-lg .navbar-nav .nav-item .nav-link {
margin: 10px 30px;
padding: 0;
padding-bottom: 3px;
color: #ffffff;
text-align: center;
position: relative;
text-transform: uppercase;
font-size: 15px;
}
.custom_nav-container.navbar-expand-lg .navbar-nav .nav-item .nav-link::after {
display: none;
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 3px;
border-radius: 5px;
background-color: #ffffff;
}
.custom_nav-container.navbar-expand-lg .navbar-nav .nav-item.active a::after,
.custom_nav-container.navbar-expand-lg .navbar-nav .nav-item:hover a::after {
display: block;
background-color: #a2d8f4;
}
a,
a:hover,
a:focus {
text-decoration: none;
}
a:hover,
a:focus {
color: initial;
}
.btn,
.btn:focus {
outline: none !important;
-webkit-box-shadow: none;
box-shadow: none;
}
.user_option {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.user_option a {
color: #ffffff;
margin: 10px 30px;
}
.custom_nav-container .nav_search-btn {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/search-icon.png);
background-size: 22px;
background-repeat: no-repeat;
background-position-y: 7px;
width: 35px;
height: 35px;
padding: 0;
border: none;
}
.navbar-brand {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
position: relative;
}
.navbar-brand span {
font-size: 22px;
text-transform: uppercase;
font-weight: bold;
color: #ffffff;
position: relative;
z-index: 3;
}
.custom_nav-container {
z-index: 99999;
padding: 15px 0;
}
.custom_nav-container .navbar-toggler {
outline: none;
}
.custom_nav-container .navbar-toggler .navbar-toggler-icon {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/menu.png);
background-size: 55px;
}
/*end header section*/
.slider_section {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
color: #ffffff;
}
.slider_section #carouselExampleIndicators {
width: 100%;
}
.slider_section .row {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.slider_section .box {
margin: 125px 0;
}
.slider_section .detail-box {
text-align: center;
}
.slider_section .detail-box h1,
.slider_section .detail-box h2,
.slider_section .detail-box h3 {
text-transform: uppercase;
font-weight: bold;
}
.slider_section .detail-box h2 {
font-size: 2.5rem;
}
.slider_section .detail-box h1 {
font-size: 3.5rem;
font-weight: bold;
letter-spacing: 0.5rem;
}
.slider_section .detail-box p {
margin-top: 25px;
}
.slider_section .detail-box a {
display: inline-block;
padding: 8px 35px;
background-color: transparent;
border: 2px solid #ffffff;
color: #ffffff;
border-radius: 100px;
backdrop-filter: blur(10px);
-webkit-transition: -webkit-transform 0.3s;
transition: -webkit-transform 0.3s;
transition: transform 0.3s;
text-transform: uppercase;
margin-top: 35px;
}
.slider_section .detail-box a:hover {
background-color: #ffffff;
color: #000000;
}
.slider_section #carouselExampleIndicators .carousel-indicators {
position: unset;
margin: 45px 0 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.slider_section #carouselExampleIndicators .carousel-indicators li {
width: 14px;
height: 14px;
background-color: transparent;
border: 2px solid #ffffff;
border-radius: 100%;
opacity: 1;
}
.slider_section #carouselExampleIndicators .carousel-indicators li.active {
border: 4px solid #ffffff;
}
.us_section {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/us-bg.jpg);
background-size: cover;
background-attachment: fixed;
color: #ffffff;
}
.us_section .us_container {
padding-top: 25px;
}
.us_section .us_container .box {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-align: center;
margin: 25px 10px 0 10px;
}
.us_section .us_container .box .img-box {
height: 100px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.us_section .us_container .box .img-box img {
max-width: 100%;
}
.us_section .us_container .box .detail-box h5 {
font-weight: bold;
}
.heathy_section {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/healthy-bg.jpg);
background-size: cover;
background-attachment: fixed;
color: #ffffff;
text-align: center;
}
.heathy_section h2 {
font-weight: bold;
}
.heathy_section p {
margin-top: 35px;
line-height: 1.8;
}
.heathy_section .btn-box {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
margin-top: 45px;
}
.heathy_section .btn-box a {
display: inline-block;
padding: 8px 35px;
background-color: transparent;
border: 1.5px solid #ffffff;
color: #ffffff;
border-radius: 0;
-webkit-transition: -webkit-transform 0.3s;
transition: -webkit-transform 0.3s;
transition: transform 0.3s;
transition: transform 0.3s, -webkit-transform 0.3s;
text-transform: uppercase;
}
.heathy_section .btn-box a:hover {
background-color: #ffffff;
color: #000000;
}
.trainer_section {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/trainer-bg.png);
background-position: center;
background-size: cover;
background-attachment: fixed;
color: #ffffff;
}
.trainer_section .box {
margin-top: 55px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-align: center;
}
.trainer_section .box .name h5 {
font-weight: bold;
margin-bottom: 15px;
}
.trainer_section .box .img-box {
border-radius: 15px;
overflow: hidden;
}
.trainer_section .box .img-box img {
width: 100%;
}
.trainer_section .box .social_box {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
width: 225px;
padding: 12px 45px;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 50px;
backdrop-filter: blur(10px);
margin-top: -25px;
}
.contact_section {
position: relative;
background-color: #27223f;
color: #ffffff;
}
.contact_section .heading_container {
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: start;
}
.contact_section .heading_container h2::before {
text-align: left;
left: 0;
-webkit-transform: none;
transform: none;
}
.contact_section .row {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.contact_section .img-box img {
width: 100%;
}
.contact_section .form_container {
padding: 45px 0 45px 15px;
}
.contact_box {
padding: 25px 0 45px 15px;
}
.contact_section input {
width: 100%;
border: none;
background-color: #ffffff;
outline: none;
color: #000000;
margin-top: 25px;
padding: 12px;
}
.contact_section input::-webkit-input-placeholder {
color: #2a2a2c;
}
.contact_section input:-ms-input-placeholder {
color: #2a2a2c;
}
.contact_section input::-ms-input-placeholder {
color: #2a2a2c;
}
.contact_section input::placeholder {
color: #2a2a2c;
}
.contact_section input.message-box {
padding: 45px 12px;
}
.contact_section button {
padding: 10px 45px;
outline: none;
border: none;
color: #ffffff;
background: #a2d8f4;
margin: 20px 15px 20px 15px;
text-transform: uppercase;
border-radius: 80px;
}
.info_section {
background-color: #252233;
}
.info_items {
width: 70%;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.info_items .item {
width: 200px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-align: center;
}
.info_items .item .img-box {
width: 80px;
height: 80px;
border-radius: 100%;
background-repeat: no-repeat;
background-position: center;
}
.info_items .item .detail-box {
margin-top: 5px;
color: #fff;
}
.info_items {
position: relative;
}
.info_items a {
position: relative;
}
.info_items .item .img-box.box-1 {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/server.png);
}
.info_items .item .img-box.box-2 {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/group_fill.png);
}
.info_items .item .img-box.box-3 {
background-image: url(https://ks.liteyuki.icu:809/812/static/image/Web.png);
}
.info-btn {
color: #d0e9ff;
}
.info-btn:hover {
color: #a2d8f4;
}
/* footer section*/
.footer_section {
background-color: #a2d8f4;
padding: 20px;
font-weight: 500;
}
.footer_section p {
color: #fff;
margin: 0;
text-align: center;
}
.announce {
color: #a9a9a9;
font-size: 5px;
}
.footer_section a {
color: #292929;
}
#tips {
color: #999;
font-size: 80%;
}
/* end footer section*/
/*# sourceMappingURL=style.css.map */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

View File

@ -1,294 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns="http://www.w3.org/1999/html">
<head>
<!-- Basic -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Liteyuki Server | An awesome server welcome you!</title>
<!-- slider stylesheet -->
<link rel="stylesheet" type="text/css" href="css/owl.carousel.min.css">
<!-- bootstrap core css -->
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<!-- fonts style -->
<link href="css/css.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/style.css" rel="stylesheet">
<!-- responsive style -->
<link href="css/responsive.css" rel="stylesheet">
<style>
.fixed-top-bar {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: rgba(162, 216, 244, 0.3);
color: white;
z-index: 100;
padding: 5px 5px; /* 调整顶栏的上下内边距 */
backdrop-filter: blur(10px); /* 设置高斯模糊效果,调整模糊程度 */
}
.fixed-top-bar {
/* ... 其他样式 ... */
display: flex;
justify-content: space-between; /* 将左侧和右侧内容分别放置两端 */
align-items: center;
}
.fixed-top-bar img {
margin-right: 5px; /* 调整图标和文字之间的间距 */
}
.buttons {
display: flex;
gap: 10px; /* 按钮之间的间隔 */
}
.btn {
padding: 5px 5px;
color: #d0e9ff; /* 按钮的文字颜色 */
border: none;
cursor: pointer;
}
.btn:hover {
color: #a2d8f4;
}
</style>
</head>
<body>
<div class="fixed-top-bar">
<!-- 固定顶栏内容 -->
<a class="navbar-brand" href="#">
<span><img src="https://ks.liteyuki.icu:809/static/img/liteyuki_icon.png" alt="liteyuki_icon" height="40"></span>
<span>Liteyuki</span>
</a>
<div class="buttons">
<a class="btn" href="https://qm.qq.com/q/PX6cjzXNCc">加入Q群</a>
<a class="btn" href="https://lab.liteyuki.icu">轻雪社区</a>
</div>
<!-- 其他固定顶栏的内容 -->
</div>
<div class="hero_area">
<!-- header section strats -->
<header class="header_section">
<div class="container-fluid">
<nav class="navbar navbar-expand-lg custom_nav-container">
<!-- <a class="navbar-brand" href="#">-->
<!-- </a>-->
</nav>
</div>
</header>
<!-- end header section -->
<!-- slider section -->
<section class="slider_section position-relative">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="col-lg-10 col-md-11 mx-auto">
<div class="detail-box">
<div>
<h2>Liteyuki Server</h2>
<h3>轻雪公益插件服</h3>
<p>
Liteyuki Server 轻雪服务器是由雪萤工坊旗下轻雪工作室团队运营的一个公益性质的服务器,
我们致力于为玩家提供一个良好的游戏环境,让玩家能够在这里体验到最纯粹的游戏乐趣。服务器定期的活动,丰富的游戏玩法,以及良好的管理团队,都是我们的优势。
</p>
<div class="join-btn">
<a href="https://qm.qq.com/q/PX6cjzXNCc">加入聊天社群</a>
</div>
<p id="now-online">当前状态: 获取中...</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- end slider section -->
</div>
<section class="trainer_section layout_padding">
<div class="container">
<div class="heading_container">
<h2>管理团队</h2>
<!-- 此处您也可以选择展示自己服务器的图片。用途全由您决定 -->
</div>
<div class="row">
<div class="col-lg-4 col-md-6 mx-auto">
<div class="box">
<div class="name">
<h5>SnowyKami(SF_Kami)</h5>
</div>
<div class="img-box">
<img src="https://ks.liteyuki.icu:809/812/static/picture/t2.png" alt="">
</div>
<div class="social_box">
<a href="https://qm.qq.com/q/r6FqZZafmg">
<img src="https://ks.liteyuki.icu:809/812/static/picture/qq.png" alt="qq" height="20">
</a>
<a href="https://space.bilibili.com/233938750">
<img src="https://ks.liteyuki.icu:809/812/static/picture/bili.png" alt="bili" height="20">
</a>
<a href="https://snowykami.me">
<img src="https://ks.liteyuki.icu:809/812/static/picture/link.png" alt="link.png"
height="22">
</a>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mx-auto">
<div class="box">
<div class="name">
<h5>LuoChenXi(LuoChenXil_)</h5>
</div>
<div class="img-box">
<img src="https://ks.liteyuki.icu:809/812/static/picture/t1.png" alt="">
</div>
<div class="social_box">
<a href="">
<img src="https://ks.liteyuki.icu:809/812/static/picture/qq.png" alt="" height="20">
</a>
<a href="">
<img src="https://ks.liteyuki.icu:809/812/static/picture/bili.png" alt="" height="20">
</a>
<a href="">
<img src="https://ks.liteyuki.icu:809/812/static/picture/email.png" alt="" height="16">
</a>
</div>
</div>
</div>
<!-- <div class="col-lg-4 col-md-6 mx-auto">-->
<!-- <div class="box">-->
<!-- <div class="name">-->
<!-- <h5>Alex</h5>-->
<!-- </div>-->
<!-- <div class="img-box">-->
<!-- <img src="static/picture/t3.png" alt="">-->
<!-- </div>-->
<!-- <div class="social_box">-->
<!-- <a href="#">-->
<!-- <img src="static/picture/WeChat.png" alt="">-->
<!-- </a>-->
<!-- <a href="#">-->
<!-- <img src="static/picture/QQ.png" alt="">-->
<!-- </a>-->
<!-- <a href="#">-->
<!-- <img src="static/picture/email.png" alt="">-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</section>
<section class="contact_section">
<div class="container-fluid">
<div class="row">
<div class="col-md-6 px-0">
<div class="img-box">
<img src="https://ks.liteyuki.icu:809/812/static/picture/2023-08-31_02.16.03.png" alt="">
</div>
</div>
<div class="col-lg-5 col-md-6">
<div class="form_container pr-0 pr-lg-5 mr-0 mr-lg-2">
<div class="heading_container">
<h2>关于服务器</h2>
</div>
<div class="contact_box">
<p>
服务器目前装载了粘液科技系列tpa领地商店等基础功能插件。
</p>
<p>
服务器启用了正版验证和白名单,需要向管理员申请加入白名单,加入白名单后即可进入服务器游玩。<br><br>
暂时没有电脑没关系我们的服务器安装了Geyser支持基岩版进入。
</p>
<p>
服务器目前处于测试阶段欢迎大家加入我们的QQ群一起来玩耍。
</p>
<!-- <p class="announce">-->
<!-- <br>注意:本页所有文字、图片仅作演示,无实际意义,版权归原作者所有。<br>-->
<!-- ATTENTION: All words and pictures on this page are only for-->
<!-- demonstration.The copyright belongs to the original author.-->
<!-- </p>-->
<a href="https://qm.qq.com/q/PX6cjzXNCc" target="_blank">
<button>加入Q群</button>
</a>
<a href="https://lab.liteyuki.icu" target="_blank">
<button>加入社区</button>
</a>
<a href="https://afdian.net/a/snowykami" target="_blank">
<button>赞助我们</button>
</a>
<p id="tips">若QQ群链接无法打开请在QQ内打开点击或手动输入群号172811867</p>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="info_section layout_padding2">
<div class="container">
<div class="info_items">
<a href="#">
<div class="item">
<div class="img-box box-1"></div>
<div class="detail-box">
<p>
<a class="info-btn" href="https://mcstatus.io/status/java/mc.liteyuki.icu" target="_blank">
地址mc.liteyuki.icu</a>
</p>
</div>
</div>
</a>
<a href="#">
<div class="item">
<div class="img-box box-3"></div>
<div class="detail-box">
<p><a class="info-btn" href="https://liteyuki.icu" target="_blank">轻雪官网liteyuki.icu</a></p>
</div>
</div>
</a>
</div>
</div>
</section>
<footer class="container-fluid footer_section">
<p>
<a href="https://icp.gov.moe/?keyword=20240224" target="_blank">萌ICP备20240224号</a>
</p>
<p>
&copy; 2020-2024 Liteyuki Studio All rights reserved.
</p>
<p></p>
</footer>
<!-- footer section -->
<!-- 引入 jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- 引入 Bootstrap JavaScript 插件 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="js/server_api.js"></script>
</body>
</html>

View File

@ -0,0 +1,14 @@
const bgs = [
"bg1.png",
"bg2.png",
"bg3.png",
"bg4.png",
"bg5.png",
"bg6.png",
"bg7.png",
"bg8.png",
"bg9.png",
"bg10.png",
]
// 随机选择背景图片
document.body.style.backgroundImage = `url(./img/${bgs[Math.floor(Math.random() * bgs.length)]})`;

View File

@ -1,11 +1,6 @@
{ {
// 环形图 // 环形图
let bgs = ["bg1.jpg", "bg2.jpg", "bg3.jpg", "bg4.jpg"]
// 随机选择背景图片
document.body.style.backgroundImage = `url(./img/${bgs[Math.floor(Math.random() * bgs.length)]})`;
let cpuInfo = echarts.init(document.getElementById('cpu-chart')); let cpuInfo = echarts.init(document.getElementById('cpu-chart'));
let memInfo = echarts.init(document.getElementById('mem-chart')); let memInfo = echarts.init(document.getElementById('mem-chart'));
let swapInfo = echarts.init(document.getElementById('swap-chart')); let swapInfo = echarts.init(document.getElementById('swap-chart'));

View File

@ -6,29 +6,9 @@
<meta name="viewport" content="width=1080, initial-scale=1.0"> <meta name="viewport" content="width=1080, initial-scale=1.0">
<title>Liteyuki Stats</title> <title>Liteyuki Stats</title>
<link rel="stylesheet" href="css/fonts.css"> <link rel="stylesheet" href="css/fonts.css">
<link rel="stylesheet" href="css/style.css">
<style> <style>
body {
background-repeat: repeat-y;
background-size: cover;
background-position: center;
background-image: url('img/bg1.jpg');
color: white;
// 上10px左右10px下0px
//margin: 24px;
margin: 20px;
}
.info-box {
border-radius: 30px;
padding: 30px;
backdrop-filter: blur(60px);
background-color: rgba(0, 0, 0, 0.3);
margin-bottom: 20px;
}
.pie-chart { .pie-chart {
height: 240px; height: 240px;
width: 240px; width: 240px;
@ -141,7 +121,8 @@
<!--储存数据div不显示--> <!--储存数据div不显示-->
<div id="data" style="display: none">{{ data | tojson }}</div> <div id="data" style="display: none">{{ data | tojson }}</div>
<script src="js/bg.js"></script>
<script src="js/motto.js"></script> <script src="js/motto.js"></script>
<script type="text/javascript" src="js/stats.js"></script> <script src="js/style.js"></script>
</body> </body>
</html> </html>

View File

@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=1080, initial-scale=1.0">
<title>Liteyuki Stats</title>
<link rel="stylesheet" href="css/fonts.css">
<link rel="stylesheet" href="css/style.css">
<style>
.pie-chart {
height: 240px;
width: 240px;
margin-bottom: 20px;
}
.pie-info {
margin: 0 40px;
align-items: center;
}
.bot-info {
align-items: center;
display: flex;
}
#hardware-info {
justify-content: center;
text-align: center;
display: flex;
}
#disks-info {
flex-wrap: wrap;
justify-content: center;
}
#motto-info {
margin-bottom: 0;
text-align: center;
white-space: pre-wrap;
}
.bot-icon {
border-radius: 50%;
height: 200px;
background-color: white;
}
.bot-name, .bot-tag {
margin-left: 20px;
}
.bot-name {
font-size: 42px;
font-weight: bold;
}
.bot-tag {
margin-top: 10px;
}
.chart-label {
font-size: 24px;
max-width: 240px;
}
.tag {
font-size: 32px;
font-weight: 700;
font-style: italic;
}
.tag[suffix="1"]::after {
content: " | ";
display: inline-block;
margin: 0 5px;
height: 50%;
line-height: 50%;
color: #ccc;
}
.motto-text {
font-size: 36px;
color: #fff;
}
.motto-author {
font-size: 30px;
font-style: italic;
color: #ccc;
}
</style>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@4.3.0/dist/echarts.min.js"></script>
</head>
<body>
<div class="info-box" id="hardware-info">
<div class="pie-info" id="cpu-info">
<div class="pie-chart" id="cpu-chart"></div>
</div>
<div class="pie-info" id="mem-info">
<div class="pie-chart" id="mem-chart"></div>
</div>
<div class="pie-info" id="swap-info">
<div class="pie-chart" id="swap-chart"></div>
</div>
</div>
<div class="info-box" id="disks-info">
</div>
<div class="info-box" id="motto-info">
</div>
<!--储存数据div不显示-->
<div id="data" style="display: none">{{ data | tojson }}</div>
<script src="js/motto.js"></script>
<script src="js/style.js"></script>
</body>
</html>

View File

@ -1,93 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
background-color: #fff; // 设置背景色为灰色
background-repeat: no-repeat; // 设置背景图片不重复
background-size: 100% auto;
}
#pieHuan {
width: 400px;
height: 400px;
margin-top: 50px;
// 圆角矩形,使背景高斯模糊
background-color: rgba(255, 255, 255, 0.5);
border-radius: 10px;
padding: 10px;
}
</style>
<script type="text/javascript" src="js/echarts.js"></script>
</head>
<body>
<div id="pieHuan"></div>
<script>{
// 设置背景图为img/bg1.jpg
let bgs = ["bg1.jpg"]
// 随机选择背景图片
document.body.style.backgroundImage = `url(./img/${bgs[Math.floor(Math.random() * bgs.length)]})`;
// 环形图
let pieHuan = echarts.init(document.getElementById('pieHuan'));
pieHuanOption = {
// 标题
title: {
text: 'echarts实现环形图'
},
// 图例
tooltip: {
show: true,
trigger: "item",
backgroundColor: "#1677FF",
// {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
formatter: "{a}{b}<br/>{c}条({d}%)"
},
// 不同区域的颜色
color: ['#65a5ff', '#dcebff'],
series: [
{
name: '访问来源',
type: 'pie',
// 数组的第一项是内半径,第二项是外半径;可以设置不同的内外半径显示成圆环图
radius: ['30%', '50%'],
// 饼图的中心(圆心)坐标,数组的第一项是横坐标,第二项是纵坐标;设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度
center: ['50%', '50%'],
itemStyle: {
// 显示图例
normal: {
label: {
show: true
},
labelLine: {
show: true
}
},
emphasis: {
label: {
// 标签内容是否高亮
show: true,
textStyle: {
fontSize: '30',
fontWeight: 'bold'
}
}
}
},
data: [
{value: 335, name: '百度'},
{value: 335, name: '搜狐'}
]
}
]
};
pieHuan.setOption(pieHuanOption);
}
</script>
</body>
</html>

View File

@ -55,7 +55,6 @@ def init():
exit(1) exit(1)
auto_migrate() auto_migrate()
# 在加载完成语言后再初始化日志 # 在加载完成语言后再初始化日志
init_log()
nonebot.logger.info("Liteyuki is initializing...") nonebot.logger.info("Liteyuki is initializing...")
if not os.path.exists("data/liteyuki/liteyuki.json"): if not os.path.exists("data/liteyuki/liteyuki.json"):

View File

@ -4,7 +4,9 @@ import nonebot
import yaml import yaml
from pydantic import BaseModel from pydantic import BaseModel
config = {} # 全局配置 from liteyuki.utils.tools import random_hex_string
config = {} # 全局配置,确保加载后读取
class BasicConfig(BaseModel): class BasicConfig(BaseModel):
@ -12,7 +14,7 @@ class BasicConfig(BaseModel):
port: int = 20216 port: int = 20216
superusers: list[str] = [] superusers: list[str] = []
command_start: list[str] = ["/", ""] command_start: list[str] = ["/", ""]
nickname: list[str] = ["liteyuki"] nickname: list[str] = [f"LiteyukiBot-{random_hex_string(6)}"]
def load_from_yaml(file: str) -> dict: def load_from_yaml(file: str) -> dict:

View File

@ -46,6 +46,11 @@ logger = loguru.logger.bind()
def init_log(): def init_log():
"""
在语言加载完成后执行
Returns:
"""
global logger global logger
config = load_from_yaml("config.yml") config = load_from_yaml("config.yml")

View File

@ -35,7 +35,8 @@ def load_resource_from_dir(path: str):
with open(os.path.join(path, "metadata.yml"), "r", encoding="utf-8") as f: with open(os.path.join(path, "metadata.yml"), "r", encoding="utf-8") as f:
metadata = yaml.safe_load(f) metadata = yaml.safe_load(f)
else: else:
metadata = ResourceMetadata() # 没有metadata.yml文件不是一个资源包
return
metadata["path"] = path metadata["path"] = path
if os.path.exists(os.path.join(path, "lang")): if os.path.exists(os.path.join(path, "lang")):
from liteyuki.utils.language import load_from_dir from liteyuki.utils.language import load_from_dir
@ -64,4 +65,4 @@ def get_files(path: str, abs_path: bool = False) -> list[str]:
Returns: 文件绝对路径 Returns: 文件绝对路径
""" """
return [os.path.abspath(file) for file in _resource_data if file.startswith(path)] if abs_path else [ return [os.path.abspath(file) for file in _resource_data if file.startswith(path)] if abs_path else [
file for file in _resource_data if file.startswith(path)] file for file in _resource_data if file.startswith(path)]

View File

@ -1,3 +1,4 @@
import random
from importlib.metadata import PackageNotFoundError, version from importlib.metadata import PackageNotFoundError, version
@ -72,3 +73,27 @@ def check_for_package(package_name: str) -> bool:
return True return True
except PackageNotFoundError: except PackageNotFoundError:
return False return False
def random_ascii_string(length: int) -> str:
"""
生成随机ASCII字符串
Args:
length:
Returns:
"""
return "".join([chr(random.randint(33, 126)) for _ in range(length)])
def random_hex_string(length: int) -> str:
"""
生成随机十六进制字符串
Args:
length:
Returns:
"""
return "".join([random.choice("0123456789abcdef") for _ in range(length)])