Package upgrades

- Upgraded all packages to latest version
- Removed obsolete code due to version upgrade
- More nullref warnings silenced
This commit is contained in:
Kwoth
2021-06-18 04:49:32 +02:00
parent 38c7f32a76
commit 9f6d4ab62f
8 changed files with 39 additions and 247 deletions

View File

@@ -74,7 +74,7 @@ namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers
if (!res.IsSuccessStatusCode)
continue;
var userData = JsonConvert.DeserializeObject<PicartoChannelResponse>(await res.Content.ReadAsStringAsync());
var userData = JsonConvert.DeserializeObject<PicartoChannelResponse>(await res.Content.ReadAsStringAsync())!;
toReturn.Add(ToStreamData(userData));
_failingStreams.TryRemove(login, out _);

View File

@@ -72,7 +72,7 @@ namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers
// get id based on the username
var idsStr = await http.GetStringAsync($"https://api.twitch.tv/kraken/users?login={login}");
var userData = JsonConvert.DeserializeObject<TwitchUsersResponseV5>(idsStr);
var user = userData.Users.FirstOrDefault();
var user = userData?.Users.FirstOrDefault();
// if user can't be found, skip, it means there is no such user
if (user is null)
@@ -84,11 +84,11 @@ namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers
JsonConvert.DeserializeAnonymousType(str, new {Stream = new TwitchResponseV5.Stream()});
// if stream is null, user is not streaming
if (resObj.Stream is null)
if (resObj?.Stream is null)
{
// if user is not streaming, get his offline banner
var chStr = await http.GetStringAsync($"https://api.twitch.tv/kraken/channels/{user.Id}");
var ch = JsonConvert.DeserializeObject<TwitchResponseV5.Channel>(chStr);
var ch = JsonConvert.DeserializeObject<TwitchResponseV5.Channel>(chStr)!;
toReturn.Add(new StreamData
{