private void RegistrarMusicas() { var gerenciadorDeFilas = (GerenciadorDeFilas)_serviceProvider.GetService(typeof(GerenciadorDeFilas)); foreach (var audio in ListaDeAudios.Lista) { var comandoDinamico = new ComandosDinamicosDeAudio(audio.Value, gerenciadorDeFilas); Comando funcao = comandoDinamico.ExecutarMusica; var funcaoDoComando = new CommandOverloadBuilder(funcao); var argumentos = funcaoDoComando.Arguments; var comando = new CommandBuilder() .WithName(audio.Key) .WithOverload(funcaoDoComando) .WithDescription(audio.Value.Descricao); _comandos.RegisterCommands(comando); } ; }
protected void RegisterSoundEffectFromFile(string fullPath) { var cmdNext = Client.GetCommandsNext(); var cmd = new CommandBuilder(_seCommands); var overload = new CommandOverloadBuilder(_seCommands.GetPlaySoundEffectCommand(fullPath)); var cmdName = GetCommandNameFromPath(fullPath); // check if we're not trying to register a duplicate command if (cmdNext.RegisteredCommands.ContainsKey(cmdName)) { Logger.Error("Sound Effect Watcher Error", $"Tried to register command name '{cmdName}' that already existed!"); return; } // build command cmd.WithName(cmdName) .WithOverload(overload) .WithExecutionCheck(new RequireVoiceChannelAttribute()); // register command cmdNext.RegisterCommands(cmd); _registeredEffects.Add(cmdName); }