diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index b2bb500..4ffb1c8 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -1,13 +1,16 @@
-
+
sqlite.xerial
true
org.sqlite.JDBC
- jdbc:sqlite:C:\Users\kosug\IdeaProjects\TextToSpeak\src\main\resources\UserData.sqlite
+ jdbc:sqlite:C:\Users\kosug\IdeaProjects\TextToSpeakBot\src\main\resources\UserData.sqlite
$ProjectFileDir$
+
+ file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.39.2/sqlite-jdbc-3.39.2.jar
+
file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.34.0/sqlite-jdbc-3.34.0.jar
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index c79ede3..146230b 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -3,5 +3,6 @@
+
\ No newline at end of file
diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
index 3dec230..59295c4 100644
--- a/.idea/sqldialects.xml
+++ b/.idea/sqldialects.xml
@@ -5,4 +5,7 @@
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 440eb27..266dba9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
dev.cosgy
TextToSpeak
- 0.4.0-beta.3
+ 0.4.0-beta.4
jar
@@ -66,7 +66,7 @@
net.dv8tion
JDA
- 5.0.0-beta.10
+ 5.0.0-beta.11
com.github.walkyst
diff --git a/src/main/java/dev/cosgy/textToSpeak/commands/admin/GuildSettings.kt b/src/main/java/dev/cosgy/textToSpeak/commands/admin/GuildSettings.kt
index cdf36eb..b5a392b 100644
--- a/src/main/java/dev/cosgy/textToSpeak/commands/admin/GuildSettings.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/commands/admin/GuildSettings.kt
@@ -45,12 +45,12 @@ class GuildSettings(private val bot: Bot) : AdminCommand() {
val builder = EmbedBuilder()
.setColor(Color.orange)
.setTitle(event.guild!!.name + "の設定")
- .addField("ユーザー名読み上げ:", settings.isReadName().toString(), false)
+ .addField("ユーザー名読み上げ:", if (settings.isReadName()) "有効" else "無効", false)
.addField(
"参加、退出時の読み上げ:",
- settings.isJoinAndLeaveRead().toString(),
+ if (settings.isJoinAndLeaveRead()) "有効" else "無効",
false
- ) //.addField("接頭語:", settings.getPrefix(), false)
+ )
.addField("読み上げるチャンネル:", text, false)
.addField("読み上げの主音量:", settings.volume.toString(), false)
event.replyEmbeds(builder.build()).queue()
@@ -65,10 +65,10 @@ class GuildSettings(private val bot: Bot) : AdminCommand() {
val builder = EmbedBuilder()
.setColor(Color.orange)
.setTitle(event.guild.name + "の設定")
- .addField("ユーザー名読み上げ:", settings.isReadName().toString(), false)
+ .addField("ユーザー名読み上げ:", if (settings.isReadName()) "有効" else "無効", false)
.addField(
"参加、退出時の読み上げ:",
- settings.isJoinAndLeaveRead().toString(),
+ if (settings.isJoinAndLeaveRead()) "有効" else "無効",
false
) //.addField("接頭語:", settings.getPrefix(), false)
.addField("読み上げるチャンネル:", text, false)
diff --git a/src/main/java/dev/cosgy/textToSpeak/commands/admin/JLReadCmd.kt b/src/main/java/dev/cosgy/textToSpeak/commands/admin/JLReadCmd.kt
index 8b74c2a..d70f3ad 100644
--- a/src/main/java/dev/cosgy/textToSpeak/commands/admin/JLReadCmd.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/commands/admin/JLReadCmd.kt
@@ -19,6 +19,8 @@ import com.jagrosh.jdautilities.command.CommandEvent
import com.jagrosh.jdautilities.command.SlashCommandEvent
import dev.cosgy.textToSpeak.Bot
import dev.cosgy.textToSpeak.commands.AdminCommand
+import net.dv8tion.jda.api.interactions.commands.OptionType
+import net.dv8tion.jda.api.interactions.commands.build.OptionData
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -28,6 +30,8 @@ class JLReadCmd(private val bot: Bot) : AdminCommand() {
init {
name = "jlread"
help = "ボイスチャンネルにユーザーが参加または退出した時にユーザー名を読み上げるか否かを設定します。"
+
+ options = listOf(OptionData(OptionType.BOOLEAN, "value", "機能を有効にするか否か", false))
}
override fun execute(event: SlashCommandEvent) {
@@ -36,17 +40,27 @@ class JLReadCmd(private val bot: Bot) : AdminCommand() {
return
}
val settings = bot.settingsManager.getSettings(event.guild!!)
- if (settings.isJoinAndLeaveRead()) {
- settings.setJoinAndLeaveRead(false)
- event.reply("ボイスチャンネルにユーザーが参加、退出した際の読み上げを無効にしました。").queue()
+
+ if (event.getOption("value") == null) {
+ if (settings.isJoinAndLeaveRead()) {
+ settings.setJoinAndLeaveRead(false)
+ event.reply("ボイスチャンネルにユーザーが参加、退出した際の読み上げを無効にしました。").queue()
+ } else {
+ settings.setJoinAndLeaveRead(true)
+ event.reply("ボイスチャンネルにユーザーが参加、退出した際の読み上げを有効にしました。").queue()
+ }
} else {
- settings.setJoinAndLeaveRead(true)
- event.reply("ボイスチャンネルにユーザーが参加、退出した際の読み上げを有効にしました。").queue()
+ val args = event.getOption("value")!!.asBoolean
+
+ settings.setReadName(args)
+
+ event.reply("ボイスチャンネルにユーザーが参加、退出した際の読み上げを${if (args) "有効" else "無効"}にしました。").queue()
}
}
override fun execute(event: CommandEvent) {
val settings = bot.settingsManager.getSettings(event.guild)
+
if (settings.isJoinAndLeaveRead()) {
settings.setJoinAndLeaveRead(false)
event.reply("ボイスチャンネルにユーザーが参加、退出した際の読み上げを無効にしました。")
diff --git a/src/main/java/dev/cosgy/textToSpeak/commands/admin/SetReadNameCmd.kt b/src/main/java/dev/cosgy/textToSpeak/commands/admin/SetReadNameCmd.kt
index 575e9c0..016991a 100644
--- a/src/main/java/dev/cosgy/textToSpeak/commands/admin/SetReadNameCmd.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/commands/admin/SetReadNameCmd.kt
@@ -19,6 +19,8 @@ import com.jagrosh.jdautilities.command.CommandEvent
import com.jagrosh.jdautilities.command.SlashCommandEvent
import dev.cosgy.textToSpeak.Bot
import dev.cosgy.textToSpeak.commands.AdminCommand
+import net.dv8tion.jda.api.interactions.commands.OptionType
+import net.dv8tion.jda.api.interactions.commands.build.OptionData
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -28,6 +30,8 @@ class SetReadNameCmd(private val bot: Bot) : AdminCommand() {
init {
name = "setreadname"
help = "テキストを読み上げる際にユーザー名も読み上げるかを設定します。"
+
+ options = listOf(OptionData(OptionType.BOOLEAN, "value", "機能を有効にするか否か", false))
}
override fun execute(event: SlashCommandEvent) {
@@ -35,13 +39,23 @@ class SetReadNameCmd(private val bot: Bot) : AdminCommand() {
event.reply(event.client.warning + "権限がないため実行できません。").queue()
return
}
+
val settings = bot.settingsManager.getSettings(event.guild!!)
- if (settings.isReadName()) {
- settings.setReadName(false)
- event.reply("ユーザー名の読み上げを無効にしました。").queue()
+
+ if (event.getOption("value") == null) {
+ if (settings.isReadName()) {
+ settings.setReadName(false)
+ event.reply("ユーザー名の読み上げを無効にしました。").queue()
+ } else {
+ settings.setReadName(true)
+ event.reply("ユーザー名の読み上げを有効にしました。").queue()
+ }
} else {
- settings.setReadName(true)
- event.reply("ユーザー名の読み上げを有効にしました。").queue()
+ val args = event.getOption("value")!!.asBoolean
+
+ settings.setReadName(args)
+
+ event.reply("ユーザー名の読み上げを${if (args) "有効" else "無効"}にしました。").queue()
}
}
diff --git a/src/main/java/dev/cosgy/textToSpeak/commands/dictionary/AddWordCmd.kt b/src/main/java/dev/cosgy/textToSpeak/commands/dictionary/AddWordCmd.kt
index d98a46d..9028169 100644
--- a/src/main/java/dev/cosgy/textToSpeak/commands/dictionary/AddWordCmd.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/commands/dictionary/AddWordCmd.kt
@@ -95,6 +95,7 @@ class AddWordCmd(private val bot: Bot) : SlashCommand() {
companion object {
private val SUCCESS_COLOR = Color(0, 163, 129)
+
//private val ERROR_COLOR = Color.RED
//private const val INVALID_ARGS_MESSAGE = "コマンドが無効です。単語と読み方の2つを入力して実行して下さい。"
//private const val USAGE_MESSAGE = "使用方法: /addword <単語> <読み方>"
diff --git a/src/main/java/dev/cosgy/textToSpeak/commands/general/AboutCommand.kt b/src/main/java/dev/cosgy/textToSpeak/commands/general/AboutCommand.kt
index a57641b..7e5b1af 100644
--- a/src/main/java/dev/cosgy/textToSpeak/commands/general/AboutCommand.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/commands/general/AboutCommand.kt
@@ -88,7 +88,8 @@ class AboutCommand(private val color: Color, private val description: String, va
"ステータス", """${jda.guilds.size} サーバー
|1シャード""".trimMargin(), true
)
- builder.addField("ユーザー", """${jda.users.size} ユニーク
+ builder.addField(
+ "ユーザー", """${jda.users.size} ユニーク
|${jda.guilds.stream().mapToInt { g: Guild -> g.members.size }.sum()} 合計""".trimMargin(), true
)
builder.addField(
diff --git a/src/main/java/dev/cosgy/textToSpeak/settings/UserSettingsManager.kt b/src/main/java/dev/cosgy/textToSpeak/settings/UserSettingsManager.kt
index 9cec6d1..12dd607 100644
--- a/src/main/java/dev/cosgy/textToSpeak/settings/UserSettingsManager.kt
+++ b/src/main/java/dev/cosgy/textToSpeak/settings/UserSettingsManager.kt
@@ -64,7 +64,7 @@ class UserSettingsManager {
}
fun getSettings(userId: Long): UserSettings {
- return settings.computeIfAbsent(userId) { _ : Long -> createDefaultSettings(userId) }
+ return settings.computeIfAbsent(userId) { _: Long -> createDefaultSettings(userId) }
}
private fun createDefaultSettings(userId: Long): UserSettings {
diff --git a/src/main/resources/reference.conf b/src/main/resources/reference.conf
index 4ef7ffc..5fd4596 100644
--- a/src/main/resources/reference.conf
+++ b/src/main/resources/reference.conf
@@ -1,8 +1,8 @@
/// START OF YOMIAGEBOT CONFIG ///
//______________________________________________________________
-// ===================
-// Yomiage Botの設定
-// ===================
+//===================
+// Yomiage Bot\u00E3\u0081\u00AE\u00E8\u00A8\u00AD\u00E5\u00AE\u009A
+//===================
//
// //で始まる行は無視されます。
// トークンと所有者を設定しなければなりません。