Search in sources :

Example 1 with FullResult

use of chatty.util.UrlRequest.FullResult in project chatty by chatty.

the class WebsocketManager method fetchEmoteSet.

/**
 * Get the emotes from a specific emoteset, useable in the given room.
 *
 * @param room The channel the emotes should be useable in
 * @param emoteset The FFZ emoteset to fetch
 * @return A set of emotes or an empty set if an error occured
 */
private Set<Emoticon> fetchEmoteSet(String room, int emoteset) {
    UrlRequest r = new UrlRequest("https://api.frankerfacez.com/v1/set/" + emoteset);
    FullResult result = r.sync();
    if (result.getResult() != null) {
        Set<Emoticon> emotes = FrankerFaceZParsing.parseSetEmotes(result.getResult(), Emoticon.SubType.EVENT, room);
        return emotes;
    }
    return new HashSet<>();
}
Also used : Emoticon(chatty.util.api.Emoticon) UrlRequest(chatty.util.UrlRequest) FullResult(chatty.util.UrlRequest.FullResult) HashSet(java.util.HashSet)

Aggregations

UrlRequest (chatty.util.UrlRequest)1 FullResult (chatty.util.UrlRequest.FullResult)1 Emoticon (chatty.util.api.Emoticon)1 HashSet (java.util.HashSet)1