Fixed twitch stream, and response messages.
This commit is contained in:
parent
bc3010cef2
commit
798567ee5d
@ -109,13 +109,13 @@ namespace NadekoBot.Modules.Searches.Commands
|
||||
cachedStatuses.TryAdd(hitboxUrl, result);
|
||||
return result;
|
||||
case StreamNotificationConfig.StreamType.Twitch:
|
||||
var twitchUrl = $"https://api.twitch.tv/kraken/streams/{Uri.EscapeUriString(stream.Username)}";
|
||||
var twitchUrl = $"https://api.twitch.tv/kraken/streams/{Uri.EscapeUriString(stream.Username)}?client_id=67w6z9i09xv2uoojdm9l0wsyph4hxo6";
|
||||
if (checkCache && cachedStatuses.TryGetValue(twitchUrl, out result))
|
||||
return result;
|
||||
response = await SearchHelper.GetResponseStringAsync(twitchUrl).ConfigureAwait(false);
|
||||
data = JObject.Parse(response);
|
||||
isLive = !string.IsNullOrWhiteSpace(data["stream"].ToString());
|
||||
result = new Tuple<bool, string>(isLive, isLive ? data["stream"]["viewers"].ToString() : "0");
|
||||
result = new Tuple<bool, string>(isLive, isLive ? data["stream"]["viewers"].ToString() : stream.Username);
|
||||
cachedStatuses.TryAdd(twitchUrl, result);
|
||||
return result;
|
||||
case StreamNotificationConfig.StreamType.Beam:
|
||||
@ -131,7 +131,7 @@ namespace NadekoBot.Modules.Searches.Commands
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new Tuple<bool, string>(false, "0");
|
||||
return new Tuple<bool, string>(false, "NOT_FOUND");
|
||||
}
|
||||
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
@ -180,7 +180,11 @@ namespace NadekoBot.Modules.Searches.Commands
|
||||
}));
|
||||
if (streamStatus.Item1)
|
||||
{
|
||||
await e.Channel.SendMessage($"`Streamer {streamStatus.Item2} is online.`");
|
||||
await e.Channel.SendMessage($"`Streamer {stream} is online with {streamStatus.Item2} viewers.`");
|
||||
}
|
||||
else
|
||||
{
|
||||
await e.Channel.SendMessage($"`Streamer {stream} is offline.`");
|
||||
}
|
||||
}
|
||||
catch
|
||||
@ -209,7 +213,11 @@ namespace NadekoBot.Modules.Searches.Commands
|
||||
}));
|
||||
if (streamStatus.Item1)
|
||||
{
|
||||
await e.Channel.SendMessage($"`Streamer {streamStatus.Item2} is online.`");
|
||||
await e.Channel.SendMessage($"`Streamer {stream} is online with {streamStatus.Item2} viewers.`");
|
||||
}
|
||||
else
|
||||
{
|
||||
await e.Channel.SendMessage($"`Streamer {stream} is offline.`");
|
||||
}
|
||||
}
|
||||
catch
|
||||
@ -238,7 +246,11 @@ namespace NadekoBot.Modules.Searches.Commands
|
||||
}));
|
||||
if (streamStatus.Item1)
|
||||
{
|
||||
await e.Channel.SendMessage($"`Streamer {streamStatus.Item2} is online.`");
|
||||
await e.Channel.SendMessage($"`Streamer {stream} is online with {streamStatus.Item2} viewers.`");
|
||||
}
|
||||
else
|
||||
{
|
||||
await e.Channel.SendMessage($"`Streamer {stream} is offline.`");
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
Loading…
Reference in New Issue
Block a user