📝 添加英文文档框架

This commit is contained in:
远野千束 2024-08-17 02:24:25 +08:00
parent 66ade9efc6
commit d367903946
39 changed files with 306 additions and 197 deletions

View File

@ -20,7 +20,6 @@ export default defineUserConfig({
head: [
// 设置 favor.ico.vuepress/public 下
["script", {src: "/js/style.js", "type": "module"}],
["script", {src: "/js/get_data.js", "type": "module"}],
['link', {rel: 'icon', href: 'https://cdn.liteyuki.icu/favicon.ico'},],
['link', {rel: 'stylesheet', href: 'https://cdn.bootcdn.net/ajax/libs/firacode/6.2.0/fira_code.min.css'}],

View File

@ -21,5 +21,5 @@ export default navbar([
text: "开发及贡献",
link: "/dev/",
prefix: "dev/",
}
},
]);

View File

@ -0,0 +1,25 @@
import {navbar} from "vuepress-theme-hope";
export const enNavbarConfig = navbar([
"/en/",
{
text: "Deploy",
link: "/en/deploy/",
prefix: "deploy/",
},
{
text: "Usage",
link: "/en/usage/",
prefix: "usage/",
},
{
text: "Extensions",
link: "/en/store/",
prefix: "store/",
},
{
text: "Contribute",
link: "/en/dev/",
prefix: "dev/",
},
]);

View File

@ -0,0 +1,2 @@
export * from "./zh.js"
export * from "./en.js"

View File

@ -0,0 +1,26 @@
import {navbar} from "vuepress-theme-hope";
export const zhNavbarConfig = navbar([
"/",
{
text: "安装及部署",
link: "/deploy/",
prefix: "deploy/",
},
{
text: "使用及功能",
link: "/usage/",
prefix: "usage/",
},
{
text: "资源及插件",
link: "/store/",
prefix: "store/",
},
{
text: "开发及贡献",
link: "/dev/",
prefix: "dev/",
},
]);

View File

@ -1,39 +0,0 @@
// 定义全局变量来存储数据
let globalTotal = 0;
let globalOnline = 0;
// 从API获取数据并更新全局变量
function fetchAndUpdateData() {
Promise.all([
fetch("https://api.liteyuki.icu/count").then(res => res.json()),
fetch("https://api.liteyuki.icu/online").then(res => res.json())
])
.then(([countRes, onlineRes]) => {
globalTotal = countRes.register;
globalOnline = onlineRes.online;
})
.catch(err => {
console.error("Error fetching data:", err);
});
}
// 更新页面显示,使用全局变量中的数据
function updatePageDisplay() {
let countInfo = document.getElementById("count-info");
if (!countInfo) {
let info = `<div id="count-info" style="text-align: center; font-size: 20px; font-weight: 500">
全球实例:<span id="total">${globalTotal}</span>&nbsp;&nbsp;&nbsp;&nbsp;线:<span id="online">${globalOnline}</span></div>`;
let mainDescription = document.querySelector("#main-description");
if (mainDescription) {
mainDescription.insertAdjacentHTML('afterend', info);
}
}
}
// 初始调用更新数据
fetchAndUpdateData();
updatePageDisplay();
// 设置定时器,分别以不同频率调用更新数据和更新页面的函数
setInterval(fetchAndUpdateData, 10000); // 每10秒更新一次数据
setInterval(updatePageDisplay, 1000); // 每1秒更新一次页面显示

View File

View File

View File

@ -0,0 +1,31 @@
import {sidebar} from "vuepress-theme-hope";
export const enSidebarConfig = sidebar({
"/en/": [
"",
{
text: "Install & Deploy",
icon: "laptop-code",
prefix: "deploy/",
children: "structure",
},
{
text: "Usage & Features",
icon: "book",
prefix: "usage/",
children: "structure",
},
{
text: "Resources & Plugins",
icon: "store",
prefix: "store/",
children: "structure",
},
{
text: "Development & Contribution",
icon: "pen-nib",
prefix: "dev/",
children: "structure",
}
],
});

View File

@ -0,0 +1,2 @@
export * from "./zh.js"
export * from "./en.js"

View File

@ -1,12 +1,12 @@
import {sidebar} from "vuepress-theme-hope";
export default sidebar({
export const zhSidebarConfig = sidebar({
"/": [
"",
{
text: "安装及部署",
icon: "laptop-code",
prefix: "deployment/",
prefix: "deploy/",
children: "structure",
},
{

View File

@ -1,14 +1,30 @@
import {hopeTheme} from "vuepress-theme-hope";
import navbar from "./navbar.js";
import sidebar from "./sidebar.js";
import {enSidebarConfig, zhSidebarConfig} from "./sidebar/index.js";
import {enNavbarConfig, zhNavbarConfig} from "./navbar/index.js";
export default hopeTheme({
hostname: "https://vuepress-theme-hope-docs-demo.netlify.app",
author: {
name: "远野千束",
url: "https://sfkm.me",
locales: {
"/": {
navbar: zhNavbarConfig,
sidebar: zhSidebarConfig,
author: {
name: "远野千束",
url: "https://sfkm.me",
}
},
"/en/": {
navbar: enNavbarConfig,
sidebar: enSidebarConfig,
author: {
name: "SnowyKami",
url: "https://sfkm.me",
}
}
},
iconAssets: "fontawesome-with-brands",
@ -19,12 +35,6 @@ export default hopeTheme({
docsDir: "docs",
// 导航栏
navbar,
// 侧边栏
sidebar,
// 页脚
footer: "LiteyukiBot",
displayFooter: true,

View File

@ -79,5 +79,45 @@ highlights:
details: 如果你有多个 Python 环境,请使用 <code>pythonx -m pip install -r requirements.txt</code>
- title: 使用 <code>python main.py</code> 启动项目。
copyright: © 2021-2024 SnowyKami All Rights Reserved
---
<script>
// 定义全局变量来存储数据
let globalTotal = 0;
let globalOnline = 0;
// 从API获取数据并更新全局变量
function fetchAndUpdateData() {
Promise.all([
fetch("https://api.liteyuki.icu/count").then(res => res.json()),
fetch("https://api.liteyuki.icu/online").then(res => res.json())
])
.then(([countRes, onlineRes]) => {
globalTotal = countRes.register;
globalOnline = onlineRes.online;
})
.catch(err => {
console.error("Error fetching data:", err);
});
}
// 更新页面显示,使用全局变量中的数据
function updatePageDisplay() {
let countInfo = document.getElementById("count-info");
if (!countInfo) {
let info = `<div id="count-info" style="text-align: center; font-size: 20px; font-weight: 500">
全球实例:<span id="total">${globalTotal}</span>&nbsp;&nbsp;&nbsp;&nbsp;当前在线:<span id="online">${globalOnline}</span></div>`;
let mainDescription = document.querySelector("#main-description");
if (mainDescription) {
mainDescription.insertAdjacentHTML('afterend', info);
}
}
}
// 初始调用更新数据
fetchAndUpdateData();
updatePageDisplay();
// 设置定时器,分别以不同频率调用更新数据和更新页面的函数
setInterval(fetchAndUpdateData, 10000); // 每10秒更新一次数据
setInterval(updatePageDisplay, 1000); // 每1秒更新一次页面显示
</script>

View File

@ -30,54 +30,94 @@ highlights:
background-repeat: repeat
background-size: initial
features:
- title: 支持多种框架
- title: Multi-Framework Support
icon: robot
details: 兼容nonebotmelobot等拥有良好的生态支持
details: Compatible with nonebot, melobot, etc., with good ecological support
link: https://nonebot.dev/
- title: 便捷管理
- title: Convenient Management
icon: plug
details: 使用包管理器,便捷管理插件及资源包
details: Use package manager to manage plugins and resource packs
- title: 主题支持
- title: Custom Themes Support
icon: paint-brush
details: 使用资源包对外观进行完全自定义
details: Fully customize the appearance with resource packs
link: https://bot.liteyuki.icu/usage/resource_pack.html
- title: 国际化
- title: i18n
icon: globe
details: 通过资源包支持多种语言
details: Support multiple languages through resource packs
link: https://baike.baidu.com/item/i18n/6771940
- title: 简易使用
- title: Easy to Use
icon: cog
details: 无需繁琐前期过程,开箱即用
details: No need for cumbersome pre-processes, ready to use
link: https://bot.liteyuki.icu/deployment/config.html
- title: 超高性能
- title: High Performance
icon: tachometer-alt
details: 500个插件2s内启动
details: 500 plugins, start within 2s
- title: 滚动更新
- title: Rolling Update
icon: cloud-download
details: 让你的机器人保持最新提交
details: Keep your bot up to date
- title: 开源项目
- title: OpenSource
icon: code
details: 项目遵循MIT LICENCE开源欢迎各位的贡献
details: MIT LICENCE open source project, welcome your contribution
- header: 快速部署
- header: Quick Start
image: /assets/image/box.svg
bgImage: https://theme-hope-assets.vuejs.press/bg/3-light.svg
bgImageDark: https://theme-hope-assets.vuejs.press/bg/3-dark.svg
highlights:
- title: 安装 Git 及 Python3.10+
- title: 使用 <code>git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1</code> 以克隆项目至本地。
details: 如果无法连接到GitHub可以使用 <code>git clone https://gitee.com/snowykami/LiteyukiBot --depth=1</code>
- title: 使用 <code>cd LiteyukiBot</code> 切换到项目目录。
- title: 使用 <code>pip install -r requirements.txt</code> 安装项目依赖。
details: 如果你有多个 Python 环境,请使用 <code>pythonx -m pip install -r requirements.txt</code>
- title: 使用 <code>python main.py</code> 启动项目。
- title: Install Git and Python3.10+ environment
- title: Use <code>git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1</code> to clone the project locally
- title: Use <code>cd LiteyukiBot</code> to change the directory to the project root
- title: Use <code>pip install -r requirements.txt</code> install the project dependencies
details: If you have multiple Python environments, please use <code>pythonx -m pip install -r requirements.txt</code>.
- title: Start bot with <code>python main.py</code>.
copyright: © 2021-2024 SnowyKami All Rights Reserved
---
<script>
// 定义全局变量来存储数据
let globalTotal = 0;
let globalOnline = 0;
// 从API获取数据并更新全局变量
function fetchAndUpdateData() {
Promise.all([
fetch("https://api.liteyuki.icu/count").then(res => res.json()),
fetch("https://api.liteyuki.icu/online").then(res => res.json())
])
.then(([countRes, onlineRes]) => {
globalTotal = countRes.register;
globalOnline = onlineRes.online;
})
.catch(err => {
console.error("Error fetching data:", err);
});
}
// 更新页面显示,使用全局变量中的数据
function updatePageDisplay() {
let countInfo = document.getElementById("count-info");
if (!countInfo) {
let info = `<div id="count-info" style="text-align: center; font-size: 20px; font-weight: 500">
Instances: <span id="total">${globalTotal}</span>&nbsp;&nbsp;&nbsp;&nbsp;Online: <span id="online">${globalOnline}</span></div>`;
let mainDescription = document.querySelector("#main-description");
if (mainDescription) {
mainDescription.insertAdjacentHTML('afterend', info);
}
}
}
// 初始调用更新数据
fetchAndUpdateData();
updatePageDisplay();
// 设置定时器,分别以不同频率调用更新数据和更新页面的函数
setInterval(fetchAndUpdateData, 10000); // 每10秒更新一次数据
setInterval(updatePageDisplay, 1000); // 每1秒更新一次页面显示
</script>

View File

@ -1,8 +1,8 @@
---
title: 项目部署
title: Deploy
index: false
icon: laptop-code
category: 部署
category: deploy
---
<Catalog />

View File

@ -1,11 +1,10 @@
---
title: 配置
title: Configuration
icon: cog
order: 2
category: 使用指南
category: deployment
tag:
- 配置
- 部署
- Configuration
---
轻雪支持`yaml`、`json`和`toml`作为配置文件,取决于你个人的喜好

View File

@ -1,11 +1,10 @@
---
title: 答疑
title: FAQ
icon: question
order: 3
category: 使用指南
category: deployment
tag:
- 配置
- 部署
- FAQ
---
## **常见问题**

61
docs/en/deploy/install.md Normal file
View File

@ -0,0 +1,61 @@
---
title: Installation
icon: download
order: 1
category: deployment
tag:
- 安装
---
## **Installation**
### **Conventional deployment**
1. Install [`Git`](https://git-scm.com/download/) and [`Python3.10+`](https://www.python.org/downloads/release/python-31010/) environment
```bash
# Clone the project locally, --depth=1 to reduce the size of the cloned repository, this project updates depend on Git
git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1
# change the directory to the project root
cd LiteyukiBot
# install the project dependencies
pip install -r requirements.txt
# start bot
python main.py
```
> [!tip]
> Recommended to use `venv` to run Liteyuki to avoid dependency conflicts, you can use `python -m venv .venv` to create a virtual environment, and then use `.venv\Scripts\activate` to activate the virtual environment (use `source .venv/bin/activate` to activate on Linux)
### **Use docker**
1. Install [`Docker`](https://docs.docker.com/get-docker/)
2. Clone project repo `git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1`
3. change directory `cd LiteyukiBot`
4. build image with `docker build -t liteyukibot .`
5. start container `docker run -p 20216:20216 -v $(pwd):/liteyukibot -v $(pwd)/.cache:/root/.cache liteyukibot`
> [!tip]
> For Windows, please use the absolute project directory `/path/to/LiteyukiBot` instead of $(pwd)
>
> If you have changed the port number, replace `20216` in `20216:20216` with your port number
### **Use TRSS Scripts**
[TRSS_Liteyuki LiteyukiBot manage script](https://timerainstarsky.github.io/TRSS_Liteyuki/), This feature is supported by TRSS and is not an official feature of LiteyukiBot. It is recommended to use Arch Linux.
## **Device requirements**
- Minimum Windows system version: `Windows 10+` / `Windows Server 2019+`
- Linux systems need to support Python 3.10+, with `Ubuntu 20.04+` recommended
- CPU: `1 vCPU` and more(Bot is multi processes, the more cores, the better the performance)
- Memory: Without other plugins, the Bot will occupy `300~500MB`, including processes like `chromium` and `node`. The memory occupied by other plugins depends on the specific plugins, and it is recommended to have more than `1GB`.
- Storage: At least `1GB` of space is required.
> [!warning]
> If there are multiple environments on the device, please use `path/to/python -m pip install -r requirements.txt` to install dependencies, where `path/to/python` is the path to your Python executable.
> [!warning]
> The update feature of Liteyuki depends on Git. If you have not installed Git and directly download the source code to run, you will not be able to use the update feature.
#### For other issues, please go to [Q&A](/deployment/fandq)

View File

@ -1,60 +0,0 @@
---
title: 安装
icon: download
order: 1
category: 使用指南
tag:
- 安装
---
## **开始安装**
### **常规部署**
1. 安装 [`Git`](https://git-scm.com/download/) 和 [`Python3.10+`](https://www.python.org/downloads/release/python-31010/) 环境
```bash
# 克隆项目到本地轻雪使用Git进行版本管理该步骤为必要项
git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1
# 切换到Bot目录下
cd LiteyukiBot
# 安装依赖
pip install -r requirements.txt
# 启动Bot
python main.py
```
> [!tip]
> 推荐使用虚拟环境来运行轻雪,以避免依赖冲突,你可以使用`python -m venv .venv`来创建虚拟环境,然后使用`.venv\Scripts\activate`来激活虚拟环境Linux下使用`source .venv/bin/activate`激活)
### **使用Docker构建镜像部署**
1. 安装 [`Docker`](https://docs.docker.com/get-docker/)
2. 克隆项目 `git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1`
3. 进入轻雪目录 `cd LiteyukiBot`
4. 构建镜像 `docker build -t liteyukibot .`
5. 启动容器 `docker run -p 20216:20216 -v $(pwd):/liteyukibot -v $(pwd)/.cache:/root/.cache liteyukibot`
> [!tip]
> Windows请使用项目绝对目录`/path/to/LiteyukiBot`代替`$(pwd)` <br>
> 若你修改了端口号请将`20216:20216`中的`20216`替换为你的端口号
### **使用TRSS Scripts部署**
[TRSS_Liteyuki轻雪机器人管理脚本](https://timerainstarsky.github.io/TRSS_Liteyuki/)该功能由TRSS提供支持不是LiteyukiBot官方提供的功能推荐使用`Arch Linux`
## **设备要求**
- Windows系统版本最低`Windows10+`/`Windows Server 2019+`
- Linux系统要支持Python3.10+,推荐`Ubuntu 20.04+`(~~别用你那b CentOS~~)
- CPU: 至少`1vCPU`
- 内存: Bot无其他插件会占用`300~500MB`,包括`chromium` 及 `node`等进程,其他插件占用视具体插件而定,建议`1GB`以上
- 硬盘: 至少`1GB`空间
> [!warning]
> 如果设备上有多个环境,请使用`path/to/python -m pip install -r requirements.txt`来安装依赖,`path/to/python`为你的Python可执行文件路径
> [!warning]
> 轻雪的更新功能依赖Git如果你没有安装Git直接下载源代码运行你将无法使用更新功能
#### 其他问题请移步至[答疑](/deployment/fandq)

View File

@ -1,5 +1,5 @@
---
title: 开发及贡献
title: Contribute
index: false
icon: laptop-code
category: 开发

View File

@ -1,8 +1,8 @@
---
title: 进程通信
title: Communication
icon: exchange-alt
order: 4
category: 开发
category: development
---
## **通道通信**

View File

@ -1,8 +1,8 @@
---
title: 轻雪函数
title: Liteyuki Function
icon: code
order: 2
category: 开发
category: development
---
## **轻雪函数**

View File

@ -1,8 +1,8 @@
---
title: 轻雪插件开发
title: Liteyuki Plugin
icon: laptop-code
order: 3
category: 开发
category: development
---

View File

@ -1,8 +1,8 @@
---
title: 资源包开发
title: Resource Pack
icon: box
order: 1
category: 开发
category: development
---
## 简介

View File

@ -1,8 +1,8 @@
---
title: 资源及插件商店
title: Extensions Store
index: false
icon: store
category: 商店
category: store
---
<Catalog />

View File

@ -1,8 +1,8 @@
---
title: 插件商店
title: Plugin Store
icon: plug
order: 2
category: 使用手册
category: extension
---
<pluginStoreComp />

View File

@ -1,8 +1,8 @@
---
title: 资源商店
title: Resource Store
icon: box
order: 1
category: 使用手册
category: extension
---
<resourceStoreComp />

View File

@ -1,8 +1,8 @@
---
title: 使用手册
title: Usage
index: false
icon: laptop-code
category: 使用手册
category: usage
---
<Catalog />

View File

@ -1,8 +1,8 @@
---
title: 用户协议
title: User Agreement
icon: user-secret
order: 3
category: 使用手册
category: usage
---
1. 本项目遵循`MIT`协议,你可以自由使用,修改,分发,但是请保留原作者信息

View File

@ -1,8 +1,8 @@
---
title: 基础命令
title: Basic Commands
icon: comment
order: 1
category: 使用手册
category: usage
---
# 基础插件

View File

@ -1,8 +1,8 @@
---
title: 功能命令
title: Extra Commands
icon: comment
order: 2
category: 使用手册
category: usage
---
## 功能插件命令

View File

@ -1,13 +0,0 @@
---
title: 轻雪API
icon: code
order: 5
category: 使用指南
tag:
- 配置
- 部署
---
## **轻雪API**
轻雪API是轻雪运行中部分服务的支持由`go`语言编写,例如错误反馈,图床链接等,目前服务由轻雪服务器提供,用户无需额外部署

View File

@ -1,13 +0,0 @@
---
title: 轻雪API
icon: code
order: 5
category: 使用指南
tag:
- 配置
- 部署
---
## **轻雪API**
轻雪API是轻雪运行中部分服务的支持由`go`语言编写,例如错误反馈,图床链接等,目前服务由轻雪服务器提供,用户无需额外部署