From 15fe4cc01d07e2e051bda7aeb7aded43fc7971d4 Mon Sep 17 00:00:00 2001 From: cssxsh Date: Fri, 21 Jul 2023 04:03:06 +0800 Subject: [PATCH] feat: auto_update config --- README.md | 7 +++++++ .../io/github/gnuf0rce/mirai/github/GitHubHelperPlugin.kt | 4 +++- .../io/github/gnuf0rce/mirai/github/data/GitHubConfig.kt | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index baea618..6a5c764 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,12 @@ | `/ [name]` | 查看贡献 | | `/ [name]` | 查看奖杯 | +### GitHubUpdateCommand + +| 指令 | 描述 | +|:------------|:-------| +| `/` | 检查插件更新 | + ## 自动通过加群问题放行开发者 `1.1.7` 起对接到 [mirai-administrator](https://github.com/cssxsh/mirai-administrator) 实现此功能 @@ -121,6 +127,7 @@ * `percentages` 加群放行 GitHub 活跃等级(百分制),默认0,不开启功能 * `sign_member_join` 加群放行提示信息 * `github_readme_stats` stats card 绘制参数 +* `auto_update` 启动时检查插件更新 ## 安装 diff --git a/src/main/kotlin/io/github/gnuf0rce/mirai/github/GitHubHelperPlugin.kt b/src/main/kotlin/io/github/gnuf0rce/mirai/github/GitHubHelperPlugin.kt index f936222..2267623 100644 --- a/src/main/kotlin/io/github/gnuf0rce/mirai/github/GitHubHelperPlugin.kt +++ b/src/main/kotlin/io/github/gnuf0rce/mirai/github/GitHubHelperPlugin.kt @@ -76,7 +76,9 @@ internal object GitHubHelperPlugin : KotlinPlugin( val target = resolveConfigFile("update.dict.json") logger.info { "1.3.0 起提供从 github 更新<其他插件>的功能, 如有需要, 请编辑:\n ${target.toPath().toUri()}" } GitHubReleasePluginUpdater.reload(target) - GitHubReleasePluginUpdater.update() + if (GitHubConfig.update) { + GitHubReleasePluginUpdater.update() + } } override fun onDisable() { diff --git a/src/main/kotlin/io/github/gnuf0rce/mirai/github/data/GitHubConfig.kt b/src/main/kotlin/io/github/gnuf0rce/mirai/github/data/GitHubConfig.kt index c48cb00..325030f 100644 --- a/src/main/kotlin/io/github/gnuf0rce/mirai/github/data/GitHubConfig.kt +++ b/src/main/kotlin/io/github/gnuf0rce/mirai/github/data/GitHubConfig.kt @@ -60,4 +60,8 @@ public object GitHubConfig : ReadOnlyPluginConfig("GithubConfig") { "include_all_commits" to "true" ) ) + + @ValueName("auto_update") + @ValueDescription("启动时检查插件更新") + public val update: Boolean by value(true) } \ No newline at end of file