feat: support i18n broadcast

This commit is contained in:
Shigma 2023-03-25 01:00:28 +08:00
parent b2cf70c17d
commit d5d08d040b
No known key found for this signature in database
GPG Key ID: 414458B84ACF8744
4 changed files with 17 additions and 8 deletions

View File

@ -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.4", "version": "1.1.5",
"main": "lib/index.js", "main": "lib/index.js",
"typings": "lib/index.d.ts", "typings": "lib/index.d.ts",
"files": [ "files": [
@ -43,10 +43,10 @@
"koishi": "^4.10.5" "koishi": "^4.10.5"
}, },
"devDependencies": { "devDependencies": {
"@koishijs/registry": "^4.4.5", "@koishijs/registry": "^4.6.0",
"@types/node": "^18.11.18", "@types/node": "^18.15.5",
"atsc": "^1.2.2", "atsc": "^1.2.2",
"koishi": "^4.11.3", "koishi": "^4.12.1",
"typescript": "^4.9.4" "typescript": "^4.9.5"
} }
} }

View File

@ -59,7 +59,8 @@ export function apply(ctx: Context, config: Config) {
ctx.command('market') ctx.command('market')
.action(async ({ session }) => { .action(async ({ session }) => {
return session.text('.overview', [Object.keys(previous).length]) const objects = Object.values(previous).filter(data => !data.manifest.hidden)
return session.text('.overview', [objects.length])
}) })
ctx.setInterval(async () => { ctx.setInterval(async () => {
@ -70,7 +71,7 @@ export function apply(ctx: Context, config: Config) {
if (version1 === version2) return if (version1 === version2) return
if (!version1) { if (!version1) {
let output = `新增:${name}` let output = <p><i18n path="market-info.created"></i18n></p>
if (config.showPublisher) output += ` (@${current[name].publisher.username})` if (config.showPublisher) output += ` (@${current[name].publisher.username})`
if (config.showDescription) { if (config.showDescription) {
const { description } = current[name].manifest const { description } = current[name].manifest

View File

@ -4,3 +4,9 @@ commands:
messages: messages:
overview: 当前共有 {0} 个插件。 overview: 当前共有 {0} 个插件。
market-info:
header: '[插件市场更新]'
created: 新增:{0}
updated: 更新:{0} ({1} → {2})`
deleted: 移除:{0}

View File

@ -9,7 +9,9 @@
"incremental": true, "incremental": true,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,
"moduleResolution": "node" "moduleResolution": "node",
"jsx": "react-jsx",
"jsxImportSource": "@satorijs/element",
}, },
"include": [ "include": [
"src" "src"