🔀 Merge pull request #314

Doc: update store style
This commit is contained in:
Ju4tCode
2021-04-05 03:49:06 -05:00
committed by GitHub
14 changed files with 109 additions and 85 deletions

9
.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf",
"arrowParens": "always",
"singleQuote": false,
"trailingComma": "es5",
"semi": true
}

View File

@ -1,7 +1,7 @@
<template> <template>
<v-card flat class="adapters"> <v-card flat class="adapters">
<v-row> <v-row class="justify-center">
<v-col cols="12" sm="4"> <v-col cols="12" sm="6">
<v-text-field <v-text-field
v-model="filterText" v-model="filterText"
dense dense
@ -9,7 +9,7 @@
outlined outlined
clearable clearable
hide-details hide-details
label="Filter Adapter" label="搜索适配器"
> >
<template v-slot:prepend-inner> <template v-slot:prepend-inner>
<div class="v-input__icon v-input__icon--prepend-inner"> <div class="v-input__icon v-input__icon--prepend-inner">
@ -18,16 +18,16 @@
</template> </template>
</v-text-field> </v-text-field>
</v-col> </v-col>
<v-col cols="12" sm="4"> <v-col cols="12" sm="6">
<v-dialog v-model="dialog" max-width="600px"> <v-dialog v-model="dialog" max-width="600px">
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn dark block color="primary" v-bind="attrs" v-on="on" <v-btn dark block color="primary" v-bind="attrs" v-on="on"
>Publish Your Adapter >发布适配器
</v-btn> </v-btn>
</template> </template>
<v-card> <v-card>
<v-card-title> <v-card-title>
<span class="headline">Adapter Information</span> <span class="headline">适配器信息</span>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-form ref="newAdapterForm" v-model="valid" lazy-validation> <v-form ref="newAdapterForm" v-model="valid" lazy-validation>
@ -75,7 +75,7 @@
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="dialog = false"> <v-btn color="blue darken-1" text @click="dialog = false">
Close 关闭
</v-btn> </v-btn>
<v-btn <v-btn
:disabled="!valid" :disabled="!valid"
@ -86,22 +86,23 @@
publishAdapter(); publishAdapter();
" "
> >
Publish 发布
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
</v-col> </v-col>
<v-col cols="12" sm="4"> </v-row>
<v-row>
<v-col cols="12">
<v-pagination <v-pagination
v-model="page" v-model="page"
:length="pageNum" :length="pageNum"
prev-icon="fa-caret-left" prev-icon="fa-caret-left"
next-icon="fa-caret-right" next-icon="fa-caret-right"
></v-pagination> ></v-pagination
</v-col> ></v-col>
</v-row> </v-row>
<hr />
<v-row> <v-row>
<v-col <v-col
cols="12" cols="12"
@ -138,7 +139,7 @@ import adapters from "../public/adapters.json";
export default { export default {
name: "Adapters", name: "Adapters",
components: { components: {
PublishCard PublishCard,
}, },
data() { data() {
return { return {
@ -152,8 +153,8 @@ export default {
desc: null, desc: null,
id: null, id: null,
link: null, link: null,
repo: null repo: null,
} },
}; };
}, },
computed: { computed: {
@ -161,7 +162,7 @@ export default {
return Math.ceil(this.filteredAdapters.length / 10); return Math.ceil(this.filteredAdapters.length / 10);
}, },
filteredAdapters() { filteredAdapters() {
return this.adapters.filter(adapter => { return this.adapters.filter((adapter) => {
return ( return (
adapter.id.indexOf(this.filterText || "") != -1 || adapter.id.indexOf(this.filterText || "") != -1 ||
adapter.name.indexOf(this.filterText || "") != -1 || adapter.name.indexOf(this.filterText || "") != -1 ||
@ -215,7 +216,7 @@ ${this.newAdapter.repo}
window.open( window.open(
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Adapter` `https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Adapter`
); );
} },
} },
}; };
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<v-card flat class="bots"> <v-card flat class="bots">
<v-row> <v-row>
<v-col cols="12" sm="4"> <v-col cols="12" sm="6">
<v-text-field <v-text-field
v-model="filterText" v-model="filterText"
dense dense
@ -9,7 +9,7 @@
outlined outlined
clearable clearable
hide-details hide-details
label="Filter Bot" label="搜索机器人"
> >
<template v-slot:prepend-inner> <template v-slot:prepend-inner>
<div class="v-input__icon v-input__icon--prepend-inner"> <div class="v-input__icon v-input__icon--prepend-inner">
@ -18,16 +18,16 @@
</template> </template>
</v-text-field> </v-text-field>
</v-col> </v-col>
<v-col cols="12" sm="4"> <v-col cols="12" sm="6">
<v-dialog v-model="dialog" max-width="600px"> <v-dialog v-model="dialog" max-width="600px">
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn dark block color="primary" v-bind="attrs" v-on="on" <v-btn dark block color="primary" v-bind="attrs" v-on="on"
>Publish Your Bot >发布机器人
</v-btn> </v-btn>
</template> </template>
<v-card> <v-card>
<v-card-title> <v-card-title>
<span class="headline">Bot Information</span> <span class="headline">机器人信息</span>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-form ref="newBotForm" v-model="valid" lazy-validation> <v-form ref="newBotForm" v-model="valid" lazy-validation>
@ -61,7 +61,7 @@
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="dialog = false"> <v-btn color="blue darken-1" text @click="dialog = false">
Close 关闭
</v-btn> </v-btn>
<v-btn <v-btn
:disabled="!valid" :disabled="!valid"
@ -72,13 +72,15 @@
publishBot(); publishBot();
" "
> >
Publish 发布
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
</v-col> </v-col>
<v-col cols="12" sm="4"> </v-row>
<v-row>
<v-col cols="12">
<v-pagination <v-pagination
v-model="page" v-model="page"
:length="pageNum" :length="pageNum"
@ -87,7 +89,6 @@
></v-pagination> ></v-pagination>
</v-col> </v-col>
</v-row> </v-row>
<hr />
<v-row> <v-row>
<v-col cols="12" sm="6" v-for="(bot, index) in displayBots" :key="index"> <v-col cols="12" sm="6" v-for="(bot, index) in displayBots" :key="index">
<PublishCard <PublishCard
@ -118,7 +119,7 @@ import bots from "../public/bots.json";
export default { export default {
name: "Bots", name: "Bots",
components: { components: {
PublishCard PublishCard,
}, },
data() { data() {
return { return {
@ -130,8 +131,8 @@ export default {
newBot: { newBot: {
name: null, name: null,
desc: null, desc: null,
repo: null repo: null,
} },
}; };
}, },
computed: { computed: {
@ -139,7 +140,7 @@ export default {
return Math.ceil(this.filteredBots.length / 10); return Math.ceil(this.filteredBots.length / 10);
}, },
filteredBots() { filteredBots() {
return this.bots.filter(bot => { return this.bots.filter((bot) => {
return ( return (
bot.name.indexOf(this.filterText || "") != -1 || bot.name.indexOf(this.filterText || "") != -1 ||
bot.desc.indexOf(this.filterText || "") != -1 || bot.desc.indexOf(this.filterText || "") != -1 ||
@ -183,7 +184,7 @@ ${this.newBot.repo}
window.open( window.open(
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Bot` `https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Bot`
); );
} },
} },
}; };
</script> </script>

View File

@ -136,8 +136,8 @@ export default {
props: { props: {
messages: { messages: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
methods: { methods: {
initWOW: function() { initWOW: function() {
@ -146,13 +146,13 @@ export default {
animateClass: "animate__animated", animateClass: "animate__animated",
offset: 0, offset: 0,
mobile: true, mobile: true,
live: true live: true,
}).init(); }).init();
} },
}, },
mounted() { mounted() {
this.initWOW(); this.initWOW();
} },
}; };
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<v-card flat class="plugins"> <v-card flat class="plugins">
<v-row> <v-row>
<v-col cols="12" sm="4"> <v-col cols="12" sm="6">
<v-text-field <v-text-field
v-model="filterText" v-model="filterText"
dense dense
@ -9,7 +9,7 @@
outlined outlined
clearable clearable
hide-details hide-details
label="Filter Plugin" label="搜索插件"
> >
<template v-slot:prepend-inner> <template v-slot:prepend-inner>
<div class="v-input__icon v-input__icon--prepend-inner"> <div class="v-input__icon v-input__icon--prepend-inner">
@ -18,16 +18,16 @@
</template> </template>
</v-text-field> </v-text-field>
</v-col> </v-col>
<v-col cols="12" sm="4"> <v-col cols="12" sm="6">
<v-dialog v-model="dialog" max-width="600px"> <v-dialog v-model="dialog" max-width="600px">
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn dark block color="primary" v-bind="attrs" v-on="on" <v-btn dark block color="primary" v-bind="attrs" v-on="on"
>Publish Your Plugin >发布插件
</v-btn> </v-btn>
</template> </template>
<v-card> <v-card>
<v-card-title> <v-card-title>
<span class="headline">Plugin Information</span> <span class="headline">插件信息</span>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-form ref="newPluginForm" v-model="valid" lazy-validation> <v-form ref="newPluginForm" v-model="valid" lazy-validation>
@ -75,7 +75,7 @@
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="dialog = false"> <v-btn color="blue darken-1" text @click="dialog = false">
Close 关闭
</v-btn> </v-btn>
<v-btn <v-btn
:disabled="!valid" :disabled="!valid"
@ -86,13 +86,15 @@
publishPlugin(); publishPlugin();
" "
> >
Publish 发布
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
</v-col> </v-col>
<v-col cols="12" sm="4"> </v-row>
<v-row>
<v-col cols="12">
<v-pagination <v-pagination
v-model="page" v-model="page"
:length="pageNum" :length="pageNum"
@ -101,7 +103,6 @@
></v-pagination> ></v-pagination>
</v-col> </v-col>
</v-row> </v-row>
<hr />
<v-row> <v-row>
<v-col <v-col
cols="12" cols="12"
@ -115,7 +116,7 @@
:id="plugin.id" :id="plugin.id"
:author="plugin.author" :author="plugin.author"
:link="plugin.repo" :link="plugin.repo"
text="copy nb install command" text="点此复制安装命令"
:command="`nb plugin install ${plugin.id}`" :command="`nb plugin install ${plugin.id}`"
></PublishCard> ></PublishCard>
</v-col> </v-col>
@ -140,7 +141,7 @@ import plugins from "../public/plugins.json";
export default { export default {
name: "Plugins", name: "Plugins",
components: { components: {
PublishCard PublishCard,
}, },
data() { data() {
return { return {
@ -154,8 +155,8 @@ export default {
desc: null, desc: null,
id: null, id: null,
link: null, link: null,
repo: null repo: null,
} },
}; };
}, },
computed: { computed: {
@ -163,7 +164,7 @@ export default {
return Math.ceil(this.filteredPlugins.length / 10); return Math.ceil(this.filteredPlugins.length / 10);
}, },
filteredPlugins() { filteredPlugins() {
return this.plugins.filter(plugin => { return this.plugins.filter((plugin) => {
return ( return (
plugin.id.indexOf(this.filterText || "") != -1 || plugin.id.indexOf(this.filterText || "") != -1 ||
plugin.name.indexOf(this.filterText || "") != -1 || plugin.name.indexOf(this.filterText || "") != -1 ||
@ -217,7 +218,7 @@ ${this.newPlugin.repo}
window.open( window.open(
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Plugin` `https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Plugin`
); );
} },
} },
}; };
</script> </script>

View File

@ -28,7 +28,7 @@
{{ text }} {{ text }}
<v-icon right small>fa-copy</v-icon> <v-icon right small>fa-copy</v-icon>
</v-btn> </v-btn>
<v-snackbar v-model="snackbar">Copied!</v-snackbar> <v-snackbar v-model="snackbar">复制成功</v-snackbar>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</template> </template>
@ -44,17 +44,17 @@ export default {
author: String, author: String,
link: String, link: String,
text: String, text: String,
command: String command: String,
}, },
data() { data() {
return { return {
snackbar: false snackbar: false,
}; };
}, },
computed: { computed: {
showCommand() { showCommand() {
return this.text && this.command; return this.text && this.command;
} },
}, },
methods: { methods: {
repoLink(repo) { repoLink(repo) {
@ -65,11 +65,11 @@ export default {
}, },
copyCommand() { copyCommand() {
copy(this.command, { copy(this.command, {
format: "text/plain" format: "text/plain",
}); });
this.snackbar = true; this.snackbar = true;
} },
} },
}; };
</script> </script>

View File

@ -10,7 +10,7 @@
}}</v-tab> }}</v-tab>
</v-tabs> </v-tabs>
</v-toolbar> </v-toolbar>
<v-tabs-items class="sub-item" v-model="tab"> <v-tabs-items class="sub-item pt-1" v-model="tab">
<v-tab-item> <v-tab-item>
<Adapter></Adapter> <Adapter></Adapter>
</v-tab-item> </v-tab-item>
@ -37,7 +37,7 @@ export default {
components: { components: {
Adapter, Adapter,
Plugin, Plugin,
Bot Bot,
}, },
data() { data() {
return { return {
@ -45,12 +45,12 @@ export default {
tabs: { tabs: {
0: "协议", 0: "协议",
1: "插件", 1: "插件",
2: "机器人" 2: "机器人",
} },
}; };
}, },
computed: {}, computed: {},
methods: {} methods: {},
}; };
</script> </script>

View File

@ -1,2 +1 @@
# 权限控制 # 权限控制

View File

@ -8,7 +8,7 @@
`APScheduler` 作为 `nonebot` v1 的可选依赖,为众多 bot 提供了方便的定时任务功能。`nonebot2` 已将 `APScheduler` 独立为 `nonebot_plugin_apscheduler` 插件,你可以在 [插件广场](https://v2.nonebot.dev/plugin-store.html) 中找到它。 `APScheduler` 作为 `nonebot` v1 的可选依赖,为众多 bot 提供了方便的定时任务功能。`nonebot2` 已将 `APScheduler` 独立为 `nonebot_plugin_apscheduler` 插件,你可以在 [插件广场](https://v2.nonebot.dev/plugin-store.html) 中找到它。
相比于 `nonebot` v1`nonebot` v2只需要安装插件并修改 `scheduler` 的导入方式即可完成迁移。 相比于 `nonebot` v1`nonebot` v2 只需要安装插件并修改 `scheduler` 的导入方式即可完成迁移。
## 安装插件 ## 安装插件

View File

@ -50,7 +50,7 @@ sidebarDepth: 0
* **说明**: 插件模块对象 * **说明**: 插件模块对象
### `export` ### _property_ `export`
* **类型**: `Export` * **类型**: `Export`
@ -282,7 +282,7 @@ sidebarDepth: 0
## `on_startswith(msg, rule=None, **kwargs)` ## `on_startswith(msg, rule=None, ignorecase=False, **kwargs)`
* **说明** * **说明**
@ -294,12 +294,15 @@ sidebarDepth: 0
* **参数** * **参数**
* `msg: str`: 指定消息开头内容 * `msg: Union[str, Tuple[str, ...]]`: 指定消息开头内容
* `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则 * `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则
* `ignorecase: bool`: 是否忽略大小写
* `permission: Optional[Permission]`: 事件响应权限 * `permission: Optional[Permission]`: 事件响应权限
@ -329,7 +332,7 @@ sidebarDepth: 0
## `on_endswith(msg, rule=None, **kwargs)` ## `on_endswith(msg, rule=None, ignorecase=False, **kwargs)`
* **说明** * **说明**
@ -341,12 +344,15 @@ sidebarDepth: 0
* **参数** * **参数**
* `msg: str`: 指定消息结尾内容 * `msg: Union[str, Tuple[str, ...]]`: 指定消息结尾内容
* `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则 * `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则
* `ignorecase: bool`: 是否忽略大小写
* `permission: Optional[Permission]`: 事件响应权限 * `permission: Optional[Permission]`: 事件响应权限
@ -663,7 +669,7 @@ sidebarDepth: 0
* `cmd: Union[str, Tuple[str, ...]]`: 命令前缀 * `cmd: Union[str, Tuple[str, ...]]`: 命令前缀
* `**kwargs`: 其他传递给 `on_command` 的参数,将会覆盖命令组默认值 * `**kwargs`: 其他传递给 `on_shell_command` 的参数,将会覆盖命令组默认值
@ -940,7 +946,10 @@ sidebarDepth: 0
* **参数** * **参数**
* `msg: str`: 指定消息开头内容 * `msg: Union[str, Tuple[str, ...]]`: 指定消息开头内容
* `ignorecase: bool`: 是否忽略大小写
* `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则 * `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则
@ -987,7 +996,10 @@ sidebarDepth: 0
* **参数** * **参数**
* `msg: str`: 指定消息结尾内容 * `msg: Union[str, Tuple[str, ...]]`: 指定消息结尾内容
* `ignorecase: bool`: 是否忽略大小写
* `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则 * `rule: Optional[Union[Rule, T_RuleChecker]]`: 事件响应规则

View File

@ -91,7 +91,7 @@ Rule(async_function, run_sync(sync_function))
## `startswith(msg)` ## `startswith(msg, ignorecase=False)`
* **说明** * **说明**
@ -107,7 +107,7 @@ Rule(async_function, run_sync(sync_function))
## `endswith(msg)` ## `endswith(msg, ignorecase=False)`
* **说明** * **说明**

View File

@ -37,7 +37,8 @@ AweSome-Bot
:::warning 提示 :::warning 提示
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。 如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
* 在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期 - 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
::: :::
通过 `nb-cli` 通过 `nb-cli`

View File

@ -103,15 +103,15 @@ async def raw_handler(bot: DingBot, event: MessageEvent):
![机器人所在群的 Webhook 地址](./images/ding/webhook.png) ![机器人所在群的 Webhook 地址](./images/ding/webhook.png)
获取到Webhook地址后用户可以向这个地址发起HTTP POST 请求,即可实现给该钉钉群发送消息。 获取到 Webhook 地址后,用户可以向这个地址发起 HTTP POST 请求,即可实现给该钉钉群发送消息。
对于这种通过 Webhook 推送的消息,钉钉需要开发者进行安全方面的设置(目前有3种安全设置方式,请根据需要选择一种),如下: 对于这种通过 Webhook 推送的消息,钉钉需要开发者进行安全方面的设置(目前有 3 种安全设置方式,请根据需要选择一种),如下:
1. **自定义关键词:** 最多可以设置10个关键词消息中至少包含其中1个关键词才可以发送成功。 1. **自定义关键词:** 最多可以设置 10 个关键词,消息中至少包含其中 1 个关键词才可以发送成功。
例如添加了一个自定义关键词:监控报警,则这个机器人所发送的消息,必须包含监控报警这个词,才能发送成功。 例如添加了一个自定义关键词:监控报警,则这个机器人所发送的消息,必须包含监控报警这个词,才能发送成功。
2. **加签:** 发送请求时带上验签的值,可以在机器人设置里看到密钥。 2. **加签:** 发送请求时带上验签的值,可以在机器人设置里看到密钥。
![加签密钥](./images/ding/jiaqian.png) ![加签密钥](./images/ding/jiaqian.png)
3. **IP地址** 设定后只有来自IP地址范围内的请求才会被正常处理。支持两种设置方式IP地址和IP地址段暂不支持IPv6地址白名单。 3. **IP 地址(段):** 设定后,只有来自 IP 地址范围内的请求才会被正常处理。支持两种设置方式IP 地址和 IP 地址段,暂不支持 IPv6 地址白名单。
如果你选择 1/3 两种安全设置,你需要自己确认当前网络和发送的消息能被钉钉接受,然后使用 `bot.send` 的时候将 webhook 地址传入 webhook 参数即可。 如果你选择 1/3 两种安全设置,你需要自己确认当前网络和发送的消息能被钉钉接受,然后使用 `bot.send` 的时候将 webhook 地址传入 webhook 参数即可。

View File

@ -17,8 +17,8 @@
"scripts": { "scripts": {
"dev": "vuepress dev docs", "dev": "vuepress dev docs",
"build": "vuepress build docs", "build": "vuepress build docs",
"lint": "npx prettier -c docs/**/* !docs/api/**/*", "lint": "npx prettier --config .prettierrc -c docs/**/* !docs/api/**/*",
"lint:fix": "npx prettier --write docs/**/* !docs/api/**/*" "lint:fix": "npx prettier --config .prettierrc --write docs/**/* !docs/api/**/*"
}, },
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {