🎨 format files

This commit is contained in:
StarHeartHunt 2021-04-05 13:44:19 +08:00
parent 20e1bf9624
commit 1c6711355e
10 changed files with 174 additions and 174 deletions

View File

@ -82,8 +82,8 @@
color="blue darken-1" color="blue darken-1"
text text
@click=" @click="
dialog = false; dialog = false
publishAdapter(); publishAdapter()
" "
> >
发布 发布
@ -93,13 +93,14 @@
</v-dialog> </v-dialog>
</v-col> </v-col>
</v-row> </v-row>
<v-col cols="12"> <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-col> ></v-pagination
></v-col>
<v-row> <v-row>
<v-col <v-col
cols="12" cols="12"
@ -116,30 +117,30 @@
></PublishCard> ></PublishCard>
</v-col> </v-col>
</v-row> </v-row>
<v-col cols="12"> <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-card> </v-card>
</template> </template>
<script> <script>
import PublishCard from "./PublishCard.vue"; import PublishCard from './PublishCard.vue'
import adapters from "../public/adapters.json"; import adapters from '../public/adapters.json'
export default { export default {
name: "Adapters", name: 'Adapters',
components: { components: {
PublishCard PublishCard,
}, },
data() { data() {
return { return {
adapters: adapters, adapters: adapters,
filterText: "", filterText: '',
page: 1, page: 1,
dialog: false, dialog: false,
valid: false, valid: false,
@ -148,34 +149,34 @@ export default {
desc: null, desc: null,
id: null, id: null,
link: null, link: null,
repo: null repo: null,
} },
}; }
}, },
computed: { computed: {
pageNum() { pageNum() {
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 ||
adapter.desc.indexOf(this.filterText || "") != -1 || adapter.desc.indexOf(this.filterText || '') != -1 ||
adapter.author.indexOf(this.filterText || "") != -1 adapter.author.indexOf(this.filterText || '') != -1
); )
}); })
}, },
displayAdapters() { displayAdapters() {
return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10); return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10)
}, },
publishPlugin() { publishPlugin() {
if (!this.$refs.newAdapterForm.validate()) { if (!this.$refs.newAdapterForm.validate()) {
return; return
} }
const title = encodeURIComponent( const title = encodeURIComponent(
`Adapter: ${this.newAdapter.name}` `Adapter: ${this.newAdapter.name}`
).replace(/%2B/gi, "+"); ).replace(/%2B/gi, '+')
const body = encodeURIComponent( const body = encodeURIComponent(
` `
**协议名称** **协议名称**
@ -207,11 +208,11 @@ ${this.newAdapter.repo}
- repo: ${this.newAdapter.repo} - repo: ${this.newAdapter.repo}
--> -->
`.trim() `.trim()
).replace(/%2B/gi, "+"); ).replace(/%2B/gi, '+')
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

@ -68,8 +68,8 @@
color="blue darken-1" color="blue darken-1"
text text
@click=" @click="
dialog = false; dialog = false
publishBot(); publishBot()
" "
> >
发布 发布
@ -79,14 +79,14 @@
</v-dialog> </v-dialog>
</v-col> </v-col>
</v-row> </v-row>
<v-col cols="12"> <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>
<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
@ -97,64 +97,64 @@
></PublishCard> ></PublishCard>
</v-col> </v-col>
</v-row> </v-row>
<v-col cols="12"> <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-card> </v-card>
</template> </template>
<script> <script>
import PublishCard from "./PublishCard.vue"; import PublishCard from './PublishCard.vue'
import bots from "../public/bots.json"; import bots from '../public/bots.json'
export default { export default {
name: "Bots", name: 'Bots',
components: { components: {
PublishCard PublishCard,
}, },
data() { data() {
return { return {
bots: bots, bots: bots,
filterText: "", filterText: '',
page: 1, page: 1,
dialog: false, dialog: false,
valid: false, valid: false,
newBot: { newBot: {
name: null, name: null,
desc: null, desc: null,
repo: null repo: null,
} },
}; }
}, },
computed: { computed: {
pageNum() { pageNum() {
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 ||
bot.author.indexOf(this.filterText || "") != -1 bot.author.indexOf(this.filterText || '') != -1
); )
}); })
}, },
displayBots() { displayBots() {
return this.filteredBots.slice((this.page - 1) * 10, this.page * 10); return this.filteredBots.slice((this.page - 1) * 10, this.page * 10)
}, },
publishBot() { publishBot() {
if (!this.$refs.newBotForm.validate()) { if (!this.$refs.newBotForm.validate()) {
return; return
} }
const title = encodeURIComponent(`Bot: ${this.newBot.name}`).replace( const title = encodeURIComponent(`Bot: ${this.newBot.name}`).replace(
/%2B/gi, /%2B/gi,
"+" '+'
); )
const body = encodeURIComponent( const body = encodeURIComponent(
` `
**机器人名称** **机器人名称**
@ -176,11 +176,11 @@ ${this.newBot.repo}
- repo: ${this.newBot.repo} - repo: ${this.newBot.repo}
--> -->
`.trim() `.trim()
).replace(/%2B/gi, "+"); ).replace(/%2B/gi, '+')
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

@ -128,32 +128,32 @@
</template> </template>
<script> <script>
import { WOW } from "wowjs"; import { WOW } from 'wowjs'
import "animate.css/animate.min.css"; import 'animate.css/animate.min.css'
export default { export default {
name: "Messenger", name: 'Messenger',
props: { props: {
messages: { messages: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
methods: { methods: {
initWOW: function() { initWOW: function () {
new WOW({ new WOW({
noxClass: "wow", noxClass: 'wow',
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>
<style scoped> <style scoped>
@ -183,7 +183,7 @@ export default {
background-color: #fff; background-color: #fff;
} }
.message .message-box::after { .message .message-box::after {
content: ""; content: '';
position: absolute; position: absolute;
right: 100%; right: 100%;
top: 0; top: 0;

View File

@ -82,8 +82,8 @@
color="blue darken-1" color="blue darken-1"
text text
@click=" @click="
dialog = false; dialog = false
publishPlugin(); publishPlugin()
" "
> >
发布 发布
@ -93,14 +93,14 @@
</v-dialog> </v-dialog>
</v-col> </v-col>
</v-row> </v-row>
<v-col cols="12"> <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>
<v-col <v-col
cols="12" cols="12"
@ -119,30 +119,30 @@
></PublishCard> ></PublishCard>
</v-col> </v-col>
</v-row> </v-row>
<v-col cols="12"> <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-card> </v-card>
</template> </template>
<script> <script>
import PublishCard from "./PublishCard.vue"; import PublishCard from './PublishCard.vue'
import plugins from "../public/plugins.json"; import plugins from '../public/plugins.json'
export default { export default {
name: "Plugins", name: 'Plugins',
components: { components: {
PublishCard PublishCard,
}, },
data() { data() {
return { return {
plugins: plugins, plugins: plugins,
filterText: "", filterText: '',
page: 1, page: 1,
dialog: false, dialog: false,
valid: false, valid: false,
@ -151,34 +151,34 @@ export default {
desc: null, desc: null,
id: null, id: null,
link: null, link: null,
repo: null repo: null,
} },
}; }
}, },
computed: { computed: {
pageNum() { pageNum() {
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 ||
plugin.desc.indexOf(this.filterText || "") != -1 || plugin.desc.indexOf(this.filterText || '') != -1 ||
plugin.author.indexOf(this.filterText || "") != -1 plugin.author.indexOf(this.filterText || '') != -1
); )
}); })
}, },
displayPlugins() { displayPlugins() {
return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10); return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10)
}, },
publishPlugin() { publishPlugin() {
if (!this.$refs.newPluginForm.validate()) { if (!this.$refs.newPluginForm.validate()) {
return; return
} }
const title = encodeURIComponent( const title = encodeURIComponent(
`Plugin: ${this.newPlugin.name}` `Plugin: ${this.newPlugin.name}`
).replace(/%2B/gi, "+"); ).replace(/%2B/gi, '+')
const body = encodeURIComponent( const body = encodeURIComponent(
` `
**插件名称** **插件名称**
@ -210,11 +210,11 @@ ${this.newPlugin.repo}
- repo: ${this.newPlugin.repo} - repo: ${this.newPlugin.repo}
--> -->
`.trim() `.trim()
).replace(/%2B/gi, "+"); ).replace(/%2B/gi, '+')
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

@ -34,7 +34,7 @@
</template> </template>
<script> <script>
import copy from "copy-to-clipboard"; import copy from 'copy-to-clipboard'
export default { export default {
props: { props: {
@ -44,33 +44,33 @@ 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) {
if (repo) { if (repo) {
return /^https?:/.test(repo) ? repo : `https://github.com/${repo}`; return /^https?:/.test(repo) ? repo : `https://github.com/${repo}`
} }
return null; return null
}, },
copyCommand() { copyCommand() {
copy(this.command, { copy(this.command, {
format: "text/plain" format: 'text/plain',
}); })
this.snackbar = true; this.snackbar = true
} },
} },
}; }
</script> </script>
<style scoped> <style scoped>

View File

@ -28,30 +28,30 @@
</template> </template>
<script> <script>
import Adapter from "./Adapter.vue"; import Adapter from './Adapter.vue'
import Plugin from "./Plugin.vue"; import Plugin from './Plugin.vue'
import Bot from "./Bot.vue"; import Bot from './Bot.vue'
export default { export default {
name: "Store", name: 'Store',
components: { components: {
Adapter, Adapter,
Plugin, Plugin,
Bot Bot,
}, },
data() { data() {
return { return {
tab: 1, tab: 1,
tabs: { tabs: {
0: "协议", 0: '协议',
1: "插件", 1: '插件',
2: "机器人" 2: '机器人',
} },
}; }
}, },
computed: {}, computed: {},
methods: {} methods: {},
}; }
</script> </script>
<style> <style>

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

@ -37,8 +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 参数即可。