mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
feat: add clear option for autostart channel setting
Allow users to remove/clear the autostart channel setting through the UI select menu. Added "解除" option and dynamic response messages for both setting and clearing operations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -395,6 +395,8 @@ impl EventHandler for Handler {
|
||||
ComponentInteractionDataKind::StringSelect { ref values, .. } => {
|
||||
if values.len() == 0 {
|
||||
None
|
||||
} else if values[0] == "SET_AUTOSTART_CHANNEL_CLEAR" {
|
||||
None
|
||||
} else {
|
||||
Some(
|
||||
u64::from_str_radix(
|
||||
@ -426,12 +428,18 @@ impl EventHandler for Handler {
|
||||
.unwrap();
|
||||
};
|
||||
|
||||
let response_content = if autostart_channel_id.is_some() {
|
||||
"自動参加チャンネルを設定しました。"
|
||||
} else {
|
||||
"自動参加チャンネルを解除しました。"
|
||||
};
|
||||
|
||||
message_component
|
||||
.create_response(
|
||||
&ctx.http,
|
||||
CreateInteractionResponse::UpdateMessage(
|
||||
CreateInteractionResponseMessage::new()
|
||||
.content("自動参加チャンネルを設定しました。"),
|
||||
.content(response_content),
|
||||
),
|
||||
)
|
||||
.await
|
||||
@ -462,6 +470,16 @@ impl EventHandler for Handler {
|
||||
.unwrap();
|
||||
|
||||
let mut options = Vec::new();
|
||||
|
||||
// 解除オプションを追加
|
||||
let clear_option = CreateSelectMenuOption::new(
|
||||
"解除",
|
||||
"SET_AUTOSTART_CHANNEL_CLEAR",
|
||||
)
|
||||
.description("自動参加チャンネルを解除します")
|
||||
.default_selection(autostart_channel_id == 0);
|
||||
options.push(clear_option);
|
||||
|
||||
for (id, channel) in channels {
|
||||
if channel.kind != ChannelType::Voice {
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user