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