🏗️ change doc theme

This commit is contained in:
yanyongyu 2021-12-01 16:28:55 +08:00
parent b92c1a0b33
commit a414406039
111 changed files with 8887 additions and 11998 deletions

441
.gitignore vendored
View File

@ -1,5 +1,295 @@
# ----- Python -----
# ----- Project -----
.idea
.vscode
dev
docs_build/_build
!tests/.env
.docusaurus
# Created by https://www.toptal.com/developers/gitignore/api/python,node,visualstudiocode,jetbrains,macos,windows,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=python,node,visualstudiocode,jetbrains,macos,windows,linux
### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env.production
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
.stylelintcache
# SvelteKit build / generate output
.svelte-kit
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
@ -22,6 +312,7 @@ parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
@ -40,23 +331,25 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
@ -69,22 +362,39 @@ instance/
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# IPython
profile_default/
ipython_config.py
# celery beat schedule file
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
@ -104,90 +414,61 @@ venv.bak/
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# ----- Node -----
# Pyre type checker
.pyre/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# pytype static type analyzer
.pytype/
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Cython debug symbols
cython_debug/
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Coverage directory used by tools like istanbul
coverage
# Local History for Visual Studio Code
.history/
# nyc test coverage
.nyc_output
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Support for Project snippet scope
!.vscode/*.code-snippets
# Bower dependency directory (https://bower.io/)
bower_components
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# node-waf configuration
.lock-wscript
# Dump file
*.stackdump
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Folder config file
[Dd]esktop.ini
# Dependency directories
node_modules/
jspm_packages/
# Recycle Bin used on file shares
$RECYCLE.BIN/
# TypeScript v1 declaration files
typings/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Optional npm cache directory
.npm
# Windows shortcuts
*.lnk
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# ----- Project -----
.idea
.vscode
dev
docs_build/_build
!tests/.env
*.xmind
yarn.lock
.DS_Store
# End of https://www.toptal.com/developers/gitignore/api/python,node,visualstudiocode,jetbrains,macos,windows,linux

View File

@ -1,286 +0,0 @@
const path = require("path");
module.exports = (context) => ({
base: process.env.VUEPRESS_BASE || "/",
title: "NoneBot",
description: "跨平台 Python 异步 QQ 机器人框架",
markdown: {
lineNumbers: true,
},
/**
* Extra tags to be injected to the page HTML `<head>`
*
* refhttps://v1.vuepress.vuejs.org/config/#head
*/
head: [
["link", { rel: "icon", href: "/logo.png" }],
["link", { rel: "manifest", href: "/manifest.json" }],
["meta", { name: "theme-color", content: "#ea5252" }],
["meta", { name: "application-name", content: "NoneBot" }],
["meta", { name: "apple-mobile-web-app-title", content: "NoneBot" }],
["meta", { name: "apple-mobile-web-app-capable", content: "yes" }],
[
"meta",
{ name: "apple-mobile-web-app-status-bar-style", content: "black" },
],
[
"link",
{ rel: "apple-touch-icon", href: "/icons/apple-touch-icon-180x180.png" },
],
[
"link",
{
rel: "mask-icon",
href: "/icons/safari-pinned-tab.svg",
color: "#ea5252",
},
],
[
"meta",
{
name: "msapplication-TileImage",
content: "/icons/mstile-150x150.png",
},
],
["meta", { name: "msapplication-TileColor", content: "#ea5252" }],
[
"link",
{
rel: "stylesheet",
href:
"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css",
},
],
],
locales: {
"/": {
lang: "zh-CN",
title: "NoneBot",
description: "跨平台 Python 异步 QQ 机器人框架",
},
},
theme: "nonebot",
themeConfig: {
logo: "/logo.png",
repo: "nonebot/nonebot2",
docsDir: "docs",
docsBranch: "dev",
docsDirVersioned: "archive",
docsDirPages: "pages",
editLinks: true,
smoothScroll: true,
algolia: {
apiKey: "ef449608d0ad6e81b9efd05db6367040",
indexName: "nonebot",
algoliaOptions: {
facetFilters: ["lang:zh-CN"],
},
},
locales: {
"/": {
label: "简体中文",
selectText: "Languages",
editLinkText: "在 GitHub 上编辑此页",
lastUpdated: "上次更新",
nav: [
{ text: "主页", link: "/" },
{ text: "指南", link: "/guide/" },
{ text: "进阶", link: "/advanced/" },
{ text: "API", link: "/api/" },
{ text: "商店", link: "/store" },
{ text: "更新日志", link: "/changelog" },
],
sidebarDepth: 2,
sidebar: {
"/guide/": [
{
title: "开始",
collapsable: false,
sidebar: "auto",
children: [
"",
"installation",
"getting-started",
"creating-a-project",
"basic-configuration",
],
},
{
title: "编写插件",
collapsable: false,
sidebar: "auto",
children: [
"loading-a-plugin",
"creating-a-plugin",
"creating-a-matcher",
"creating-a-handler",
"end-or-start",
],
},
{
title: "协议适配",
collapsable: false,
sidebar: "auto",
children: [
"cqhttp-guide",
"ding-guide",
"mirai-guide",
"feishu-guide",
],
},
],
"/advanced/": [
{
title: "进阶",
collapsable: false,
sidebar: "auto",
children: [
"",
"scheduler",
"permission",
"runtime-hook",
"export-and-require",
"overloaded-handlers",
],
},
{
title: "发布",
collapsable: false,
sidebar: "auto",
children: ["publish-plugin"],
},
],
"/api/": [
{
title: "NoneBot Api Reference",
path: "",
collapsable: false,
children: [
{
title: "nonebot 模块",
path: "nonebot",
},
{
title: "nonebot.config 模块",
path: "config",
},
{
title: "nonebot.plugin 模块",
path: "plugin",
},
{
title: "nonebot.message 模块",
path: "message",
},
{
title: "nonebot.matcher 模块",
path: "matcher",
},
{
title: "nonebot.handler 模块",
path: "handler",
},
{
title: "nonebot.rule 模块",
path: "rule",
},
{
title: "nonebot.permission 模块",
path: "permission",
},
{
title: "nonebot.log 模块",
path: "log",
},
{
title: "nonebot.utils 模块",
path: "utils",
},
{
title: "nonebot.typing 模块",
path: "typing",
},
{
title: "nonebot.exception 模块",
path: "exception",
},
{
title: "nonebot.drivers 模块",
path: "drivers/",
},
{
title: "nonebot.drivers.fastapi 模块",
path: "drivers/fastapi",
},
{
title: "nonebot.drivers.quart 模块",
path: "drivers/quart",
},
{
title: "nonebot.drivers.aiohttp 模块",
path: "drivers/aiohttp",
},
{
title: "nonebot.adapters 模块",
path: "adapters/",
},
{
title: "nonebot.adapters.cqhttp 模块",
path: "adapters/cqhttp",
},
{
title: "nonebot.adapters.ding 模块",
path: "adapters/ding",
},
{
title: "nonebot.adapters.mirai 模块",
path: "adapters/mirai",
},
{
title: "nonebot.adapters.feishu 模块",
path: "adapters/feishu",
},
],
},
],
},
},
},
},
plugins: [
"@vuepress/plugin-back-to-top",
"@vuepress/plugin-medium-zoom",
[
"@vuepress/pwa",
{
serviceWorker: true,
updatePopup: {
message: "发现新内容",
buttonText: "刷新",
},
},
],
[
"versioning",
{
versionedSourceDir: path.resolve(context.sourceDir, "..", "archive"),
pagesSourceDir: path.resolve(context.sourceDir, "..", "pages"),
onNewVersion(version, versionDestPath) {
console.log(`Created version ${version} in ${versionDestPath}`);
},
},
],
[
"container",
{
type: "vue",
before: '<pre class="vue-container"><code>',
after: "</code></pre>",
},
],
],
});

View File

@ -1,42 +0,0 @@
/**
* Client app enhancement file.
*
* https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
*/
import Vuetify from "vuetify";
import "vuetify/dist/vuetify.min.css";
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
Vue.use(Vuetify);
options.vuetify = new Vuetify({
icons: {
iconfont: "fa",
values: {
//
}
}
});
if (typeof process === "undefined" || process.env.VUE_ENV !== "server") {
router.onReady(() => {
const { app } = router;
app.$once("hook:mounted", () => {
// temporary fix for https://github.com/vuejs/vuepress/issues/2428
setTimeout(() => {
const { hash } = document.location;
if (hash.length > 1) {
const id = decodeURI(hash.substring(1));
const element = document.getElementById(id);
if (element) element.scrollIntoView();
}
}, 500);
});
});
}
};

View File

@ -1,8 +0,0 @@
/**
* Custom Styles here.
*
* refhttps://v1.vuepress.vuejs.org/config/#index-styl
*/
.home .hero img
max-width 450px!important

View File

@ -1,10 +0,0 @@
/**
* Custom palette here.
*
* refhttps://v1.vuepress.vuejs.org/zh/config/#palette-styl
*/
$accentColor = #ea5252
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34

View File

@ -1,5 +0,0 @@
[
"2.0.0a16",
"2.0.0a15",
"2.0.0a13.post1"
]

