diff --git a/TelegramMusicStatus/Services/LastFmService.cs b/TelegramMusicStatus/Services/LastFmService.cs index 2e3557b..3a35b25 100644 --- a/TelegramMusicStatus/Services/LastFmService.cs +++ b/TelegramMusicStatus/Services/LastFmService.cs @@ -11,15 +11,13 @@ public interface ILastFmService : IMusicService public class LastFmService : ILastFmService { - private IConfig _config; private readonly LastfmClient _client; private readonly string _username; public LastFmService(IConfig config) { - this._config = config; - this._client = new LastfmClient(this._config.Entries.LastFmApi.ApiKey); - this._username = this._config.Entries.LastFmApi.Username; + this._client = new LastfmClient(config.Entries.LastFmApi.ApiKey); + this._username = config.Entries.LastFmApi.Username; } public async Task<(bool IsPlaying, string? Bio)> GetCurrentlyPlayingStatus() diff --git a/TelegramMusicStatus/Services/Utils.cs b/TelegramMusicStatus/Services/Utils.cs index d025088..02169e1 100644 --- a/TelegramMusicStatus/Services/Utils.cs +++ b/TelegramMusicStatus/Services/Utils.cs @@ -1,5 +1,6 @@ using System.Text.RegularExpressions; using ImprovedConsole; +using Swan; namespace TelegramMusicStatus.Services; @@ -15,7 +16,7 @@ public static string FormatTrackInfo(string input) public static bool IsValidTrackInfoFormat(string input) { const string pattern = "^Now Playing: .+ - .+$"; - return Regex.IsMatch(input, pattern); + return Regex.IsMatch(input.Replace(".", ""), pattern); } public static string FormatStatus(string input) => input.Length <= _maxCharacters ? input :$"{input[..(_maxCharacters - 3)]}...".TrimEnd();