diff --git a/.idea/dataSources/648c6ef7-2bba-4e14-b21f-f6619a5657a5.xml b/.idea/dataSources/648c6ef7-2bba-4e14-b21f-f6619a5657a5.xml
index c4f4622..f07f90e 100644
--- a/.idea/dataSources/648c6ef7-2bba-4e14-b21f-f6619a5657a5.xml
+++ b/.idea/dataSources/648c6ef7-2bba-4e14-b21f-f6619a5657a5.xml
@@ -1421,70 +1421,5 @@
1
-
-
-
-
- integer|0s
- 1
-
-
- text|0s
- 2
-
-
- 3
-
-
- integer|0s
- 1
- 1
-
-
- TEXT|0s
- 2
-
-
- real|0s
- 3
-
-
- real|0s
- 4
-
-
- real|0s
- 5
-
-
- real|0s
- 6
-
-
- id
- 1
-
-
- TEXT|0s
- 1
-
-
- TEXT|0s
- 2
-
-
- TEXT|0s
- 3
-
-
- INT|0s
- 4
-
-
- TEXT|0s
- 5
-
\ No newline at end of file
diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
index 59295c4..660c96d 100644
--- a/.idea/sqldialects.xml
+++ b/.idea/sqldialects.xml
@@ -1,8 +1,6 @@
-
-
diff --git a/pom.xml b/pom.xml
index 84dbe8b..1b1a5f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
dev.cosgy
TextToSpeak
- 0.4.0-beta.6
+ 0.4.0
jar
diff --git a/src/main/java/dev/cosgy/textToSpeak/Listener.kt b/src/main/java/dev/cosgy/textToSpeak/Listener.kt
index 54b2259..3f15a66 100644
--- a/src/main/java/dev/cosgy/textToSpeak/Listener.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/Listener.kt
@@ -46,14 +46,29 @@ class Listener(private val bot: Bot) : ListenerAdapter() {
val owner = bot.jda?.getUserById(bot.config.ownerId)
if (owner != null) {
val currentVersion = OtherUtil.currentVersion
- val latestVersion = OtherUtil.latestVersion
- if (latestVersion != null && !currentVersion.equals(
- latestVersion,
- ignoreCase = true
- ) && TextToSpeak.CHECK_UPDATE
- ) {
- val msg = String.format(OtherUtil.NEW_VERSION_AVAILABLE, currentVersion, latestVersion)
- owner.openPrivateChannel().queue { pc: PrivateChannel -> pc.sendMessage(msg).queue() }
+ // 現在のバージョンがリリース版かを確認
+ if (!OtherUtil.isBetaVersion(currentVersion)) {
+ // リリースバージョンの場合
+ val latestVersion = OtherUtil.latestVersion
+ if (latestVersion != null && !currentVersion.equals(
+ latestVersion,
+ ignoreCase = true
+ ) && TextToSpeak.CHECK_UPDATE
+ ) {
+ val msg = String.format(OtherUtil.NEW_VERSION_AVAILABLE, currentVersion, latestVersion)
+ owner.openPrivateChannel().queue { pc: PrivateChannel -> pc.sendMessage(msg).queue() }
+ }
+ }else{
+ // ベータバージョンの場合
+ val latestBeta = OtherUtil.latestBetaVersion
+ if(latestBeta != null && OtherUtil.compareVersions(currentVersion, latestBeta) != 0){
+ val msg = String.format(
+ OtherUtil.NEW_BETA_VERSION_AVAILABLE, currentVersion,
+ OtherUtil.latestBetaVersion,
+ OtherUtil.latestBetaVersion
+ )
+ owner.openPrivateChannel().queue { pc: PrivateChannel -> pc.sendMessage(msg).queue() }
+ }
}
}
}, 0, 24, TimeUnit.HOURS)
diff --git a/src/main/java/dev/cosgy/textToSpeak/utils/OtherUtil.kt b/src/main/java/dev/cosgy/textToSpeak/utils/OtherUtil.kt
index 102c075..a419bc9 100644
--- a/src/main/java/dev/cosgy/textToSpeak/utils/OtherUtil.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/utils/OtherUtil.kt
@@ -35,6 +35,7 @@ import java.nio.file.Paths
import java.util.*
object OtherUtil {
+ //TODO: ベータバージョンよりリリースバージョンの方が新しいバージョンだった場合はNEW_VERSION_AVAILABLEのメッセージは出す。
const val NEW_VERSION_AVAILABLE = ("利用可能な新しいバージョンがあります!\n"
+ "現在のバージョン: %s\n"
+ "最新のバージョン: %s\n\n"
@@ -138,14 +139,16 @@ object OtherUtil {
}
} else {
val latestBeta = latestBetaVersion
- if (latestBeta != null && compareVersions(version, latestBeta) == 0) {
- prompt.alert(Prompt.Level.INFO, "Beta Version", "最新のベータバージョンを使用中です。")
- } else {
- prompt.alert(
- Prompt.Level.WARNING,
- "Beta Version",
- String.format(NEW_BETA_VERSION_AVAILABLE, version, latestBetaVersion, latestBetaVersion)
- )
+ if(latestBeta != null) {
+ if (compareVersions(version, latestBeta) == 0) {
+ prompt.alert(Prompt.Level.INFO, "Beta Version", "最新のベータバージョンを使用中です。")
+ } else {
+ prompt.alert(
+ Prompt.Level.WARNING,
+ "Beta Version",
+ String.format(NEW_BETA_VERSION_AVAILABLE, version, latestBetaVersion, latestBetaVersion)
+ )
+ }
}
}
@@ -185,7 +188,7 @@ object OtherUtil {
return null
}
- private val latestBetaVersion: String?
+ val latestBetaVersion: String?
get() {
try {
val client = OkHttpClient()
@@ -218,13 +221,13 @@ object OtherUtil {
return null
}
- private fun isBetaVersion(version: String): Boolean {
+ fun isBetaVersion(version: String): Boolean {
val versionParts = version.split("-")
return versionParts.lastOrNull()?.startsWith("beta") ?: false
}
- private fun compareVersions(version1: String, version2: String): Int {
+ fun compareVersions(version1: String, version2: String): Int {
val parts1 = version1.split("[.-]".toRegex()).toTypedArray()
val parts2 = version2.split("[.-]".toRegex()).toTypedArray()
val length = maxOf(parts1.size, parts2.size)
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index 36426d3..577225e 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -40,14 +40,14 @@
-
-
+
+