feat: support plugin detail
This commit is contained in:
parent
d5d08d040b
commit
eec3db2b86
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "koishi-plugin-market-info",
|
"name": "koishi-plugin-market-info",
|
||||||
"description": "Koishi plugin market information",
|
"description": "Koishi plugin market information",
|
||||||
"version": "1.1.5",
|
"version": "1.2.0",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -57,10 +57,16 @@ export function apply(ctx: Context, config: Config) {
|
|||||||
ctx.on('ready', async () => {
|
ctx.on('ready', async () => {
|
||||||
let previous = await getMarket()
|
let previous = await getMarket()
|
||||||
|
|
||||||
ctx.command('market')
|
ctx.command('market [name]')
|
||||||
.action(async ({ session }) => {
|
.action(async ({ session }, name) => {
|
||||||
const objects = Object.values(previous).filter(data => !data.manifest.hidden)
|
if (!name) {
|
||||||
return session.text('.overview', [objects.length])
|
const objects = Object.values(previous).filter(data => !data.manifest.hidden)
|
||||||
|
return session.text('.overview', [objects.length])
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = previous[name]
|
||||||
|
if (!data) return session.text('.not-found', [name])
|
||||||
|
return session.text('.detail', data)
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.setInterval(async () => {
|
ctx.setInterval(async () => {
|
||||||
|
@ -4,6 +4,10 @@ commands:
|
|||||||
|
|
||||||
messages:
|
messages:
|
||||||
overview: 当前共有 {0} 个插件。
|
overview: 当前共有 {0} 个插件。
|
||||||
|
not-found: 未找到插件 {0}。
|
||||||
|
detail: |-
|
||||||
|
{name} ({version})
|
||||||
|
{manifest.description.zh || manifest.description.en}
|
||||||
|
|
||||||
market-info:
|
market-info:
|
||||||
header: '[插件市场更新]'
|
header: '[插件市场更新]'
|
||||||
|
Loading…
Reference in New Issue
Block a user