mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
fix action row
This commit is contained in:
@ -44,7 +44,9 @@ pub async fn config_command(
|
||||
f.interaction_response_data(|d| {
|
||||
d.content("読み上げ設定")
|
||||
.components(|c| {
|
||||
c.create_action_row(|a| {
|
||||
let mut c = c;
|
||||
c = c
|
||||
.create_action_row(|a| {
|
||||
a.create_select_menu(|m| {
|
||||
m.custom_id("TTS_CONFIG_ENGINE")
|
||||
.options(|o| {
|
||||
@ -53,46 +55,54 @@ pub async fn config_command(
|
||||
.value("TTS_CONFIG_ENGINE_SELECTED_GOOGLE")
|
||||
.default_selection(tts_type == TTSType::GCP)
|
||||
})
|
||||
.create_option(
|
||||
|co| {
|
||||
.create_option(|co| {
|
||||
co.label("VOICEVOX")
|
||||
.value("TTS_CONFIG_ENGINE_SELECTED_VOICEVOX")
|
||||
.default_selection(
|
||||
tts_type == TTSType::VOICEVOX,
|
||||
)
|
||||
},
|
||||
)
|
||||
})
|
||||
})
|
||||
.placeholder("読み上げAPIを選択")
|
||||
})
|
||||
})
|
||||
.create_action_row(|a| {
|
||||
a.create_select_menu(|m| {
|
||||
m.custom_id("TTS_CONFIG_VOICEVOX_SPEAKER")
|
||||
.options(|o| {
|
||||
let mut o = o;
|
||||
for (name, value) in voicevox_speakers {
|
||||
o = o.create_option(|co| {
|
||||
co.label(name)
|
||||
.value(format!(
|
||||
"TTS_CONFIG_VOICEVOX_SPEAKER_SELECTED_{}",
|
||||
value
|
||||
))
|
||||
.default_selection(value == voicevox_speaker)
|
||||
})
|
||||
}
|
||||
o
|
||||
})
|
||||
.placeholder("VOICEVOX Speakerを指定")
|
||||
})
|
||||
})
|
||||
.create_action_row(|a| {
|
||||
a.create_button(|f| {
|
||||
f.label("サーバー設定")
|
||||
.custom_id("TTS_CONFIG_SERVER")
|
||||
.style(ButtonStyle::Primary)
|
||||
})
|
||||
});
|
||||
|
||||
for (index, speaker_chunk) in voicevox_speakers.chunks(25).enumerate() {
|
||||
c = c.create_action_row(|a| {
|
||||
let mut a = a;
|
||||
a = a.create_select_menu(|m| {
|
||||
m.custom_id(
|
||||
"TTS_CONFIG_VOICEVOX_SPEAKER_".to_string()
|
||||
+ &index.to_string(),
|
||||
)
|
||||
.options(|o| {
|
||||
let mut o = o;
|
||||
for (name, id) in speaker_chunk {
|
||||
o = o.create_option(|co| {
|
||||
co.label(name)
|
||||
.value(format!(
|
||||
"TTS_CONFIG_VOICEVOX_SPEAKER_SELECTED_{}",
|
||||
id
|
||||
))
|
||||
.default_selection(*id == voicevox_speaker)
|
||||
})
|
||||
}
|
||||
o
|
||||
})
|
||||
.placeholder("VOICEVOX Speakerを指定")
|
||||
});
|
||||
a
|
||||
})
|
||||
}
|
||||
|
||||
c
|
||||
})
|
||||
.flags(MessageFlags::EPHEMERAL)
|
||||
})
|
||||
|
Reference in New Issue
Block a user