mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-13 02:38:27 -04:00
Applied codestyle to all .cs files
This commit is contained in:
@@ -21,7 +21,7 @@ public class SoundCloudApiService : INService
|
||||
{
|
||||
response = await http.GetStringAsync($"https://scapi.nadeko.bot/resolve?url={url}");
|
||||
}
|
||||
|
||||
|
||||
var responseObj = JsonConvert.DeserializeObject<SoundCloudVideo>(response);
|
||||
if (responseObj?.Kind != "track")
|
||||
throw new InvalidOperationException("Url is either not a track, or it doesn't exist.");
|
||||
@@ -37,12 +37,13 @@ public class SoundCloudApiService : INService
|
||||
var response = string.Empty;
|
||||
using (var http = _httpFactory.CreateClient())
|
||||
{
|
||||
response = await http.GetStringAsync(new Uri($"https://scapi.nadeko.bot/tracks?q={Uri.EscapeDataString(query)}"));
|
||||
response = await http.GetStringAsync(
|
||||
new Uri($"https://scapi.nadeko.bot/tracks?q={Uri.EscapeDataString(query)}"));
|
||||
}
|
||||
|
||||
var responseObj = JsonConvert.DeserializeObject<SoundCloudVideo[]>(response)
|
||||
.FirstOrDefault(s => s.Streamable is true);
|
||||
|
||||
.FirstOrDefault(s => s.Streamable is true);
|
||||
|
||||
if (responseObj?.Kind != "track")
|
||||
throw new InvalidOperationException("Query yielded no results.");
|
||||
|
||||
@@ -56,17 +57,22 @@ public class SoundCloudVideo
|
||||
public long Id { get; set; } = 0;
|
||||
public SoundCloudUser User { get; set; } = new();
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string FullName => User.Name + " - " + Title;
|
||||
|
||||
public string FullName
|
||||
=> User.Name + " - " + Title;
|
||||
|
||||
public bool? Streamable { get; set; } = false;
|
||||
public int Duration { get; set; }
|
||||
|
||||
[JsonProperty("permalink_url")]
|
||||
public string TrackLink { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("artwork_url")]
|
||||
public string ArtworkUrl { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public class SoundCloudUser
|
||||
{
|
||||
[JsonProperty("username")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user