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

Function merge_script_commands

components/scheduler/src/command_manager.rs:417–434  ·  view source on GitHub ↗
(scripts: Vec<Vec<TwilightCommand>>)

Source from the content-addressed store, hash-verified

415}
416
417fn merge_script_commands(scripts: Vec<Vec<TwilightCommand>>) -> Vec<TwilightCommand> {
418 let mut result = Vec::new();
419
420 for script_commands in scripts {
421 for cmd in script_commands {
422 if let Some(existing) = result
423 .iter_mut()
424 .find(|v: &&mut TwilightCommand| v.name == cmd.name)
425 {
426 merge_command(existing, cmd);
427 } else {
428 result.push(cmd);
429 }
430 }
431 }
432
433 result
434}
435
436// merges src into dst
437fn merge_command(dst: &mut TwilightCommand, src: TwilightCommand) {

Callers 1

update_guild_commandsMethod · 0.85

Calls 1

merge_commandFunction · 0.85

Tested by

no test coverage detected