View File

@ -1,67 +0,0 @@
# NoneBot Api Reference
* **模块索引**
* [nonebot](nonebot.html)
* [nonebot.config](config.html)
* [nonebot.plugin](plugin.html)
* [nonebot.message](message.html)
* [nonebot.matcher](matcher.html)
* [nonebot.handler](handler.html)
* [nonebot.rule](rule.html)
* [nonebot.permission](permission.html)
* [nonebot.log](log.html)
* [nonebot.utils](utils.html)
* [nonebot.typing](typing.html)
* [nonebot.exception](exception.html)
* [nonebot.drivers](drivers/)
* [nonebot.drivers.fastapi](drivers/fastapi.html)
* [nonebot.drivers.quart](drivers/quart.html)
* [nonebot.drivers.aiohttp](drivers/aiohttp.html)
* [nonebot.adapters](adapters/)
* [nonebot.adapters.cqhttp](adapters/cqhttp.html)
* [nonebot.adapters.ding](adapters/ding.html)
* [nonebot.adapters.mirai](adapters/mirai.html)
* [nonebot.adapters.feishu](adapters/feishu.html)

View File

@ -1,3 +1,8 @@
\-\-\-
id: index
slug: /api/
\-\-\-
NoneBot Api Reference
=====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.adapters 模块
=====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.adapters.ding 模块
===========================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.adapters.feishu 模块
============================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.adapters.mirai 模块
===========================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.config 模块
===================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.handler 模块
====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.drivers 模块
=====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.drivers.aiohttp 模块
=============================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.drivers.fastapi 模块
=============================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.drivers.quart 模块
==========================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.exception 模块
======================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.handler 模块
====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.log 模块
=================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.matcher 模块
====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.message 模块
======================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot 模块
===============

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.permission 模块
=======================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.plugin 模块
====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.rule 模块
====================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.typing 模块
===================

View File

@ -1,7 +1,4 @@
\-\-\-
contentSidebar: true
sidebarDepth: 0
\-\-\-
NoneBot.utils 模块
==================

