MCPcopy Create free account
hub / github.com/Botloader/botloader / merge_subgroups

Function merge_subgroups

components/scheduler/src/command_manager.rs:481–499  ·  view source on GitHub ↗
(dst: &mut TwilightCommandOption, src: TwilightCommandOption)

Source from the content-addressed store, hash-verified

479}
480
481fn 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
501struct CommandManagerCommand {
502 guild_id: Id<GuildMarker>,

Callers 1

merge_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected