use of org.javacord.core.entity.channel.ChannelCategoryImpl in project Javacord by BtoBastian.
the class ServerImpl method getOrCreateChannelCategory.
/**
* Gets or creates a channel category.
*
* @param data The json data of the channel.
* @return The server text channel.
*/
public ChannelCategory getOrCreateChannelCategory(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
ChannelType type = ChannelType.fromId(data.get("type").asInt());
synchronized (this) {
if (type == ChannelType.CHANNEL_CATEGORY) {
return getChannelCategoryById(id).orElseGet(() -> new ChannelCategoryImpl(api, this, data));
}
}
// Invalid channel type
return null;
}
Aggregations