11243
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
{
"name": "nonebot",
"version": "2.0.0",
"description": "An asynchronous python bot framework.",
"homepage": "https://docs.nonebot.dev/",
"main": "index.js",
"contributors": [
{
"name": "yanyongyu",
"email": "yanyongyu_1@126.com"
}
],
"repository": "https://github.com/nonebot/nonebot/",
"bugs": {
"url": "https://github.com/nonebot/nonebot/issues"
},
"scripts": {
"dev": "vuepress dev docs",
"build": "vuepress build docs",
"lint": "npx prettier --config .prettierrc -c docs/**/* !docs/api/**/*",
"lint:fix": "npx prettier --config .prettierrc --write docs/**/* !docs/api/**/*"
},
"license": "MIT",
"devDependencies": {
"@vuepress/plugin-back-to-top": "^1.7.1",
"@vuepress/plugin-medium-zoom": "^1.7.1",
"@vuepress/plugin-pwa": "^1.7.1",
"vuepress": "^1.7.1",
"vuepress-plugin-versioning": "git+https://github.com/nonebot/vuepress-plugin-versioning.git",
"vuepress-theme-nonebot": "git+https://github.com/nonebot/vuepress-theme-nonebot.git"
},
"dependencies": {
"copy-to-clipboard": "^3.3.1",
"vuetify": "^2.3.16",
"wowjs": "^1.1.3"
}
}

View File

@ -1,6 +0,0 @@
---
---
# 商店
<Store></Store>

33
website/README.md Normal file
View File

@ -0,0 +1,33 @@
# Website
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
### Installation
```
$ yarn
```
### Local Development
```
$ yarn start
```
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
### Build
```
$ yarn build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
### Deployment
```
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

3
website/babel.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

View File

@ -1,3 +1,14 @@
---
sidebar_position: 1
id: advanced
slug: /advanced
options:
menu:
weight: 10
catogory: advanced
---
# 深入
## 它如何工作?

View File

@ -0,0 +1,4 @@
{
"label": "发布",
"position": 1
}

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -1,3 +1,12 @@
---
sidebar_position: 5
options:
menu:
weight: 110
catogory: advanced
---
# 发布插件
## 前注

View File

@ -1,3 +1,12 @@
---
sidebar_position: 5
options:
menu:
weight: 50
catogory: advanced
---
# 跨插件访问
由于 `nonebot2` 独特的插件加载机制,在使用 python 原有的 import 机制来进行插件之间的访问时,很可能会有奇怪的或者意料以外的情况发生。为了避免这种情况的发生,您可以有两种方法来实现跨插件访问:

View File

@ -1,3 +1,12 @@
---
sidebar_position: 6
options:
menu:
weight: 60
catogory: advanced
---
# 事件处理函数重载
当我们在编写 `nonebot2` 应用时,常常会遇到这样一个问题:该怎么让同一类型的不同事件执行不同的响应逻辑?又或者如何让不同的 `adapter` 针对同一类型的事件作出不同响应?

View File

@ -1,3 +1,12 @@
---
sidebar_position: 3
options:
menu:
weight: 30
catogory: advanced
---
# 权限控制
**权限控制**是机器人在实际应用中需要解决的重点问题之一,`Nonebot` 提供了十分完善且灵活的权限控制机制—— `Permission` 机制。接下来我们将对这个机制进行简单的说明。

View File

