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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
}}</v-tab>
</v-tabs>
</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>
<Adapter></Adapter>
</v-tab-item>
@ -37,7 +37,7 @@ export default {
components: {
Adapter,
Plugin,
Bot
Bot,
},
data() {
return {
@ -45,12 +45,12 @@ export default {
tabs: {
0: "协议",
1: "插件",
2: "机器人"
}
2: "机器人",
},
};
},
computed: {},
methods: {}
methods: {},
};
</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) 中找到它。
相比于 `nonebot` v1`nonebot` v2只需要安装插件并修改 `scheduler` 的导入方式即可完成迁移。
相比于 `nonebot` v1`nonebot` v2 只需要安装插件并修改 `scheduler` 的导入方式即可完成迁移。
## 安装插件

View File

@ -50,7 +50,7 @@ sidebarDepth: 0
* **说明**: 插件模块对象
### `export`
### _property_ `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]]`: 事件响应规则
* `ignorecase: bool`: 是否忽略大小写
* `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]]`: 事件响应规则
* `ignorecase: bool`: 是否忽略大小写
* `permission: Optional[Permission]`: 事件响应权限
@ -663,7 +669,7 @@ sidebarDepth: 0
* `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]]`: 事件响应规则
@ -987,7 +996,10 @@ sidebarDepth: 0
* **参数**
* `msg: str`: 指定消息结尾内容
* `msg: Union[str, Tuple[str, ...]]`: 指定消息结尾内容
* `ignorecase: bool`: 是否忽略大小写
* `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 提示
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
* 在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
- 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
:::
通过 `nb-cli`

View File

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

View File

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