package com.nincraft.ninbot.components.twitch;

import com.github.twitch4j.helix.TwitchHelix;
import lombok.extern.log4j.Log4j2;
import lombok.val;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
@Log4j2
public class TwitchAPI {

    private TwitchHelix twitchHelix;

    public TwitchAPI(TwitchHelix twitchHelix) {
        this.twitchHelix = twitchHelix;
    }

    String getBoxArtUrl(String gameName) {
        try {
            val gameResults = twitchHelix.getGames(null, Arrays.asList(gameName), null).execute();
            if (gameResults.getGames().isEmpty()) {
                return null;
            } else {
                String boxartUrl = gameResults.getGames().get(0).getBoxArtUrl();
                return boxartUrl.replace("-{width}x{height}", "");
            }
        } catch (Exception e) {
            log.error("Failed to get boxart from Twitch API", e);
            return null;
        }
    }
}

@@ -508,16 +508,22 @@
 es(null,
+ null,
  Arrays.
@@ -538,22 +538,16 @@
 ameName)
-, null
 ).execut

Fix twitch api call for boxart