@ -1,3 +1,12 @@
---
sidebar_position: 4
options:
menu:
weight: 40
catogory: advanced
---
# 钩子函数
[`钩子编程`](https://zh.wikipedia.org/wiki/%E9%92%A9%E5%AD%90%E7%BC%96%E7%A8%8B)

View File

@ -1,3 +1,12 @@
---
sidebar_position: 2
options:
menu:
weight: 20
catogory: advanced
---
# 定时任务
[`APScheduler`](https://apscheduler.readthedocs.io/en/3.x/) —— Advanced Python Scheduler

View File

@ -0,0 +1,50 @@
---
id: index
slug: /api/
---
# NoneBot Api Reference
- **模块索引**
- [nonebot](nonebot.html)
- [nonebot.config](config.html)
- [nonebot.plugin](plugin.html)
- [nonebot.message](message.html)
- [nonebot.matcher](matcher.html)
- [nonebot.handler](handler.html)
- [nonebot.rule](rule.html)
- [nonebot.permission](permission.html)
- [nonebot.log](log.html)
- [nonebot.utils](utils.html)
- [nonebot.typing](typing.html)
- [nonebot.exception](exception.html)
- [nonebot.drivers](drivers/)
- [nonebot.drivers.fastapi](drivers/fastapi.html)
- [nonebot.drivers.quart](drivers/quart.html)
- [nonebot.drivers.aiohttp](drivers/aiohttp.html)
- [nonebot.adapters](adapters/)
- [nonebot.adapters.cqhttp](adapters/cqhttp.html)
- [nonebot.adapters.ding](adapters/ding.html)
- [nonebot.adapters.mirai](adapters/mirai.html)
- [nonebot.adapters.feishu](adapters/feishu.html)

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.adapters 模块
## 协议适配基类

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.adapters.ding 模块
## 钉钉群机器人 协议适配

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.adapters.feishu 模块
# NoneBot.adapters.feishu.config 模块

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.adapters.mirai 模块
## Mirai-API-HTTP 协议适配

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.config 模块
## 配置

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.handler 模块
## 依赖注入处理模块

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.drivers 模块
## 后端驱动适配基类
@ -524,6 +519,11 @@ URL
HTTP headers
### `reconnect`
WebSocket 是否重连
### `reconnect_interval`
WebSocket 重连间隔

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.drivers.aiohttp 模块
## AIOHTTP 驱动适配

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.drivers.fastapi 模块
## FastAPI 驱动适配

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.drivers.quart 模块
## Quart 驱动适配

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.exception 模块
## 异常

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.handler 模块
## 事件处理函数

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.log 模块
## 日志

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.matcher 模块
## 事件响应器

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.message 模块
## 事件处理

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot 模块
## 快捷导入

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.permission 模块
## 权限

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.plugin 模块
## 插件

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.rule 模块
## 规则

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.typing 模块
## 类型

View File

@ -1,8 +1,3 @@
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.utils 模块

View File

@ -0,0 +1,4 @@
{
"label": "编写插件",
"position": 2
}

View File

@ -1,3 +1,12 @@
---
sidebar_position: 4
options:
menu:
weight: 140
catogory: guide
---
# 事件处理
在上一章中,我们已经注册了事件响应器,现在我们可以正式编写事件处理逻辑了!

View File

@ -1,3 +1,12 @@
---
sidebar_position: 3
options:
menu:
weight: 130
catogory: guide
---
# 注册事件响应器
好了,现在插件已经创建完毕,我们可以开始编写实际代码了,下面将以一个简易单文件天气查询插件为例。
@ -41,7 +50,7 @@ async def get_weather(city: str):
从这里开始,你需要对 Python 的 asyncio 编程有所了解,因为 NoneBot 是完全基于 asyncio 的,具体可以参考 [廖雪峰的 Python 教程](https://www.liaoxuefeng.com/wiki/1016959663602400/1017959540289152)
:::
## [事件响应器](../api/matcher.md)
## [事件响应器](../../api/matcher.md)
```python{5}
from nonebot import on_command
@ -72,11 +81,11 @@ weather = on_command("天气", rule=to_me(), permission=Permission(), priority=5
- `on_message()` ~ `on("message")`: 消息事件响应器
- `on_request()` ~ `on("request")`: 请求事件响应器
- `on_notice()` ~ `on("notice")`: 通知事件响应器
- `on_startswith(str)` ~ `on("message", startswith(str))`: 消息开头匹配响应器,参考 [startswith](../api/rule.md#startswith-msg)
- `on_endswith(str)` ~ `on("message", endswith(str))`: 消息结尾匹配响应器,参考 [endswith](../api/rule.md#endswith-msg)
- `on_keyword(set)` ~ `on("message", keyword(str))`: 消息关键词匹配响应器,参考 [keyword](../api/rule.md#keyword-keywords)
- `on_command(str|tuple)` ~ `on("message", command(str|tuple))`: 命令响应器,参考 [command](../api/rule.md#command-cmds)
- `on_regex(pattern_str)` ~ `on("message", regex(pattern_str))`: 正则匹配处理器,参考 [regex](../api/rule.md#regex-regex-flags-0)
- `on_startswith(str)` ~ `on("message", startswith(str))`: 消息开头匹配响应器,参考 [startswith](../../api/rule.md#startswith-msg)
- `on_endswith(str)` ~ `on("message", endswith(str))`: 消息结尾匹配响应器,参考 [endswith](../../api/rule.md#endswith-msg)
- `on_keyword(set)` ~ `on("message", keyword(str))`: 消息关键词匹配响应器,参考 [keyword](../../api/rule.md#keyword-keywords)
- `on_command(str|tuple)` ~ `on("message", command(str|tuple))`: 命令响应器,参考 [command](../../api/rule.md#command-cmds)
- `on_regex(pattern_str)` ~ `on("message", regex(pattern_str))`: 正则匹配处理器,参考 [regex](../../api/rule.md#regex-regex-flags-0)
### 匹配规则 rule
@ -107,11 +116,11 @@ NoneBot 内置的事件响应器中,所有 `message` 类的事件响应器默
rule 的出现使得 nonebot 对事件的响应可以非常自由nonebot 内置了一些规则:
- [startswith(msg)](../api/rule.md#startswith-msg)
- [endswith(msg)](../api/rule.md#endswith-msg)
- [keyword(\*keywords)](../api/rule.md#keyword-keywords)
- [command(\*cmds)](../api/rule.md#command-cmds)
- [regex(regex, flag)](../api/rule.md#regex-regex-flags-0)
- [startswith(msg)](../../api/rule.md#startswith-msg)
- [endswith(msg)](../../api/rule.md#endswith-msg)
- [keyword(\*keywords)](../../api/rule.md#keyword-keywords)
- [command(\*cmds)](../../api/rule.md#command-cmds)
- [regex(regex, flag)](../../api/rule.md#regex-regex-flags-0)
以上规则都是返回类型为 `Rule` 的函数,`Rule` 由非负个 `RuleChecker` 组成,当所有 `RuleChecker` 返回 `True` 时匹配成功。这些 `Rule`, `RuleChecker` 的形式如下:

View File

@ -1,3 +1,12 @@
---
sidebar_position: 2
options:
menu:
weight: 120
catogory: guide
---
# 创建插件
如果之前使用 `nb-cli` 生成了项目结构,那我们已经有了一个空的插件目录 `Awesome-Bot/awesome_bot/plugins`,并且它已在 `bot.py` 中被加载,我们现在可以开始创建插件了!

View File

@ -1,3 +1,7 @@
---
sidebar_position: 5
---
# 结语
至此,相信你已经能够写出一个基础的插件了。这里给出几个小提示:

View File

@ -1,3 +1,12 @@
---
sidebar_position: 1
options:
menu:
weight: 110
catogory: guide
---
# 加载插件
在 [创建一个完整的项目](creating-a-project) 一章节中,我们已经创建了插件目录 `awesome_bot/plugins`,现在我们在机器人入口文件中加载它。当然,你也可以单独加载一个插件。
@ -33,7 +42,7 @@ if __name__ == "__main__":
- 命令 `say`:可由**superuser**使用,可以将消息内容由特殊纯文本转为富文本
- 命令 `echo`:可由任何人使用,将消息原样返回
以上命令均需要指定机器人,即私聊、群聊内@机器人、群聊内称呼机器人昵称。参考 [Rule: to_me](../api/rule.md#to-me)
以上命令均需要指定机器人,即私聊、群聊内@机器人、群聊内称呼机器人昵称。参考 [Rule: to_me](../../api/rule.md#to-me)
## 加载插件目录
@ -62,7 +71,7 @@ if __name__ == "__main__":
:::
:::danger 警告
插件间不应该存在过多的耦合,如果确实需要导入某个插件内的数据,可以参考 [进阶-跨插件访问](../advanced/export-and-require.md)
插件间不应该存在过多的耦合,如果确实需要导入某个插件内的数据,可以参考 [进阶-跨插件访问](../../advanced/export-and-require.md)
:::
## 加载单个插件

View File

@ -112,6 +112,6 @@ CQHTTP_WS_URLS={"机器人QQ号": "ws://127.0.0.1:6700/"}
到这里如果一切 OK你应该会收到机器人给你回复了 `你好,世界`。这一历史性的对话标志着你已经成功地运行了一个 NoneBot 的最小实例,开始了编写更强大的 QQ 机器人的创意之旅!
<ClientOnly>
<!-- <ClientOnly>
<Messenger :messages="[{ position: 'right', msg: '/echo 你好,世界' }, { position: 'left', msg: '你好,世界' }]"/>
</ClientOnly>
</ClientOnly> -->

View File

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -1,3 +1,14 @@
---
sidebar_position: 1
id: guide
slug: /guide
options:
menu:
weight: 10
catogory: guide
---
# 概览
<!-- :::tip 提示

View File

@ -0,0 +1,4 @@
{
"label": "开始",
"position": 1
}

View File

@ -1,3 +1,12 @@
---
sidebar_position: 5
options:
menu:
weight: 50
catogory: guide
---
# 基本配置
到目前为止我们还在使用 NoneBot 的默认行为,在开始编写自己的插件之前,我们先尝试在配置文件上动动手脚,让 NoneBot 表现出不同的行为。

View File

@ -1,3 +1,12 @@
---
sidebar_position: 4
options:
menu:
weight: 40
catogory: guide
---
# 创建一个完整的项目
上一章中我们已经运行了一个简单的 NoneBot 实例,在这一章,我们将从零开始一个完整的项目。

View File

@ -1,3 +1,12 @@
---
sidebar_position: 3
options:
menu:
weight: 30
catogory: guide
---
# 开始使用
一切都安装成功后,你就已经做好了进行简单配置以运行一个最小的 NoneBot 实例的准备工作。

View File

@ -1,3 +1,12 @@
---
sidebar_position: 2
options:
menu:
weight: 20
catogory: guide
---
# 安装
## 安装 NoneBot

View File

@ -0,0 +1,147 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "NoneBot",
tagline: "跨平台 Python 异步机器人框架",
url: "https://v2.nonebot.dev",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "icons/favicon.ico",
organizationName: "nonebot", // Usually your GitHub org/user name.
projectName: "nonebot2", // Usually your repo name.
presets: [
[
"docusaurus-preset-nonepress",
/** @type {import('docusaurus-preset-nonepress').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
editUrl: "https://github.com/nonebot/nonebot2/edit/master/website/",
showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
}),
],
],
themeConfig:
/** @type {import('docusaurus-theme-nonepress/types').ThemeConfig} */
({
colorMode: {
defaultMode: "light",
},
logo: {
alt: "",
src: "logo.png",
href: "/",
target: "_self",
},
navbar: {
hideOnScroll: true,
items: [
{
label: "指南",
type: "docsMenu",
category: "guide",
},
{
label: "进阶",
type: "docsMenu",
category: "advanced",
},
{
label: "API",
type: "docLink",
docId: "api/index",
},
{ label: "商店", to: "/store" },
{ label: "更新日志", to: "/changelog" },
{
icon: ["fab", "github"],
href: "https://github.com/nonebot/nonebot2",
},
],
},
hideableSidebar: true,
footer: {
copyright: `Copyright © ${new Date().getFullYear()} NoneBot. All rights reserved.`,
iconLinks: [
{
icon: ["fab", "github"],
href: "https://github.com/nonebot/nonebot2",
description: "GitHub",
},
{
icon: ["fab", "qq"],
href: "https://jq.qq.com/?_wv=1027&k=5OFifDh",
},
{
icon: ["fab", "telegram"],
href: "https://t.me/botuniverse",
},
{
icon: ["fab", "discord"],
href: "https://discord.gg/VKtE6Gdc4h",
},
],
links: [
{
title: "Learn",
icon: ["fas", "book"],
items: [
{ label: "Introduction", to: "/docs/guide" },
{ label: "Installation", to: "/docs/guide/installation" },
],
},
{
title: "NoneBot Team",
icon: ["fas", "user-friends"],
items: [
{
label: "Homepage",
href: "https://nonebot.dev",
},
{
label: "NoneBot V1",
href: "https://docs.nonebot.dev",
},
{ label: "NoneBot V2", to: "/" },
],
},
{
title: "Related",
icon: ["fas", "external-link-alt"],
items: [
{ label: "OneBot", href: "https://onebot.dev/" },
{ label: "go-cqhttp", href: "https://docs.go-cqhttp.org/" },
{ label: "Mirai", href: "https://mirai.mamoe.net/" },
],
},
],
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
algolia: {
apiKey: "ef449608d0ad6e81b9efd05db6367040",
indexName: "nonebot",
contextualSearch: true,
searchParameters: {
facetFilters: ["lang:zh-CN"],
},
},
tailwindConfig: require("./tailwind.config"),
customCss: [require.resolve("./src/css/custom.css")],
}),
};
module.exports = config;

53
website/package.json Normal file
View File

@ -0,0 +1,53 @@
{
"name": "nonebot",
"version": "2.0.0",
"description": "跨平台 Python 异步机器人框架",
"private": true,
"homepage": "https://v2.nonebot.dev/",
"repository": "https://github.com/nonebot/nonebot2/",
"bugs": {
"url": "https://github.com/nonebot/nonebot2/issues"
},
"license": "MIT",
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.9",
"@mdx-js/react": "^1.6.21",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.1.1",
"docusaurus-preset-nonepress": "canary",
"file-loader": "^6.2.0",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"url-loader": "^4.1.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.9",
"@tsconfig/docusaurus": "^1.0.4",
"typescript": "^4.3.5"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

33
website/sidebars.js Normal file
View File

@ -0,0 +1,33 @@
/**
* Creating a sidebar enables you to:
- create an ordered group of docs
- render a sidebar for each doc of that group
- provide next/previous navigation
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/
// @ts-check
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
guide: [{ type: "autogenerated", dirName: "guide" }],
advanced: [{ type: "autogenerated", dirName: "advanced" }],
api: [{ type: "autogenerated", dirName: "api" }],
// But you can create a sidebar manually
/*
tutorialSidebar: [
{
type: 'category',
label: 'Tutorial',
items: ['hello'],
},
],
*/
};
module.exports = sidebars;

View File

View File

@ -1,7 +1,3 @@
---
sidebar: auto
---
# 更新日志
## v2.0.0b1

View File

@ -0,0 +1,3 @@
.homeCodeBlock {
width: 602px;
}

View File

@ -0,0 +1,30 @@
import Hero, { HeroFeatureSingle } from "@theme/Hero";
import CodeBlock from "@theme/CodeBlock";
import Layout from "@theme/Layout";
import React from "react";
import clsx from "clsx";
import styles from "./index.module.css";
export default function Home() {
const feature = {
title: "Develop",
tagline: "fast to code",
description: "仅需两步,即可开始编写你的机器人",
};
return (
<Layout>
<Hero />
<HeroFeatureSingle {...feature}>
<CodeBlock
title="Installation"
className={clsx("inline-block", styles.homeCodeBlock)}
metastring="bash"
>
{"pip install nb-cli\nnb create"}
</CodeBlock>
</HeroFeatureSingle>
</Layout>
);
}

View File

@ -0,0 +1 @@
# 商店

View File

@ -58,5 +58,17 @@
"desc": "综合了各种娱乐功能的Bot",
"author": "FYWinds",
"repo": "https://github.com/FYWinds/takker"
},
{
"name": "剑网三bot",
"desc": "网络游戏《剑网三》的群聊机器人数据使用www.jx3api.com",
"author": "JustUndertaker",
"repo": "https://github.com/JustUndertaker/jx3_bot"
},
{
"name": "PixivBot",
"desc": "顾名思义是Pixiv的bot随机推荐插画、随机指定关键词插画、随机书签、查看排行榜、查看指定id插画",
"author": "ssttkkl",
"repo": "https://github.com/ssttkkl/PixivBot"
}
]

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Some files were not shown because too many files have changed in this diff Show More