| 479 | } |
| 480 | |
| 481 | fn merge_subgroups(dst: &mut TwilightCommandOption, src: TwilightCommandOption) { |
| 482 | if dst.description == GROUP_DESC_PLACEHOLDER && src.description != GROUP_DESC_PLACEHOLDER { |
| 483 | dst.description = src.description; |
| 484 | } |
| 485 | |
| 486 | for opt in src.options.as_ref().unwrap_or(&Vec::new()) { |
| 487 | if let Some(dst_options) = &mut dst.options { |
| 488 | if dst_options.iter().any(|v| v.name == opt.name) { |
| 489 | // we command merge sub commands themselves |
| 490 | continue; |
| 491 | } |
| 492 | |
| 493 | // but we can add them to the group if there is no conflict! |
| 494 | dst_options.push(opt.clone()); |
| 495 | } else { |
| 496 | dst.options = src.options.clone(); |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | struct CommandManagerCommand { |
| 502 | guild_id: Id<GuildMarker>, |