Beispiel #1
0
        public AudioPlayerModule(ILogger <AudioPlayerModule> logger, IBotCoreModule botCoreModule, AudioPlayer config)
        {
            // These dlls are imported via DllImportAttribute which does not trigger BotRunner's assembly resolve functionality
            string opus = "libopus.dll", sodium = "libsodium.dll";

            CopyNativeLib(opus);
            CopyNativeLib(sodium);

            _logger        = logger;
            _botCoreModule = botCoreModule;
            _botCoreModule.CommandHandler.RegisterCommands <AudioPlayerCommands>();
            _botCoreModule.DiscordClient.VoiceStateUpdated += VoiceStateUpdated;

            _config             = config;
            _voiceNextExtension = _botCoreModule.DiscordClient.UseVoiceNext(new VoiceNextConfiguration {
                EnableIncoming = false
            });

            foreach (Track track in config.Tracks)
            {
                if (track.FileName != null && track.FileNames != null)
                {
                    _logger.LogWarning($"Track \"{track.Name}\" has a file name and a list of file names, if the file name is not also included in the list it will not be used as a trigger!");
                }
            }
        }