mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
🎨 improve format
This commit is contained in:
parent
176dbd5830
commit
207750774d
9
.prettierrc
Normal file
9
.prettierrc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"arrowParens": "always",
|
||||||
|
"singleQuote": false,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"semi": true
|
||||||
|
}
|
@ -82,8 +82,8 @@
|
|||||||
color="blue darken-1"
|
color="blue darken-1"
|
||||||
text
|
text
|
||||||
@click="
|
@click="
|
||||||
dialog = false
|
dialog = false;
|
||||||
publishAdapter()
|
publishAdapter();
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
发布
|
发布
|
||||||
@ -93,14 +93,16 @@
|
|||||||
</v-dialog>
|
</v-dialog>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-col cols="12">
|
<v-row>
|
||||||
<v-pagination
|
<v-col cols="12">
|
||||||
v-model="page"
|
<v-pagination
|
||||||
:length="pageNum"
|
v-model="page"
|
||||||
prev-icon="fa-caret-left"
|
:length="pageNum"
|
||||||
next-icon="fa-caret-right"
|
prev-icon="fa-caret-left"
|
||||||
></v-pagination
|
next-icon="fa-caret-right"
|
||||||
></v-col>
|
></v-pagination
|
||||||
|
></v-col>
|
||||||
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col
|
<v-col
|
||||||
cols="12"
|
cols="12"
|
||||||
@ -129,18 +131,18 @@
|
|||||||
</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,
|
||||||
@ -151,32 +153,32 @@ export default {
|
|||||||
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(
|
||||||
`
|
`
|
||||||
**协议名称:**
|
**协议名称:**
|
||||||
@ -208,11 +210,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>
|
||||||
|
@ -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,16 @@
|
|||||||
</v-dialog>
|
</v-dialog>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-col cols="12">
|
<v-row>
|
||||||
<v-pagination
|
<v-col cols="12">
|
||||||
v-model="page"
|
<v-pagination
|
||||||
:length="pageNum"
|
v-model="page"
|
||||||
prev-icon="fa-caret-left"
|
:length="pageNum"
|
||||||
next-icon="fa-caret-right"
|
prev-icon="fa-caret-left"
|
||||||
></v-pagination>
|
next-icon="fa-caret-right"
|
||||||
</v-col>
|
></v-pagination>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
<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
|
||||||
@ -109,18 +111,18 @@
|
|||||||
</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,
|
||||||
@ -129,32 +131,32 @@ export default {
|
|||||||
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 +178,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>
|
||||||
|
@ -128,11 +128,11 @@
|
|||||||
</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,
|
||||||
@ -140,20 +140,20 @@ export 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;
|
||||||
|
@ -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,16 @@
|
|||||||
</v-dialog>
|
</v-dialog>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-col cols="12">
|
<v-row>
|
||||||
<v-pagination
|
<v-col cols="12">
|
||||||
v-model="page"
|
<v-pagination
|
||||||
:length="pageNum"
|
v-model="page"
|
||||||
prev-icon="fa-caret-left"
|
:length="pageNum"
|
||||||
next-icon="fa-caret-right"
|
prev-icon="fa-caret-left"
|
||||||
></v-pagination>
|
next-icon="fa-caret-right"
|
||||||
</v-col>
|
></v-pagination>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col
|
<v-col
|
||||||
cols="12"
|
cols="12"
|
||||||
@ -131,18 +133,18 @@
|
|||||||
</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,
|
||||||
@ -153,32 +155,32 @@ export default {
|
|||||||
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 +212,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>
|
||||||
|
@ -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: {
|
||||||
@ -49,28 +49,28 @@ export default {
|
|||||||
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>
|
||||||
|
@ -28,12 +28,12 @@
|
|||||||
</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,
|
||||||
@ -43,15 +43,15 @@ export default {
|
|||||||
return {
|
return {
|
||||||
tab: 1,
|
tab: 1,
|
||||||
tabs: {
|
tabs: {
|
||||||
0: '协议',
|
0: "协议",
|
||||||
1: '插件',
|
1: "插件",
|
||||||
2: '机器人',
|
2: "机器人",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {},
|
methods: {},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -38,7 +38,8 @@ AweSome-Bot
|
|||||||
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot,请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
|
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot,请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
|
||||||
|
|
||||||
- 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
|
- 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
|
||||||
:::
|
|
||||||
|
:::
|
||||||
|
|
||||||
通过 `nb-cli`
|
通过 `nb-cli`
|
||||||
|
|
||||||
|
@ -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": {
|
||||||
|
Loading…
Reference in New Issue
Block a user