コード例 #1
0
        public MusicService(DiscordSocketClient client, IGoogleApiService google,
                            NadekoStrings strings, ILocalization localization, DbService db,
                            SoundCloudApiService sc, IBotCredentials creds, NadekoBot bot)
        {
            _client        = client;
            _google        = google;
            _strings       = strings;
            _localization  = localization;
            _db            = db;
            _sc            = sc;
            _creds         = creds;
            _log           = LogManager.GetCurrentClassLogger();
            _musicSettings = bot.AllGuildConfigs.ToDictionary(x => x.GuildId, x => x.MusicSettings)
                             .ToConcurrent();

            _client.LeftGuild += _client_LeftGuild;

            try { Directory.Delete(MusicDataPath, true); } catch { }

            _defaultVolumes = new ConcurrentDictionary <ulong, float>(
                bot.AllGuildConfigs
                .ToDictionary(x => x.GuildId, x => x.DefaultMusicVolume));

            AutoDcServers = new ConcurrentHashSet <ulong>(bot.AllGuildConfigs.Where(x => x.AutoDcFromVc).Select(x => x.GuildId));

            Directory.CreateDirectory(MusicDataPath);
        }
コード例 #2
0
        public MusicService(DiscordSocketClient client, IGoogleApiService google, NadekoStrings strings, ILocalization localization, DbService db, SoundCloudApiService sc, IEnumerable <GuildConfig> gcs)
        {
            _client       = client;
            _google       = google;
            _strings      = strings;
            _localization = localization;
            _db           = db;
            _sc           = sc;
            _log          = LogManager.GetCurrentClassLogger();

            try { Directory.Delete(MusicDataPath, true); } catch { }

            _defaultVolumes = new ConcurrentDictionary <ulong, float>(gcs.ToDictionary(x => x.GuildId, x => x.DefaultMusicVolume));

            Directory.CreateDirectory(MusicDataPath);

            //_t = new Timer(_ => _log.Info(MusicPlayers.Count(x => x.Value.Current.Current != null)), null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5));
        }
コード例 #3
0
 public SoundcloudResolveStrategy(SoundCloudApiService sc)
 {
     _sc = sc;
 }
コード例 #4
0
 public SongResolverFactory(SoundCloudApiService sc)
 {
     _sc = sc;
 }
コード例 #5
0
 public SoundcloudResolver(SoundCloudApiService sc, ITrackCacher trackCacher, IHttpClientFactory httpFactory)
 {
     _sc          = sc;
     _trackCacher = trackCacher;
     _httpFactory = httpFactory;
 }