Skip to content

Commit

Permalink
Nullable parent string ID nullable for categorizable channels (#1993)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanduhr32 committed Jan 19, 2022
1 parent eb510ed commit 62d7bb5
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -32,10 +32,20 @@ public interface ICategorizableChannel extends GuildChannel, IPermissionContaine
//TODO-v5: Docs
long getParentCategoryIdLong();

//TODO-v5: Docs
/**
* Get the snowflake of the {@link net.dv8tion.jda.api.entities.Category Category} that contains this channel.
*
* This will return {@code null} if this channel doesn't have a parent category.
*
* @return Possibly-null String representation of the Discord ID snowflake of the parent channel.
*/
@Nullable
default String getParentCategoryId()
{
return Long.toUnsignedString(getParentCategoryIdLong());
long parentID = getParentCategoryIdLong();
if (parentID == 0L)
return null;
return Long.toUnsignedString(parentID);
}

/**
Expand Down

0 comments on commit 62d7bb5

Please sign in to comment.