diff --git a/sigIRCv2.jar b/sigIRCv2.jar index d5cbb4c..2b683d3 100644 Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ diff --git a/src/sig/modules/TwitchModule.java b/src/sig/modules/TwitchModule.java index a45e30a..d1a41c7 100644 --- a/src/sig/modules/TwitchModule.java +++ b/src/sig/modules/TwitchModule.java @@ -209,12 +209,14 @@ public class TwitchModule extends Module{ FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/streams?user_id="+sigIRC.channel_id, "stream_info",true); JSONObject streamInfo = FileUtils.readJsonFromFile("stream_info"); JSONArray streamData = streamInfo.getJSONArray("data"); - JSONObject stream = streamData.getJSONObject(0); streamOnline = streamData.length()!=0; - DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter - .ofPattern("uuuu-MM-dd'T'HH:mm:ssz"); - uptime = ZonedDateTime.parse(stream.getString("started_at"),DATE_TIME_FORMATTER); - viewers_numb.updateValue(stream.getInt("viewer_count")); + if (streamOnline) { + JSONObject stream = streamData.getJSONObject(0); + DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter + .ofPattern("uuuu-MM-dd'T'HH:mm:ssz"); + uptime = ZonedDateTime.parse(stream.getString("started_at"),DATE_TIME_FORMATTER); + viewers_numb.updateValue(stream.getInt("viewer_count")); + } FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/users/follows?to_id="+sigIRC.channel_id, "temp_followers",true); JSONObject FollowerData = FileUtils.readJsonFromFile("temp_followers"); JSONArray data = FollowerData.getJSONArray("data");