mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 11:26:43 +08:00
调整文档缩进方式,添加bison-use-pic-merge配置项警告
This commit is contained in:
parent
88d7a7b9de
commit
897e8f3f2c
11
docs/.vuepress/.temp/internal/clientAppEnhances.js
Normal file
11
docs/.vuepress/.temp/internal/clientAppEnhances.js
Normal file
@ -0,0 +1,11 @@
|
||||
import clientAppEnhance0 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/plugin-external-link-icon/lib/client/clientAppEnhance.js'
|
||||
import clientAppEnhance1 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/plugin-medium-zoom/lib/client/clientAppEnhance.js'
|
||||
import clientAppEnhance2 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/plugin-theme-data/lib/client/clientAppEnhance.js'
|
||||
import clientAppEnhance3 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/theme-default/lib/client/clientAppEnhance.js'
|
||||
|
||||
export const clientAppEnhances = [
|
||||
clientAppEnhance0,
|
||||
clientAppEnhance1,
|
||||
clientAppEnhance2,
|
||||
clientAppEnhance3,
|
||||
]
|
5
docs/.vuepress/.temp/internal/clientAppRootComponents.js
Normal file
5
docs/.vuepress/.temp/internal/clientAppRootComponents.js
Normal file
@ -0,0 +1,5 @@
|
||||
import clientAppRootComponent0 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/plugin-back-to-top/lib/client/components/BackToTop.js'
|
||||
|
||||
export const clientAppRootComponents = [
|
||||
clientAppRootComponent0,
|
||||
]
|
9
docs/.vuepress/.temp/internal/clientAppSetups.js
Normal file
9
docs/.vuepress/.temp/internal/clientAppSetups.js
Normal file
@ -0,0 +1,9 @@
|
||||
import clientAppSetup0 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/plugin-active-header-links/lib/client/clientAppSetup.js'
|
||||
import clientAppSetup1 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/plugin-nprogress/lib/client/clientAppSetup.js'
|
||||
import clientAppSetup2 from 'E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/theme-default/lib/client/clientAppSetup.js'
|
||||
|
||||
export const clientAppSetups = [
|
||||
clientAppSetup0,
|
||||
clientAppSetup1,
|
||||
clientAppSetup2,
|
||||
]
|
6
docs/.vuepress/.temp/internal/layoutComponents.js
Normal file
6
docs/.vuepress/.temp/internal/layoutComponents.js
Normal file
@ -0,0 +1,6 @@
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
export const layoutComponents = {
|
||||
"404": defineAsyncComponent(() => import("E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/theme-default/lib/client/layouts/404.vue")),
|
||||
"Layout": defineAsyncComponent(() => import("E:/Azide/nonebot/nonebot-bison/node_modules/@vuepress/theme-default/lib/client/layouts/Layout.vue")),
|
||||
}
|
12
docs/.vuepress/.temp/internal/pagesComponents.js
Normal file
12
docs/.vuepress/.temp/internal/pagesComponents.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
export const pagesComponents = {
|
||||
// path: /
|
||||
"v-8daa1a0e": defineAsyncComponent(() => import(/* webpackChunkName: "v-8daa1a0e" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/index.html.vue")),
|
||||
// path: /dev/
|
||||
"v-7445cd33": defineAsyncComponent(() => import(/* webpackChunkName: "v-7445cd33" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/dev/index.html.vue")),
|
||||
// path: /usage/
|
||||
"v-d0736a32": defineAsyncComponent(() => import(/* webpackChunkName: "v-d0736a32" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/usage/index.html.vue")),
|
||||
// path: /404.html
|
||||
"v-3706649a": defineAsyncComponent(() => import(/* webpackChunkName: "v-3706649a" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/404.html.vue")),
|
||||
}
|
10
docs/.vuepress/.temp/internal/pagesData.js
Normal file
10
docs/.vuepress/.temp/internal/pagesData.js
Normal file
@ -0,0 +1,10 @@
|
||||
export const pagesData = {
|
||||
// path: /
|
||||
"v-8daa1a0e": () => import(/* webpackChunkName: "v-8daa1a0e" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/index.html.js").then(({ data }) => data),
|
||||
// path: /dev/
|
||||
"v-7445cd33": () => import(/* webpackChunkName: "v-7445cd33" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/dev/index.html.js").then(({ data }) => data),
|
||||
// path: /usage/
|
||||
"v-d0736a32": () => import(/* webpackChunkName: "v-d0736a32" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/usage/index.html.js").then(({ data }) => data),
|
||||
// path: /404.html
|
||||
"v-3706649a": () => import(/* webpackChunkName: "v-3706649a" */"E:/Azide/nonebot/nonebot-bison/docs/.vuepress/.temp/pages/404.html.js").then(({ data }) => data),
|
||||
}
|
33
docs/.vuepress/.temp/internal/pagesRoutes.js
Normal file
33
docs/.vuepress/.temp/internal/pagesRoutes.js
Normal file
@ -0,0 +1,33 @@
|
||||
import { Vuepress } from '@vuepress/client/lib/components/Vuepress'
|
||||
|
||||
const routeItems = [
|
||||
["v-8daa1a0e","/",{"title":""},["/index.html","/README.md"]],
|
||||
["v-7445cd33","/dev/",{"title":"开发指南"},["/dev/index.html","/dev/README.md"]],
|
||||
["v-d0736a32","/usage/",{"title":"部署和使用"},["/usage/index.html","/usage/README.md"]],
|
||||
["v-3706649a","/404.html",{"title":""},["/404"]],
|
||||
]
|
||||
|
||||
export const pagesRoutes = routeItems.reduce(
|
||||
(result, [name, path, meta, redirects]) => {
|
||||
result.push(
|
||||
{
|
||||
name,
|
||||
path,
|
||||
component: Vuepress,
|
||||
meta,
|
||||
},
|
||||
...redirects.map((item) => ({
|
||||
path: item,
|
||||
redirect: path,
|
||||
}))
|
||||
)
|
||||
return result
|
||||
},
|
||||
[
|
||||
{
|
||||
name: "404",
|
||||
path: "/:catchAll(.*)",
|
||||
component: Vuepress,
|
||||
}
|
||||
]
|
||||
)
|
21
docs/.vuepress/.temp/internal/siteData.js
Normal file
21
docs/.vuepress/.temp/internal/siteData.js
Normal file
@ -0,0 +1,21 @@
|
||||
export const siteData = {
|
||||
"base": "/",
|
||||
"lang": "en-US",
|
||||
"title": "Nonebot Bison",
|
||||
"description": "Docs for Nonebot Bison",
|
||||
"head": [],
|
||||
"locales": {}
|
||||
}
|
||||
|
||||
if (import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept()
|
||||
if (__VUE_HMR_RUNTIME__.updateSiteData) {
|
||||
__VUE_HMR_RUNTIME__.updateSiteData(siteData)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(({ siteData }) => {
|
||||
__VUE_HMR_RUNTIME__.updateSiteData(siteData)
|
||||
})
|
||||
}
|
62
docs/.vuepress/.temp/internal/themeData.js
Normal file
62
docs/.vuepress/.temp/internal/themeData.js
Normal file
@ -0,0 +1,62 @@
|
||||
export const themeData = {
|
||||
"nav": [
|
||||
{
|
||||
"text": "主页",
|
||||
"link": "/"
|
||||
},
|
||||
{
|
||||
"text": "部署与使用",
|
||||
"link": "/usage/"
|
||||
},
|
||||
{
|
||||
"text": "开发",
|
||||
"link": "/dev/"
|
||||
},
|
||||
{
|
||||
"text": "Github",
|
||||
"link": "https://github.com/felinae98/nonebot-bison"
|
||||
}
|
||||
],
|
||||
"locales": {
|
||||
"/": {
|
||||
"selectLanguageName": "English"
|
||||
}
|
||||
},
|
||||
"navbar": [],
|
||||
"logo": null,
|
||||
"darkMode": true,
|
||||
"repo": null,
|
||||
"selectLanguageText": "Languages",
|
||||
"selectLanguageAriaLabel": "Select language",
|
||||
"sidebar": "auto",
|
||||
"sidebarDepth": 2,
|
||||
"editLink": true,
|
||||
"editLinkText": "Edit this page",
|
||||
"lastUpdated": true,
|
||||
"lastUpdatedText": "Last Updated",
|
||||
"contributors": true,
|
||||
"contributorsText": "Contributors",
|
||||
"notFound": [
|
||||
"There's nothing here.",
|
||||
"How did we get here?",
|
||||
"That's a Four-Oh-Four.",
|
||||
"Looks like we've got some broken links."
|
||||
],
|
||||
"backToHome": "Take me home",
|
||||
"openInNewWindow": "open in new window",
|
||||
"toggleDarkMode": "toggle dark mode",
|
||||
"toggleSidebar": "toggle sidebar"
|
||||
}
|
||||
|
||||
if (import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept()
|
||||
if (__VUE_HMR_RUNTIME__.updateThemeData) {
|
||||
__VUE_HMR_RUNTIME__.updateThemeData(themeData)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(({ themeData }) => {
|
||||
__VUE_HMR_RUNTIME__.updateThemeData(themeData)
|
||||
})
|
||||
}
|
26
docs/.vuepress/.temp/pages/404.html.js
Normal file
26
docs/.vuepress/.temp/pages/404.html.js
Normal file
@ -0,0 +1,26 @@
|
||||
export const data = {
|
||||
"key": "v-3706649a",
|
||||
"path": "/404.html",
|
||||
"title": "",
|
||||
"lang": "en-US",
|
||||
"frontmatter": {
|
||||
"layout": "404"
|
||||
},
|
||||
"excerpt": "",
|
||||
"headers": [],
|
||||
"git": {},
|
||||
"filePathRelative": null
|
||||
}
|
||||
|
||||
if (import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept()
|
||||
if (__VUE_HMR_RUNTIME__.updatePageData) {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(({ data }) => {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
})
|
||||
}
|
1
docs/.vuepress/.temp/pages/404.html.vue
Normal file
1
docs/.vuepress/.temp/pages/404.html.vue
Normal file
@ -0,0 +1 @@
|
||||
<template></template>
|
65
docs/.vuepress/.temp/pages/dev/index.html.js
Normal file
65
docs/.vuepress/.temp/pages/dev/index.html.js
Normal file
@ -0,0 +1,65 @@
|
||||
export const data = {
|
||||
"key": "v-7445cd33",
|
||||
"path": "/dev/",
|
||||
"title": "开发指南",
|
||||
"lang": "en-US",
|
||||
"frontmatter": {
|
||||
"sidebar": "auto"
|
||||
},
|
||||
"excerpt": "",
|
||||
"headers": [
|
||||
{
|
||||
"level": 2,
|
||||
"title": "基本概念",
|
||||
"slug": "基本概念",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"title": "快速上手",
|
||||
"slug": "快速上手",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"title": "类的方法与成员变量",
|
||||
"slug": "类的方法与成员变量",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"title": "方法与变量的定义",
|
||||
"slug": "方法与变量的定义",
|
||||
"children": []
|
||||
}
|
||||
],
|
||||
"git": {
|
||||
"updatedTime": 1645018969000,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "felinae98",
|
||||
"email": "731499577@qq.com",
|
||||
"commits": 4
|
||||
},
|
||||
{
|
||||
"name": "hemengyang",
|
||||
"email": "hmy0119@gmail.com",
|
||||
"commits": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"filePathRelative": "dev/README.md"
|
||||
}
|
||||
|
||||
if (import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept()
|
||||
if (__VUE_HMR_RUNTIME__.updatePageData) {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(({ data }) => {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
})
|
||||
}
|
78
docs/.vuepress/.temp/pages/dev/index.html.vue
Normal file
78
docs/.vuepress/.temp/pages/dev/index.html.vue
Normal file
@ -0,0 +1,78 @@
|
||||
<template><h1 id="开发指南" tabindex="-1"><a class="header-anchor" href="#开发指南" aria-hidden="true">#</a> 开发指南</h1>
|
||||
<p>本插件需要你的帮助!只需要会写简单的爬虫,就能给本插件适配新的网站。</p>
|
||||
<h2 id="基本概念" tabindex="-1"><a class="header-anchor" href="#基本概念" aria-hidden="true">#</a> 基本概念</h2>
|
||||
<ul>
|
||||
<li><code>nonebot_bison.post.Post</code>: 可以理解为推送内容,其中包含需要发送的文字,图片,链接,平台信息等</li>
|
||||
<li><code>nonebot_bison.types.RawPost</code>: 从站点/平台中爬到的单条信息</li>
|
||||
<li><code>nonebot_bison.types.Target</code>: 目标账号,Bilibili,微博等社交媒体中的账号</li>
|
||||
<li><code>nonebot_bison.types.Category</code>: 信息分类,例如视频,动态,图文,文章等</li>
|
||||
<li><code>nonebot_bison.types.Tag</code>: 信息标签,例如微博中的超话或者 hashtag</li>
|
||||
</ul>
|
||||
<h2 id="快速上手" tabindex="-1"><a class="header-anchor" href="#快速上手" aria-hidden="true">#</a> 快速上手</h2>
|
||||
<p>上车!我们走</p>
|
||||
<p>先明确需要适配的站点类型,先明确两个问题:</p>
|
||||
<h4 id="我要发送什么样的推送" tabindex="-1"><a class="header-anchor" href="#我要发送什么样的推送" aria-hidden="true">#</a> 我要发送什么样的推送</h4>
|
||||
<ul>
|
||||
<li><code>nonebot_bison.platform.platform.NewMessage</code> 最常见的类型,每次爬虫向特定接口爬取一个消息列表,
|
||||
与之前爬取的信息对比,过滤出新的消息,再根据用户自定义的分类和标签进行过滤,最后处理消息,把
|
||||
处理过后的消息发送给用户<br>
|
||||
例如:微博,Bilibili</li>
|
||||
<li><code>nonebot_bison.platform.platform.StatusChange</code> 每次爬虫获取一个状态,在状态改变时发布推送<br>
|
||||
例如:游戏开服提醒,主播上播提醒</li>
|
||||
<li><code>nonebot_bison.platform.platform.SimplePost</code> 与<code>NewMessage</code>相似,但是不过滤新的消息
|
||||
,每次发送全部消息<br>
|
||||
例如:每日榜单定时发送</li>
|
||||
</ul>
|
||||
<h4 id="这个平台是否有账号的概念" tabindex="-1"><a class="header-anchor" href="#这个平台是否有账号的概念" aria-hidden="true">#</a> 这个平台是否有账号的概念</h4>
|
||||
<ul>
|
||||
<li>有账号的概念<br>
|
||||
例如:B 站用户动态,微博用户动态,网易云电台更新</li>
|
||||
<li>没有账号的概念<br>
|
||||
例如:游戏公告,教务处公告</li>
|
||||
</ul>
|
||||
<p>现在你需要在<code>src/plugins/nonebot_bison/platform</code>下新建一个 py 文件,
|
||||
在里面新建一个类,继承推送类型的基类,重载一些关键的函数,然后……就完成了,不需要修改别的东西了。</p>
|
||||
<p>任何一种订阅类型需要实现的方法/字段如下:</p>
|
||||
<ul>
|
||||
<li><code>schedule_type</code>, <code>schedule_kw</code> 调度的参数,本质是使用 apscheduler 的<a href="https://apscheduler.readthedocs.io/en/3.x/userguide.html?highlight=trigger#choosing-the-right-scheduler-job-store-s-executor-s-and-trigger-s" target="_blank" rel="noopener noreferrer">trigger 参数<ExternalLinkIcon/></a>,<code>schedule_type</code>可以是<code>date</code>,<code>interval</code>和<code>cron</code>,
|
||||
<code>schedule_kw</code>是对应的参数,一个常见的配置是<code>schedule_type=interval</code>, <code>schedule_kw={'seconds':30}</code></li>
|
||||
<li><code>is_common</code> 是否常用,如果被标记为常用,那么和机器人交互式对话添加订阅时,会直接出现在选择列表中,否则
|
||||
需要输入<code>全部</code>才会出现。</li>
|
||||
<li><code>enabled</code> 是否启用</li>
|
||||
<li><code>name</code> 平台的正式名称,例如<code>微博</code></li>
|
||||
<li><code>has_target</code> 平台是否有“帐号”</li>
|
||||
<li><code>category</code> 平台的发布内容分类,例如 B 站包括专栏,视频,图文动态,普通动态等,如果不包含分类功能则设为<code>{}</code></li>
|
||||
<li><code>enable_tag</code> 平台发布内容是否带 Tag,例如微博</li>
|
||||
<li><code>platform_name</code> 唯一的,英文的识别标识,比如<code>weibo</code></li>
|
||||
<li><code>async get_target_name(Target) -> Optional[str]</code> 通常用于获取帐号的名称,如果平台没有帐号概念,可以直接返回平台的<code>name</code></li>
|
||||
<li><code>async parse(RawPost) -> Post</code>将获取到的 RawPost 处理成 Post</li>
|
||||
<li><code>get_tags(RawPost) -> Optional[Collection[Tag]]</code> (可选) 从 RawPost 中提取 Tag</li>
|
||||
<li><code>get_category(RawPos) -> Optional[Category]</code> (可选)从 RawPost 中提取 Category</li>
|
||||
</ul>
|
||||
<p>例如要适配微博,我希望 bot 搬运新的消息,所以微博的类应该这样定义:</p>
|
||||
<div class="language-python ext-py line-numbers-mode"><pre v-pre class="language-python"><code><span class="token keyword">class</span> <span class="token class-name">Weibo</span><span class="token punctuation">(</span>NewMessage<span class="token punctuation">)</span><span class="token punctuation">:</span>
|
||||
|
||||
categories <span class="token operator">=</span> <span class="token punctuation">{</span>
|
||||
<span class="token number">1</span><span class="token punctuation">:</span> <span class="token string">"转发"</span><span class="token punctuation">,</span>
|
||||
<span class="token number">2</span><span class="token punctuation">:</span> <span class="token string">"视频"</span><span class="token punctuation">,</span>
|
||||
<span class="token number">3</span><span class="token punctuation">:</span> <span class="token string">"图文"</span><span class="token punctuation">,</span>
|
||||
<span class="token number">4</span><span class="token punctuation">:</span> <span class="token string">"文字"</span><span class="token punctuation">,</span>
|
||||
<span class="token punctuation">}</span>
|
||||
enable_tag <span class="token operator">=</span> <span class="token boolean">True</span>
|
||||
platform_name <span class="token operator">=</span> <span class="token string">"weibo"</span>
|
||||
name <span class="token operator">=</span> <span class="token string">"新浪微博"</span>
|
||||
enabled <span class="token operator">=</span> <span class="token boolean">True</span>
|
||||
is_common <span class="token operator">=</span> <span class="token boolean">True</span>
|
||||
schedule_type <span class="token operator">=</span> <span class="token string">"interval"</span>
|
||||
schedule_kw <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token string">"seconds"</span><span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">}</span>
|
||||
has_target <span class="token operator">=</span> <span class="token boolean">True</span>
|
||||
</code></pre><div class="line-numbers" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br></div></div><p>当然我们非常希望你对自己适配的平台写一些单元测试,你可以模仿<code>tests/platforms/test_*.py</code>中的内容写
|
||||
一些单元测试。为保证多次运行测试的一致性,可以 mock http 的响应,测试的内容包括获取 RawPost,处理成 Post
|
||||
,测试分类以及提取 tag 等,当然最好和 rsshub 做一个交叉验证。</p>
|
||||
<div class="custom-container danger"><p class="custom-container-title">DANGER</p>
|
||||
<p>Nonebot 项目使用了全异步的处理方式,所以你需要对异步,Python asyncio 的机制有一定了解,当然,
|
||||
依葫芦画瓢也是足够的</p>
|
||||
</div>
|
||||
<h2 id="类的方法与成员变量" tabindex="-1"><a class="header-anchor" href="#类的方法与成员变量" aria-hidden="true">#</a> 类的方法与成员变量</h2>
|
||||
<h2 id="方法与变量的定义" tabindex="-1"><a class="header-anchor" href="#方法与变量的定义" aria-hidden="true">#</a> 方法与变量的定义</h2>
|
||||
</template>
|
59
docs/.vuepress/.temp/pages/index.html.js
Normal file
59
docs/.vuepress/.temp/pages/index.html.js
Normal file
@ -0,0 +1,59 @@
|
||||
export const data = {
|
||||
"key": "v-8daa1a0e",
|
||||
"path": "/",
|
||||
"title": "",
|
||||
"lang": "en-US",
|
||||
"frontmatter": {
|
||||
"home": true,
|
||||
"heroText": "Nonebot Bison",
|
||||
"tagline": "本bot励志做全泰拉骑车最快的信使",
|
||||
"actionText": "快速部署",
|
||||
"actionLink": "/usage/",
|
||||
"features": [
|
||||
{
|
||||
"title": "拓展性强",
|
||||
"details": "没有自己想要的网站?只要简单的爬虫知识就可以给它适配一个新的网站"
|
||||
},
|
||||
{
|
||||
"title": "通用,强大",
|
||||
"details": "社交媒体?网站更新?游戏开服?只要能爬就都能推,还支持自定义过滤"
|
||||
},
|
||||
{
|
||||
"title": "后台管理",
|
||||
"details": "提供后台管理页面,简单快捷修改配置"
|
||||
}
|
||||
],
|
||||
"footer": "MIT Licensed"
|
||||
},
|
||||
"excerpt": "",
|
||||
"headers": [],
|
||||
"git": {
|
||||
"updatedTime": 1644411914000,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "felinae98",
|
||||
"email": "731499577@qq.com",
|
||||
"commits": 7
|
||||
},
|
||||
{
|
||||
"name": "hemengyang",
|
||||
"email": "hmy0119@gmail.com",
|
||||
"commits": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"filePathRelative": "README.md"
|
||||
}
|
||||
|
||||
if (import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept()
|
||||
if (__VUE_HMR_RUNTIME__.updatePageData) {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(({ data }) => {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
})
|
||||
}
|
1
docs/.vuepress/.temp/pages/index.html.vue
Normal file
1
docs/.vuepress/.temp/pages/index.html.vue
Normal file
@ -0,0 +1 @@
|
||||
<template></template>
|
101
docs/.vuepress/.temp/pages/usage/index.html.js
Normal file
101
docs/.vuepress/.temp/pages/usage/index.html.js
Normal file
@ -0,0 +1,101 @@
|
||||
export const data = {
|
||||
"key": "v-d0736a32",
|
||||
"path": "/usage/",
|
||||
"title": "部署和使用",
|
||||
"lang": "en-US",
|
||||
"frontmatter": {
|
||||
"sidebar": "auto"
|
||||
},
|
||||
"excerpt": "",
|
||||
"headers": [
|
||||
{
|
||||
"level": 2,
|
||||
"title": "部署",
|
||||
"slug": "部署",
|
||||
"children": [
|
||||
{
|
||||
"level": 3,
|
||||
"title": "作为 Bot 使用",
|
||||
"slug": "作为-bot-使用",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"level": 3,
|
||||
"title": "作为插件使用",
|
||||
"slug": "作为插件使用",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"level": 3,
|
||||
"title": "自动安装",
|
||||
"slug": "自动安装",
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"title": "配置",
|
||||
"slug": "配置",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"title": "使用",
|
||||
"slug": "使用",
|
||||
"children": [
|
||||
{
|
||||
"level": 3,
|
||||
"title": "命令",
|
||||
"slug": "命令",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"level": 3,
|
||||
"title": "所支持平台的 uid",
|
||||
"slug": "所支持平台的-uid",
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"git": {
|
||||
"updatedTime": 1646927246000,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "felinae98",
|
||||
"email": "731499577@qq.com",
|
||||
"commits": 10
|
||||
},
|
||||
{
|
||||
"name": "Azide",
|
||||
"email": "rukuy@qq.com",
|
||||
"commits": 1
|
||||
},
|
||||
{
|
||||
"name": "hemengyang",
|
||||
"email": "hmy0119@gmail.com",
|
||||
"commits": 1
|
||||
},
|
||||
{
|
||||
"name": "pre-commit-ci[bot]",
|
||||
"email": "66853113+pre-commit-ci[bot]@users.noreply.github.com",
|
||||
"commits": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"filePathRelative": "usage/README.md"
|
||||
}
|
||||
|
||||
if (import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept()
|
||||
if (__VUE_HMR_RUNTIME__.updatePageData) {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(({ data }) => {
|
||||
__VUE_HMR_RUNTIME__.updatePageData(data)
|
||||
})
|
||||
}
|
162
docs/.vuepress/.temp/pages/usage/index.html.vue
Normal file
162
docs/.vuepress/.temp/pages/usage/index.html.vue
Normal file
@ -0,0 +1,162 @@
|
||||
<template><h1 id="部署和使用" tabindex="-1"><a class="header-anchor" href="#部署和使用" aria-hidden="true">#</a> 部署和使用</h1>
|
||||
<p>本节将教你快速部署和使用一个 nonebot-bison,如果你不知道要选择哪种部署方式,推荐使用<a href="#docker-compose%E9%83%A8%E7%BD%B2-%E6%8E%A8%E8%8D%90">docker-compose</a></p>
|
||||
<h2 id="部署" tabindex="-1"><a class="header-anchor" href="#部署" aria-hidden="true">#</a> 部署</h2>
|
||||
<p>本项目可以作为单独的 Bot 使用,可以作为 nonebot2 的插件使用</p>
|
||||
<h3 id="作为-bot-使用" tabindex="-1"><a class="header-anchor" href="#作为-bot-使用" aria-hidden="true">#</a> 作为 Bot 使用</h3>
|
||||
<p>额外提供自动同意超级用户的好友申请和同意超级用户的加群邀请的功能</p>
|
||||
<h4 id="docker-compose-部署-推荐" tabindex="-1"><a class="header-anchor" href="#docker-compose-部署-推荐" aria-hidden="true">#</a> docker-compose 部署(推荐)</h4>
|
||||
<ol>
|
||||
<li>
|
||||
<p>在一个新的目录中下载<a href="https://raw.githubusercontent.com/felinae98/nonebot-bison/main/docker-compose.yml" target="_blank" rel="noopener noreferrer">docker-compose.yml<ExternalLinkIcon/></a><br>
|
||||
将其中的<code><your QQ></code>改成自己的 QQ 号</p>
|
||||
<div class="language-bash ext-sh line-numbers-mode"><pre v-pre class="language-bash"><code><span class="token function">wget</span> https://raw.githubusercontent.com/felinae98/nonebot-bison/main/docker-compose.yml
|
||||
</code></pre><div class="line-numbers" aria-hidden="true"><span class="line-number">1</span><br></div></div></li>
|
||||
<li>
|
||||
<p>运行配置 go-cqhttp</p>
|
||||
<div class="language-bash ext-sh line-numbers-mode"><pre v-pre class="language-bash"><code><span class="token function">docker-compose</span> run go-cqhttp
|
||||
</code></pre><div class="line-numbers" aria-hidden="true"><span class="line-number">1</span><br></div></div><p>通信方式选择:<code>3: 反向 Websocket 通信</code><br>
|
||||
编辑<code>bot-data/config.yml</code>,更改下面字段:</p>
|
||||
<div class="language-text ext-text line-numbers-mode"><pre v-pre class="language-text"><code>account: # 账号相关
|
||||
uin: <QQ号> # QQ账号
|
||||
password: "<QQ密码>" # 密码为空时使用扫码登录
|
||||
|
||||
message:
|
||||
post-format: array
|
||||
|
||||
............
|
||||
|
||||
servers:
|
||||
- ws-reverse:
|
||||
universal: ws://nonebot:8080/onebot/v11/ws/ # 将这个字段写为这个值
|
||||
</code></pre><div class="line-numbers" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div></li>
|
||||
<li>
|
||||
<p>登录 go-cqhttp
|
||||
再次</p>
|
||||
<div class="language-bash ext-sh line-numbers-mode"><pre v-pre class="language-bash"><code><span class="token function">docker-compose</span> run go-cqhttp
|
||||
</code></pre><div class="line-numbers" aria-hidden="true"><span class="line-number">1</span><br></div></div><p>参考<a href="https://docs.go-cqhttp.org/faq/slider.html#%E6%96%B9%E6%A1%88a-%E8%87%AA%E8%A1%8C%E6%8A%93%E5%8C%85" target="_blank" rel="noopener noreferrer">go-cqhttp 文档<ExternalLinkIcon/></a>
|
||||
完成登录</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>确定完成登录后,启动 bot:</p>
|
||||
<div class="language-bash ext-sh line-numbers-mode"><pre v-pre class="language-bash"><code><span class="token function">docker-compose</span> up -d
|
||||
</code></pre><div class="line-numbers" aria-hidden="true"><span class="line-number">1</span><br></div></div></li>
|
||||
</ol>
|
||||
<h4 id="docker-部署" tabindex="-1"><a class="header-anchor" href="#docker-部署" aria-hidden="true">#</a> docker 部署</h4>
|
||||
<p>本项目的 docker 镜像为<code>felinae98/nonebot-bison</code>,可以直接 pull 后 run 进行使用,
|
||||
相关配置参数可以使用<code>-e</code>作为环境变量传入</p>
|
||||
<h4 id="直接运行-不推荐" tabindex="-1"><a class="header-anchor" href="#直接运行-不推荐" aria-hidden="true">#</a> 直接运行(不推荐)</h4>
|
||||
<p>可以参考<a href="https://v2.nonebot.dev/guide/getting-started.html" target="_blank" rel="noopener noreferrer">nonebot 的运行方法<ExternalLinkIcon/></a></p>
|
||||
<div class="custom-container danger"><p class="custom-container-title">DANGER</p>
|
||||
<p>直接克隆源代码需要自行编译前端,否则会出现无法使用管理后台等情况。</p>
|
||||
</div>
|
||||
<div class="custom-container danger"><p class="custom-container-title">DANGER</p>
|
||||
<p>本项目中使用了 Python 3.9 的语法,如果出现问题,请检查 Python 版本</p>
|
||||
</div>
|
||||
<ol>
|
||||
<li>首先安装 poetry:<a href="https://python-poetry.org/docs/#installation" target="_blank" rel="noopener noreferrer">安装方法<ExternalLinkIcon/></a></li>
|
||||
<li>clone 本项目,在项目中<code>poetry install</code>安装依赖</li>
|
||||
<li>安装 yarn,配置 yarn 源(推荐)</li>
|
||||
<li>在<code>admin-fronted</code>中运行<code>yarn && yarn build</code>编译前端</li>
|
||||
<li>编辑<code>.env.prod</code>配置各种环境变量,见<a href="https://v2.nonebot.dev/guide/basic-configuration.html" target="_blank" rel="noopener noreferrer">Nonebot2 配置<ExternalLinkIcon/></a></li>
|
||||
<li>运行<code>poetry run python bot.py</code>启动机器人</li>
|
||||
</ol>
|
||||
<h3 id="作为插件使用" tabindex="-1"><a class="header-anchor" href="#作为插件使用" aria-hidden="true">#</a> 作为插件使用</h3>
|
||||
<p>本部分假设大家会部署 nonebot2</p>
|
||||
<h4 id="手动安装" tabindex="-1"><a class="header-anchor" href="#手动安装" aria-hidden="true">#</a> 手动安装</h4>
|
||||
<ol>
|
||||
<li>安装 pip 包<code>nonebot-bison</code></li>
|
||||
<li>在<code>bot.py</code>中导入插件<code>nonebot_bison</code></li>
|
||||
</ol>
|
||||
<h3 id="自动安装" tabindex="-1"><a class="header-anchor" href="#自动安装" aria-hidden="true">#</a> 自动安装</h3>
|
||||
<p>使用<code>nb-cli</code>执行:<code>nb plugin install nonebot_bison</code></p>
|
||||
<h2 id="配置" tabindex="-1"><a class="header-anchor" href="#配置" aria-hidden="true">#</a> 配置</h2>
|
||||
<p>可参考<a href="https://github.com/felinae98/nonebot-bison/blob/main/src/plugins/nonebot_bison/plugin_config.py" target="_blank" rel="noopener noreferrer">源文件<ExternalLinkIcon/></a></p>
|
||||
<ul>
|
||||
<li><code>BISON_CONFIG_PATH</code>: 插件存放配置文件的位置,如果不设定默认为项目目录下的<code>data</code>目录</li>
|
||||
<li><code>BISON_USE_PIC</code>: 将文字渲染成图片后进行发送,多用于规避风控</li>
|
||||
<li><code>BISON_BROWSER</code>: 本插件使用 Chrome 来渲染图片
|
||||
<ul>
|
||||
<li>使用 browserless 提供的 Chrome 管理服务,设置为<code>ws://xxxxxxxx</code>,值为 Chrome Endpoint(推荐)</li>
|
||||
<li>使用 cdp 连接相关服务,设置为<code>wsc://xxxxxxxxx</code></li>
|
||||
<li>使用本地安装的 Chrome,设置为<code>local:<chrome path></code>,例如<code>local:/usr/bin/google-chrome-stable</code></li>
|
||||
<li>如果不进行配置,那么会在启动时候自动进行安装,在官方的 docker 镜像中已经安装了浏览器<div class="custom-container warning"><p class="custom-container-title">WARNING</p>
|
||||
<p>截止发布时,本项目尚不能完全与 browserless 兼容,目前建议使用镜像内自带的浏览器,即
|
||||
不要配置这个变量</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>BISON_SKIP_BROWSER_CHECK</code>: 是否在启动时自动下载浏览器,如果选择<code>False</code>会在用到浏览器时自动下载,
|
||||
默认<code>True</code></li>
|
||||
<li><code>BISON_OUTER_URL</code>: 从外部访问服务器的地址,默认为<code>http://localhost:8080/bison</code>,如果你的插件部署
|
||||
在服务器上,建议配置为<code>http://<你的服务器ip>:8080/bison</code></li>
|
||||
<li><code>BISON_FILTER_LOG</code>: 是否过滤来自<code>nonebot</code>的 warning 级以下的 log,如果你的 bot 只运行了这个插件可以考虑
|
||||
开启,默认关</li>
|
||||
<li><code>BISON_USE_QUEUE</code>: 是否用队列的方式发送消息,降低发送频率,默认开</li>
|
||||
<li><code>BISON_RESEND_TIMES</code>: 最大重发次数,默认 0</li>
|
||||
<li><code>BISON_USE_PIC_MERGE</code>: 是否启用多图片时合并转发(仅限群)
|
||||
<ul>
|
||||
<li><code>0</code>: 不启用(默认)</li>
|
||||
<li><code>1</code>: 首条消息单独发送,剩余图片合并转发</li>
|
||||
<li><code>2</code>: 所有消息全部合并转发<details class="custom-container details"><summary>配置项示例</summary>
|
||||
<ul>
|
||||
<li>当<code>BISON_USE_PIC_MERGE=1</code>时:
|
||||
<img src="@source/usage/pic/forward-msg-simple1.png" alt="simple1"></li>
|
||||
<li>当<code>BISON_USE_PIC_MERGE=2</code>时:
|
||||
<img src="@source/usage/pic/forward-msg-simple2.png" alt="simple1"></li>
|
||||
</ul>
|
||||
</details>
|
||||
<div class="custom-container warning"><p class="custom-container-title">WARNING</p>
|
||||
<p>启用此功能时,可能会因为待推送图片过大/过多而导致文字消息与合并转发图片消息推送间隔过大(选择模式<code>1</code>时),请谨慎考虑开启。或者选择模式<code>2</code>,使图文消息一同合并转发(可能会使消息推送延迟过长)</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 id="使用" tabindex="-1"><a class="header-anchor" href="#使用" aria-hidden="true">#</a> 使用</h2>
|
||||
<div class="custom-container warning"><p class="custom-container-title">WARNING</p>
|
||||
<p>本节假设<code>COMMAND_START</code>设置中包含<code>''</code>,如果出现 bot 不响应的问题,请先
|
||||
排查这个设置</p>
|
||||
</div>
|
||||
<h3 id="命令" tabindex="-1"><a class="header-anchor" href="#命令" aria-hidden="true">#</a> 命令</h3>
|
||||
<h4 id="在本群中进行配置" tabindex="-1"><a class="header-anchor" href="#在本群中进行配置" aria-hidden="true">#</a> 在本群中进行配置</h4>
|
||||
<p>所有命令都需要@bot 触发</p>
|
||||
<ul>
|
||||
<li>添加订阅(仅管理员和群主和 SUPERUSER):<code>添加订阅</code></li>
|
||||
<li>查询订阅:<code>查询订阅</code></li>
|
||||
<li>删除订阅(仅管理员和群主和 SUPERUSER):<code>删除订阅</code></li>
|
||||
</ul>
|
||||
<h4 id="私聊机器人获取后台地址" tabindex="-1"><a class="header-anchor" href="#私聊机器人获取后台地址" aria-hidden="true">#</a> 私聊机器人获取后台地址</h4>
|
||||
<p><code>后台管理</code>,之后点击返回的链接<br>
|
||||
如果你是 superuser,那么你可以管理所有群的订阅;如果你是 bot 所在的群的其中部分群的管理,
|
||||
你可以管理你管理的群里的订阅;如果你不是任意一个群的管理,那么 bot 将会报错。</p>
|
||||
<div class="custom-container tip"><p class="custom-container-title">TIP</p>
|
||||
<p>可以和 bot 通过临时聊天触发</p>
|
||||
</div>
|
||||
<div class="custom-container warning"><p class="custom-container-title">WARNING</p>
|
||||
<p>网页的身份鉴别机制全部由 bot 返回的链接确定,所以这个链接并不能透露给别人。
|
||||
并且链接会过期,所以一段时间后需要重新私聊 bot 获取新的链接。</p>
|
||||
</div>
|
||||
<h4 id="私聊机器人进行配置-需要-superuer-权限" tabindex="-1"><a class="header-anchor" href="#私聊机器人进行配置-需要-superuer-权限" aria-hidden="true">#</a> 私聊机器人进行配置(需要 SUPERUER 权限)</h4>
|
||||
<ul>
|
||||
<li>添加订阅:<code>管理-添加订阅</code></li>
|
||||
<li>查询订阅:<code>管理-查询订阅</code></li>
|
||||
<li>删除订阅:<code>管理-删除订阅</code></li>
|
||||
</ul>
|
||||
<h3 id="所支持平台的-uid" tabindex="-1"><a class="header-anchor" href="#所支持平台的-uid" aria-hidden="true">#</a> 所支持平台的 uid</h3>
|
||||
<h4 id="weibo" tabindex="-1"><a class="header-anchor" href="#weibo" aria-hidden="true">#</a> Weibo</h4>
|
||||
<ul>
|
||||
<li>对于一般用户主页<code>https://weibo.com/u/6441489862?xxxxxxxxxxxxxxx</code>,<code>/u/</code>后面的数字即为 uid</li>
|
||||
<li>对于有个性域名的用户如:<code>https://weibo.com/arknights</code>,需要点击左侧信息标签下“更多”,链接为<code>https://weibo.com/6279793937/about</code>,其中中间数字即为 uid</li>
|
||||
</ul>
|
||||
<h4 id="bilibili" tabindex="-1"><a class="header-anchor" href="#bilibili" aria-hidden="true">#</a> Bilibili</h4>
|
||||
<p>主页链接一般为<code>https://space.bilibili.com/161775300?xxxxxxxxxx</code>,数字即为 uid</p>
|
||||
<h4 id="rss" tabindex="-1"><a class="header-anchor" href="#rss" aria-hidden="true">#</a> RSS</h4>
|
||||
<p>RSS 链接即为 uid</p>
|
||||
<h4 id="网易云音乐-歌手" tabindex="-1"><a class="header-anchor" href="#网易云音乐-歌手" aria-hidden="true">#</a> 网易云音乐-歌手</h4>
|
||||
<p>在网易云网页上歌手的链接一般为<code>https://music.163.com/#/artist?id=32540734</code>,<code>id=</code>
|
||||
后面的数字即为 uid</p>
|
||||
<h4 id="网易云音乐-电台" tabindex="-1"><a class="header-anchor" href="#网易云音乐-电台" aria-hidden="true">#</a> 网易云音乐-电台</h4>
|
||||
<p>在网易云网页上电台的链接一般为<code>https://music.163.com/#/djradio?id=793745436</code>,<code>id=</code>
|
||||
后面的数字即为 uid</p>
|
||||
</template>
|
0
docs/.vuepress/.temp/styles/index.scss
Normal file
0
docs/.vuepress/.temp/styles/index.scss
Normal file
0
docs/.vuepress/.temp/styles/palette.scss
Normal file
0
docs/.vuepress/.temp/styles/palette.scss
Normal file
13
docs/.vuepress/.temp/vite-root/index.html
Normal file
13
docs/.vuepress/.temp/vite-root/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module">
|
||||
import '@vuepress/client/lib/app.js'
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -120,11 +120,14 @@ sidebar: auto
|
||||
- `1`: 首条消息单独发送,剩余图片合并转发
|
||||
- `2`: 所有消息全部合并转发
|
||||
::: details 配置项示例
|
||||
- 当`BISON_USE_PIC_MERGE=1`时:
|
||||
- 当`BISON_USE_PIC_MERGE=1`时:
|
||||

|
||||
- 当`BISON_USE_PIC_MERGE=2`时:
|
||||
- 当`BISON_USE_PIC_MERGE=2`时:
|
||||

|
||||
:::
|
||||
::: warning
|
||||
启用此功能时,可能会因为待推送图片过大/过多而导致文字消息与合并转发图片消息推送间隔过大(选择模式`1`时),请谨慎考虑开启。或者选择模式`2`,使图文消息一同合并转发(可能会使消息推送延迟过长)
|
||||
:::
|
||||
|
||||
## 使用
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user