From e4c98cb7cce697792914b4eea7ecec6c127b3b6f Mon Sep 17 00:00:00 2001 From: JustAnotherID Date: Mon, 5 Aug 2024 14:38:45 +0800 Subject: [PATCH] =?UTF-8?q?[Docs]=20=E5=B0=86=20Core=20=E5=92=8C=20OneBot?= =?UTF-8?q?=20=E5=9C=A8=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 1 + docs/.vitepress/catalogue.ts | 225 ++++++++++++++++++++++++++++ docs/.vitepress/config.js | 281 ----------------------------------- docs/.vitepress/config.mts | 13 ++ docs/.vitepress/nav.ts | 72 +++++++++ docs/.vitepress/theme.ts | 62 ++++++++ docs/index.md | 13 ++ 7 files changed, 386 insertions(+), 281 deletions(-) create mode 100644 docs/.vitepress/catalogue.ts delete mode 100644 docs/.vitepress/config.js create mode 100644 docs/.vitepress/config.mts create mode 100644 docs/.vitepress/nav.ts create mode 100644 docs/.vitepress/theme.ts diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 51e8ba03..0b86967a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,7 @@ on: push: branches: - main + workflow_dispatch: jobs: deploy: diff --git a/docs/.vitepress/catalogue.ts b/docs/.vitepress/catalogue.ts new file mode 100644 index 00000000..0d027ba1 --- /dev/null +++ b/docs/.vitepress/catalogue.ts @@ -0,0 +1,225 @@ +export const coreSidebar = { + text: "Lagrange.Core", + base: "", + items: [ + { + text: "Lagrange.Core", + link: "/Lagrange.Core/", + }, + { + text: "Bot 实例", + items: [ + { + text: "创建 Bot 实例", + link: "/Lagrange.Core/CreateBot/", + }, + ], + }, + { + text: "登录", + link: "/Lagrange.Core/Login/", + items: [ + { + text: "扫码登录", + link: "/Lagrange.Core/Login/LoginByScanQrCode", + }, + { + text: "密码登录", + link: "/Lagrange.Core/Login/LoginByPassword", + }, + { + text: "扩展", + link: "/Lagrange.Core/Login/Extern" + }, + ], + }, + { + text: "消息实体", + link: "/Lagrange.Core/MessageEntity/", + items: [ + { + text: "消息实体接口", + link: "/Lagrange.Core/MessageEntity/IMessageEntity", + }, + { + text: "表情消息", + link: "/Lagrange.Core/MessageEntity/FaceEntity", + }, + { + text: "文件消息", + link: "/Lagrange.Core/MessageEntity/FileEntity", + }, + { + text: "回复消息", + link: "/Lagrange.Core/MessageEntity/ForwardEntity", + }, + { + text: "图片消息", + link: "/Lagrange.Core/MessageEntity/ImageEntity", + }, + { + text: "JSON 消息", + link: "/Lagrange.Core/MessageEntity/JsonEntity", + }, + { + text: "提及消息", + link: "/Lagrange.Core/MessageEntity/MentionEntity", + }, + { + text: "合并转发消息", + link: "/Lagrange.Core/MessageEntity/MultiMsgEntity", + }, + { + text: "文本消息", + link: "/Lagrange.Core/MessageEntity/TextEntity", + }, + { + text: "视频消息", + link: "/Lagrange.Core/MessageEntity/VideoEntity", + }, + { + text: "XML 消息", + link: "/Lagrange.Core/MessageEntity/XmlEntity", + }, + ], + }, + { + text: "消息链", + link: "/Lagrange.Core/MessageChain/", + items: [ + { + text: "消息链", + link: "/Lagrange.Core/MessageChain/MessageChain", + }, + { + text: "构造消息链", + link: "/Lagrange.Core/MessageChain/MessageBuilder", + }, + { + text: "解析消息链", + link: "/Lagrange.Core/MessageChain/ParseMessageChain", + }, + ], + }, + { + text: "事件", + link: "/Lagrange.Core/Event/", + items: [ + { text: "事件委托", link: "/Lagrange.Core/Event/EventInvoker" }, + { text: "事件数据", link: "/Lagrange.Core/Event/EventArgs" }, + ], + }, + { + text: "发送", + link: "/Lagrange.Core/Send/", + items: [ + { text: "发送消息", link: "/Lagrange.Core/Send/SendMessage" }, + { + text: "发送消息结果", + link: "/Lagrange.Core/Send/MessageResult", + }, + ], + }, + ], +} + +export const oneBotSidebar = { + text: "Lagrange.OneBot", + base: "", + items: [ + { + text: "Lagrange.OneBot", + link: "/Lagrange.OneBot/", + }, + { + text: "快速开始", + items: [ + { + text: "快速部署 & 配置", + link: "/Lagrange.OneBot/Config/", + }, + ], + }, + { + text: "API", + items: [ + { + text: "OneBot V11 标准 API", + link: "/Lagrange.OneBot/API/OneBot/", + }, + { + text: "拓展 API", + link: "/Lagrange.OneBot/API/Extend/", + items: [ + { + text: "获取收藏表情", + link: "/Lagrange.OneBot/API/Extend/#获取收藏表情", + }, + { + text: "获取好友历史消息记录", + link: "/Lagrange.OneBot/API/Extend/#获取好友历史消息记录", + }, + { + text: "获取群组历史消息记录", + link: "/Lagrange.OneBot/API/Extend/#获取群组历史消息记录", + }, + { + text: "构造合并转发消息", + link: "/Lagrange.OneBot/API/Extend/#构造合并转发消息", + }, + { + text: "发送合并转发 (群聊)", + link: "/Lagrange.OneBot/API/Extend/#发送合并转发-群聊", + }, + { + text: "发送合并转发 (好友)", + link: "/Lagrange.OneBot/API/Extend/#发送合并转发-好友", + }, + { + text: "上传群文件", + link: "/Lagrange.OneBot/API/Extend/#上传群文件", + }, + { + text: "私聊发送文件", + link: "/Lagrange.OneBot/API/Extend/#私聊发送文件", + }, + { + text: "获取群根目录文件列表", + link: "/Lagrange.OneBot/API/Extend/#获取群根目录文件列表", + }, + { + text: "获取群子目录文件列表", + link: "/Lagrange.OneBot/API/Extend/#获取群子目录文件列表", + }, + { + text: "获取群文件资源链接", + link: "/Lagrange.OneBot/API/Extend/#获取群文件资源链接", + }, + { + text: "好友戳一戳", + link: "/Lagrange.OneBot/API/Extend/#好友戳一戳", + }, + { + text: "群组戳一戳", + link: "/Lagrange.OneBot/API/Extend/#群组戳一戳", + }, + { + text: "设置群组专属头衔", + link: "/Lagrange.OneBot/API/Extend/#设置群组专属头衔", + }, + ], + }, + ], + }, + { + text: "Segment", + items: [ + { + text: "OneBot V11 标准消息链", + link: "/Lagrange.OneBot/Segment/OneBot/", + }, + { text: "拓展消息链", link: "/Lagrange.OneBot/Segment/Extend/" }, + ], + }, + ], +} diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js deleted file mode 100644 index 3d8a382b..00000000 --- a/docs/.vitepress/config.js +++ /dev/null @@ -1,281 +0,0 @@ -module.exports = { - title: "Lagrange 文档", - description: "Lagrange's document", - base: "/Lagrange.Doc/", - lang: "zh-CN", - cleanUrls: true, - lastUpdated: true, - themeConfig: { - search: { - provider: 'local' - }, - nav: [ - { text: "首页", link: "/" }, - { - text: "GitHub", - items: [ - { - text: "Lagrange.Core", - link: "https://github.com/LagrangeDev/Lagrange.Core", - }, - - { - text: "lagrangejs", - link: "https://github.com/LagrangeDev/lagrangejs", - }, - { - text: "lagrange-python", - link: "https://github.com/LagrangeDev/lagrange-python", - }, - { - text: "Lagrange.Doc", - link: "https://github.com/LagrangeDev/Lagrange.Doc", - }, - ], - }, - ], - sidebar: [ - { - text: "首页", - link: "/", - collapsed: false, - items: [{ text: "简介", link: "/" }], - }, - { - text: "Lagrange.Core", - link: "/Lagrange.Core/", - collapsed: false, - items: [ - { - text: "创建 Bot 实例", - link: "/Lagrange.Core/CreateBot/" - }, - { - text: "登录", - link: "/Lagrange.Core/Login/", - collapsed: true, - items: [ - { - text: "扫码登录", - link: "/Lagrange.Core/Login/LoginByScanQrCode", - }, - { - text: "密码登录", - link: "/Lagrange.Core/Login/LoginByPassword", - }, - { text: "扩展", link: "/Lagrange.Core/Login/Extern" }, - ], - }, - { - text: "消息实体", - link: "/Lagrange.Core/MessageEntity/", - collapsed: true, - items: [ - { - text: "消息实体接口", - link: "/Lagrange.Core/MessageEntity/IMessageEntity", - }, - { - text: "表情消息", - link: "/Lagrange.Core/MessageEntity/FaceEntity", - }, - { - text: "文件消息", - link: "/Lagrange.Core/MessageEntity/FileEntity", - }, - { - text: "回复消息", - link: "/Lagrange.Core/MessageEntity/ForwardEntity", - }, - { - text: "图片消息", - link: "/Lagrange.Core/MessageEntity/ImageEntity", - }, - { - text: "JSON 消息", - link: "/Lagrange.Core/MessageEntity/JsonEntity", - }, - { - text: "提及消息", - link: "/Lagrange.Core/MessageEntity/MentionEntity", - }, - { - text: "合并转发消息", - link: "/Lagrange.Core/MessageEntity/MultiMsgEntity", - }, - { - text: "文本消息", - link: "/Lagrange.Core/MessageEntity/TextEntity", - }, - { - text: "视频消息", - link: "/Lagrange.Core/MessageEntity/VideoEntity", - }, - { - text: "XML 消息", - link: "/Lagrange.Core/MessageEntity/XmlEntity", - }, - ], - }, - { - text: "消息链", - link: "/Lagrange.Core/MessageChain/", - collapsed: true, - items: [ - { - text: "消息链", - link: "/Lagrange.Core/MessageChain/MessageChain", - }, - { - text: "构造消息链", - link: "/Lagrange.Core/MessageChain/MessageBuilder", - }, - { - text: "解析消息链", - link: "/Lagrange.Core/MessageChain/ParseMessageChain", - }, - ], - }, - { - text: "事件", - link: "/Lagrange.Core/Event/", - collapsed: true, - items: [ - { text: "事件委托", link: "/Lagrange.Core/Event/EventInvoker" }, - { text: "事件数据", link: "/Lagrange.Core/Event/EventArgs" }, - ], - }, - { - text: "发送", - link: "/Lagrange.Core/Send/", - collapsed: true, - items: [ - { text: "发送消息", link: "/Lagrange.Core/Send/SendMessage" }, - { - text: "发送消息结果", - link: "/Lagrange.Core/Send/MessageResult", - }, - ], - }, - ], - }, - { - text: "Lagrange.OneBot", - link: "/Lagrange.OneBot/", - collapsed: false, - items: [ - { - text: "快速部署 & 配置", - link: "/Lagrange.OneBot/Config/", - }, - { - text: "API", - collapsed: true, - items: [ - { - text: "OneBot V11 标准 API", - link: "/Lagrange.OneBot/API/OneBot/", - }, - { - text: "拓展 API", - link: "/Lagrange.OneBot/API/Extend/", - collapsed: true, - items: [ - { - text: "获取收藏表情", - link: "/Lagrange.OneBot/API/Extend/#获取收藏表情", - }, - { - text: "获取好友历史消息记录", - link: "/Lagrange.OneBot/API/Extend/#获取好友历史消息记录", - }, - { - text: "获取群组历史消息记录", - link: "/Lagrange.OneBot/API/Extend/#获取群组历史消息记录", - }, - { - text: "构造合并转发消息", - link: "/Lagrange.OneBot/API/Extend/#构造合并转发消息", - }, - { - text: "发送合并转发 (群聊)", - link: "/Lagrange.OneBot/API/Extend/#发送合并转发-群聊", - }, - { - text: "发送合并转发 (好友)", - link: "/Lagrange.OneBot/API/Extend/#发送合并转发-好友", - }, - { - text: "上传群文件", - link: "/Lagrange.OneBot/API/Extend/#上传群文件", - }, - { - text: "私聊发送文件", - link: "/Lagrange.OneBot/API/Extend/#私聊发送文件", - }, - { - text: "获取群根目录文件列表", - link: "/Lagrange.OneBot/API/Extend/#获取群根目录文件列表", - }, - { - text: "获取群子目录文件列表", - link: "/Lagrange.OneBot/API/Extend/#获取群子目录文件列表", - }, - { - text: "获取群文件资源链接", - link: "/Lagrange.OneBot/API/Extend/#获取群文件资源链接", - }, - { - text: "好友戳一戳", - link: "/Lagrange.OneBot/API/Extend/#好友戳一戳", - }, - { - text: "群组戳一戳", - link: "/Lagrange.OneBot/API/Extend/#群组戳一戳", - }, - { - text: "设置群组专属头衔", - link: "/Lagrange.OneBot/API/Extend/#设置群组专属头衔", - }, - ], - }, - ], - }, - { - text: "Segment", - collapsed: true, - items: [ - { - text: "OneBot V11 标准消息链", - link: "/Lagrange.OneBot/Segment/OneBot/", - }, - { text: "拓展消息链", link: "/Lagrange.OneBot/Segment/Extend/" }, - ], - }, - ], - }, - ], - socialLinks: [ - { icon: "github", link: "https://github.com/LagrangeDev/Lagrange.Doc" }, - ], - editLink: { - pattern: - "https://github.com/LagrangeDev/Lagrange.Doc/edit/main/docs/:path", - text: "在 GitHub 上帮助我们完善这个页面", - }, - docFooter: { - prev: "上一页", - next: "下一页", - }, - lastUpdated: { - text: "最后更新", - }, - outlineTitle: "目录", - sidebarMenuLabel: "菜单", - returnToTopLabel: "返回顶部", - externalLinkIcon: true, - darkModeSwitchLabel: "外观", - lightModeSwitchTitle: "切换到浅色模式", - darkModeSwitchTitle: "切换到深色模式", - }, -} diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts new file mode 100644 index 00000000..5590aae9 --- /dev/null +++ b/docs/.vitepress/config.mts @@ -0,0 +1,13 @@ +import type { DefaultTheme, UserConfig } from "vitepress" +import { defineConfig } from "vitepress" +import { theme } from "./theme" + +export default defineConfig({ + title: "Lagrange 文档", + description: "Lagrange's document", + base: "/Lagrange.Doc/", + lang: "zh-CN", + cleanUrls: true, + lastUpdated: true, + themeConfig: theme, +} as UserConfig) diff --git a/docs/.vitepress/nav.ts b/docs/.vitepress/nav.ts new file mode 100644 index 00000000..37c94944 --- /dev/null +++ b/docs/.vitepress/nav.ts @@ -0,0 +1,72 @@ +export const coreNav = { + text: "Lagrange.Core", + base: "", + items: [ + { + text: "Lagrange.Core", + link: "/Lagrange.Core/", + }, + { + text: "Bot 实例", + link: "/Lagrange.Core/CreateBot/", + }, + { + text: "登录", + link: "/Lagrange.Core/Login/", + }, + { + text: "消息实体", + link: "/Lagrange.Core/MessageEntity/", + }, + { + text: "消息链", + link: "/Lagrange.Core/MessageChain/", + }, + { + text: "事件", + link: "/Lagrange.Core/Event/", + }, + { + text: "发送", + link: "/Lagrange.Core/Send/", + }, + ], +} + +export const oneBotNav = { + text: "Lagrange.OneBot", + base: "", + items: [ + { + text: "Lagrange.OneBot", + link: "/Lagrange.OneBot/", + }, + { + text: "快速开始", + link: "/Lagrange.OneBot/Config/", + }, + { + text: "API", + items: [ + { + text: "OneBot V11 标准 API", + link: "/Lagrange.OneBot/API/OneBot/", + }, + { + text: "拓展 API", + link: "/Lagrange.OneBot/API/Extend/", + }, + ], + }, + { + text: "Segment", + items: [ + { + text: "OneBot V11 标准消息链", + link: "/Lagrange.OneBot/Segment/OneBot/", + }, + { text: "拓展消息链", link: "/Lagrange.OneBot/Segment/Extend/" }, + ], + }, + ], +} diff --git a/docs/.vitepress/theme.ts b/docs/.vitepress/theme.ts new file mode 100644 index 00000000..2fad7c57 --- /dev/null +++ b/docs/.vitepress/theme.ts @@ -0,0 +1,62 @@ +import { DefaultTheme } from "vitepress" +import { coreSidebar, oneBotSidebar } from "./catalogue" +import { coreNav, oneBotNav } from "./nav" + +export const theme: DefaultTheme.Config = { + search: { + provider: 'local' + }, + nav: [ + { text: "首页", link: "/" }, + coreNav, + oneBotNav, + { + text: "GitHub", + items: [ + { + text: "Lagrange.Core", + link: "https://github.com/LagrangeDev/Lagrange.Core", + }, + + { + text: "lagrangejs", + link: "https://github.com/LagrangeDev/lagrangejs", + }, + { + text: "lagrange-python", + link: "https://github.com/LagrangeDev/lagrange-python", + }, + { + text: "Lagrange.Doc", + link: "https://github.com/LagrangeDev/Lagrange.Doc", + }, + ], + }, + ] as DefaultTheme.NavItem[], + sidebar: { + "/Lagrange.Core/": coreSidebar, + "/Lagrange.OneBot/": oneBotSidebar, + } as DefaultTheme.SidebarMulti, + socialLinks: [ + { icon: "github", link: "https://github.com/LagrangeDev/Lagrange.Doc" }, + ], + editLink: { + pattern: + "https://github.com/LagrangeDev/Lagrange.Doc/edit/main/docs/:path", + text: "在 GitHub 上帮助我们完善这个页面", + }, + docFooter: { + prev: "上一页", + next: "下一页", + }, + lastUpdated: { + text: "最后更新", + }, + outlineTitle: "目录", + sidebarMenuLabel: "菜单", + returnToTopLabel: "返回顶部", + externalLinkIcon: true, + darkModeSwitchLabel: "外观", + lightModeSwitchTitle: "切换到浅色模式", + darkModeSwitchTitle: "切换到深色模式", +} diff --git a/docs/index.md b/docs/index.md index f9c2d8b5..69d031ee 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,16 @@ +--- +layout: home + +hero: + name: Lagrange.Doc + tagline: Lagrange 使用手册 + actions: + - text: 使用 Lagrange.Core + link: ./Lagrange.Core/index + - text: 使用 Lagrange.OneBot + link: ./Lagrange.OneBot/index +--- + # 简介 Lagrange.Core 是一个开源的 NTQQ 协议实现, 当前处于稳定期, 免责声明详见项目主页