mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-19 01:18:19 +08:00
🎨 format files
This commit is contained in:
parent
20e1bf9624
commit
1c6711355e
@ -82,8 +82,8 @@
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="
|
||||
dialog = false;
|
||||
publishAdapter();
|
||||
dialog = false
|
||||
publishAdapter()
|
||||
"
|
||||
>
|
||||
发布
|
||||
@ -93,13 +93,14 @@
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
</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-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-row>
|
||||
<v-col
|
||||
cols="12"
|
||||
@ -116,30 +117,30 @@
|
||||
></PublishCard>
|
||||
</v-col>
|
||||
</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-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-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PublishCard from "./PublishCard.vue";
|
||||
import adapters from "../public/adapters.json";
|
||||
import PublishCard from './PublishCard.vue'
|
||||
import adapters from '../public/adapters.json'
|
||||
|
||||
export default {
|
||||
name: "Adapters",
|
||||
name: 'Adapters',
|
||||
components: {
|
||||
PublishCard
|
||||
PublishCard,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
adapters: adapters,
|
||||
filterText: "",
|
||||
filterText: '',
|
||||
page: 1,
|
||||
dialog: false,
|
||||
valid: false,
|
||||
@ -148,34 +149,34 @@ export default {
|
||||
desc: null,
|
||||
id: null,
|
||||
link: null,
|
||||
repo: null
|
||||
}
|
||||
};
|
||||
repo: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pageNum() {
|
||||
return Math.ceil(this.filteredAdapters.length / 10);
|
||||
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 ||
|
||||
adapter.desc.indexOf(this.filterText || "") != -1 ||
|
||||
adapter.author.indexOf(this.filterText || "") != -1
|
||||
);
|
||||
});
|
||||
adapter.id.indexOf(this.filterText || '') != -1 ||
|
||||
adapter.name.indexOf(this.filterText || '') != -1 ||
|
||||
adapter.desc.indexOf(this.filterText || '') != -1 ||
|
||||
adapter.author.indexOf(this.filterText || '') != -1
|
||||
)
|
||||
})
|
||||
},
|
||||
displayAdapters() {
|
||||
return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10);
|
||||
return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10)
|
||||
},
|
||||
publishPlugin() {
|
||||
if (!this.$refs.newAdapterForm.validate()) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
const title = encodeURIComponent(
|
||||
`Adapter: ${this.newAdapter.name}`
|
||||
).replace(/%2B/gi, "+");
|
||||
).replace(/%2B/gi, '+')
|
||||
const body = encodeURIComponent(
|
||||
`
|
||||
**协议名称:**
|
||||
@ -207,11 +208,11 @@ ${this.newAdapter.repo}
|
||||
- repo: ${this.newAdapter.repo}
|
||||
-->
|
||||
`.trim()
|
||||
).replace(/%2B/gi, "+");
|
||||
).replace(/%2B/gi, '+')
|
||||
window.open(
|
||||
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Adapter`
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -68,8 +68,8 @@
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="
|
||||
dialog = false;
|
||||
publishBot();
|
||||
dialog = false
|
||||
publishBot()
|
||||
"
|
||||
>
|
||||
发布
|
||||
@ -79,14 +79,14 @@
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
</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-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-row>
|
||||
<v-col cols="12" sm="6" v-for="(bot, index) in displayBots" :key="index">
|
||||
<PublishCard
|
||||
@ -97,64 +97,64 @@
|
||||
></PublishCard>
|
||||
</v-col>
|
||||
</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-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-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PublishCard from "./PublishCard.vue";
|
||||
import bots from "../public/bots.json";
|
||||
import PublishCard from './PublishCard.vue'
|
||||
import bots from '../public/bots.json'
|
||||
|
||||
export default {
|
||||
name: "Bots",
|
||||
name: 'Bots',
|
||||
components: {
|
||||
PublishCard
|
||||
PublishCard,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
bots: bots,
|
||||
filterText: "",
|
||||
filterText: '',
|
||||
page: 1,
|
||||
dialog: false,
|
||||
valid: false,
|
||||
newBot: {
|
||||
name: null,
|
||||
desc: null,
|
||||
repo: null
|
||||
}
|
||||
};
|
||||
repo: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pageNum() {
|
||||
return Math.ceil(this.filteredBots.length / 10);
|
||||
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 ||
|
||||
bot.author.indexOf(this.filterText || "") != -1
|
||||
);
|
||||
});
|
||||
bot.name.indexOf(this.filterText || '') != -1 ||
|
||||
bot.desc.indexOf(this.filterText || '') != -1 ||
|
||||
bot.author.indexOf(this.filterText || '') != -1
|
||||
)
|
||||
})
|
||||
},
|
||||
displayBots() {
|
||||
return this.filteredBots.slice((this.page - 1) * 10, this.page * 10);
|
||||
return this.filteredBots.slice((this.page - 1) * 10, this.page * 10)
|
||||
},
|
||||
publishBot() {
|
||||
if (!this.$refs.newBotForm.validate()) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
const title = encodeURIComponent(`Bot: ${this.newBot.name}`).replace(
|
||||
/%2B/gi,
|
||||
"+"
|
||||
);
|
||||
'+'
|
||||
)
|
||||
const body = encodeURIComponent(
|
||||
`
|
||||
**机器人名称:**
|
||||
@ -176,11 +176,11 @@ ${this.newBot.repo}
|
||||
- repo: ${this.newBot.repo}
|
||||
-->
|
||||
`.trim()
|
||||
).replace(/%2B/gi, "+");
|
||||
).replace(/%2B/gi, '+')
|
||||
window.open(
|
||||
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Bot`
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -128,32 +128,32 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { WOW } from "wowjs";
|
||||
import "animate.css/animate.min.css";
|
||||
import { WOW } from 'wowjs'
|
||||
import 'animate.css/animate.min.css'
|
||||
|
||||
export default {
|
||||
name: "Messenger",
|
||||
name: 'Messenger',
|
||||
props: {
|
||||
messages: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initWOW: function() {
|
||||
initWOW: function () {
|
||||
new WOW({
|
||||
noxClass: "wow",
|
||||
animateClass: "animate__animated",
|
||||
noxClass: 'wow',
|
||||
animateClass: 'animate__animated',
|
||||
offset: 0,
|
||||
mobile: true,
|
||||
live: true
|
||||
}).init();
|
||||
}
|
||||
live: true,
|
||||
}).init()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initWOW();
|
||||
}
|
||||
};
|
||||
this.initWOW()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -183,7 +183,7 @@ export default {
|
||||
background-color: #fff;
|
||||
}
|
||||
.message .message-box::after {
|
||||
content: "";
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 0;
|
||||
|
@ -82,8 +82,8 @@
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="
|
||||
dialog = false;
|
||||
publishPlugin();
|
||||
dialog = false
|
||||
publishPlugin()
|
||||
"
|
||||
>
|
||||
发布
|
||||
@ -93,14 +93,14 @@
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
</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-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-row>
|
||||
<v-col
|
||||
cols="12"
|
||||
@ -119,30 +119,30 @@
|
||||
></PublishCard>
|
||||
</v-col>
|
||||
</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-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-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PublishCard from "./PublishCard.vue";
|
||||
import plugins from "../public/plugins.json";
|
||||
import PublishCard from './PublishCard.vue'
|
||||
import plugins from '../public/plugins.json'
|
||||
|
||||
export default {
|
||||
name: "Plugins",
|
||||
name: 'Plugins',
|
||||
components: {
|
||||
PublishCard
|
||||
PublishCard,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
plugins: plugins,
|
||||
filterText: "",
|
||||
filterText: '',
|
||||
page: 1,
|
||||
dialog: false,
|
||||
valid: false,
|
||||
@ -151,34 +151,34 @@ export default {
|
||||
desc: null,
|
||||
id: null,
|
||||
link: null,
|
||||
repo: null
|
||||
}
|
||||
};
|
||||
repo: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pageNum() {
|
||||
return Math.ceil(this.filteredPlugins.length / 10);
|
||||
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 ||
|
||||
plugin.desc.indexOf(this.filterText || "") != -1 ||
|
||||
plugin.author.indexOf(this.filterText || "") != -1
|
||||
);
|
||||
});
|
||||
plugin.id.indexOf(this.filterText || '') != -1 ||
|
||||
plugin.name.indexOf(this.filterText || '') != -1 ||
|
||||
plugin.desc.indexOf(this.filterText || '') != -1 ||
|
||||
plugin.author.indexOf(this.filterText || '') != -1
|
||||
)
|
||||
})
|
||||
},
|
||||
displayPlugins() {
|
||||
return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10);
|
||||
return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10)
|
||||
},
|
||||
publishPlugin() {
|
||||
if (!this.$refs.newPluginForm.validate()) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
const title = encodeURIComponent(
|
||||
`Plugin: ${this.newPlugin.name}`
|
||||
).replace(/%2B/gi, "+");
|
||||
).replace(/%2B/gi, '+')
|
||||
const body = encodeURIComponent(
|
||||
`
|
||||
**插件名称:**
|
||||
@ -210,11 +210,11 @@ ${this.newPlugin.repo}
|
||||
- repo: ${this.newPlugin.repo}
|
||||
-->
|
||||
`.trim()
|
||||
).replace(/%2B/gi, "+");
|
||||
).replace(/%2B/gi, '+')
|
||||
window.open(
|
||||
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Plugin`
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -34,7 +34,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import copy from "copy-to-clipboard";
|
||||
import copy from 'copy-to-clipboard'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -44,33 +44,33 @@ 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;
|
||||
}
|
||||
return this.text && this.command
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
repoLink(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() {
|
||||
copy(this.command, {
|
||||
format: "text/plain"
|
||||
});
|
||||
this.snackbar = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
format: 'text/plain',
|
||||
})
|
||||
this.snackbar = true
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -28,30 +28,30 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Adapter from "./Adapter.vue";
|
||||
import Plugin from "./Plugin.vue";
|
||||
import Bot from "./Bot.vue";
|
||||
import Adapter from './Adapter.vue'
|
||||
import Plugin from './Plugin.vue'
|
||||
import Bot from './Bot.vue'
|
||||
|
||||
export default {
|
||||
name: "Store",
|
||||
name: 'Store',
|
||||
components: {
|
||||
Adapter,
|
||||
Plugin,
|
||||
Bot
|
||||
Bot,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tab: 1,
|
||||
tabs: {
|
||||
0: "协议",
|
||||
1: "插件",
|
||||
2: "机器人"
|
||||
}
|
||||
};
|
||||
0: '协议',
|
||||
1: '插件',
|
||||
2: '机器人',
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {}
|
||||
};
|
||||
methods: {},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -1,2 +1 @@
|
||||
# 权限控制
|
||||
|
||||
|
@ -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` 的导入方式即可完成迁移。
|
||||
|
||||
## 安装插件
|
||||
|
||||
|
@ -37,8 +37,8 @@ AweSome-Bot
|
||||
:::warning 提示
|
||||
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot,请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
|
||||
|
||||
* 在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
|
||||
:::
|
||||
- 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
|
||||
:::
|
||||
|
||||
通过 `nb-cli`
|
||||
|
||||
|
@ -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 参数即可。
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user