Class RoleImpl

java.lang.Object
com.mewna.catnip.entity.impl.guild.RoleImpl
All Implemented Interfaces:
Entity, Role, GuildEntity, HasGuild, HasName, Mentionable, Permissable, Snowflake, Timestamped, RequiresCatnip, Comparable<Role>

public class RoleImpl extends Object implements Role, RequiresCatnip
Since:
9/2/18
Author:
Julia Rogers
  • Constructor Details

    • RoleImpl

      public RoleImpl()
    • RoleImpl

      public RoleImpl(Catnip catnip, long idAsLong, long guildIdAsLong, String name, int color, boolean hoist, int position, long permissionsRaw, boolean managed, boolean mentionable, RoleTags tags, String icon, String unicodeEmoji)
  • Method Details

    • catnip

      public void catnip(@Nonnull Catnip catnip)
      Specified by:
      catnip in interface RequiresCatnip
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static RoleImpl.RoleImplBuilder builder()
    • catnip

      public Catnip catnip()
      Description copied from interface: Entity
      Returns the catnip instance associated with this entity.
      Specified by:
      catnip in interface Entity
      Returns:
      The catnip instance of this entity.
    • idAsLong

      public long idAsLong()
      Description copied from interface: Snowflake
      The ID of this snowflake, as a long.
      Specified by:
      idAsLong in interface Snowflake
      Returns:
      Long representing the ID.
    • guildIdAsLong

      public long guildIdAsLong()
      Description copied from interface: HasGuild
      The id of the guild this entity is from.
      Specified by:
      guildIdAsLong in interface HasGuild
      Returns:
      Long representing the guild ID.
    • name

      public String name()
      Specified by:
      name in interface HasName
    • color

      public int color()
      Description copied from interface: Role
      Integer representation of the role color.
      To use this, you must convert the integer to base-16, hex, format. The default role color is 0.
      Specified by:
      color in interface Role
      Returns:
      The integer representation of the role color. Never null.
    • hoist

      public boolean hoist()
      Description copied from interface: Role
      Whether or not the role "hoists" users with it into a group in the user list.
      Specified by:
      hoist in interface Role
      Returns:
      True if the role is grouped and hoisted, false otherwise.
    • position

      public int position()
      Description copied from interface: Role
      Position of the role within the guild it's from.

      Note: Raw positions fetched from Discord are a bit weird and may confuse you sometimes.

      Specified by:
      position in interface Role
      Returns:
      The position of the role within its guild's role hierarchy.
    • permissionsRaw

      public long permissionsRaw()
      Description copied from interface: Role
      Permissions this role grants users in the guild.
      Channels may override and add to or remove from this.
      Specified by:
      permissionsRaw in interface Permissable
      Specified by:
      permissionsRaw in interface Role
      Returns:
      Bit set of permissions granted by this role.
    • managed

      public boolean managed()
      Description copied from interface: Role
      Whether or not this role is managed by a 3rd party connection.
      Most often, this is seen on bots which were added using a permission parameter in their invite link.
      If true, this role cannot be modified by users through normal means.
      Specified by:
      managed in interface Role
      Returns:
      True if the role is managed, false otherwise.
    • mentionable

      public boolean mentionable()
      Description copied from interface: Role
      Whether or not mentioning this role will effectively mention those with it.
      Roles can always be mentioned, but will not mention users with it unless this is true.
      Specified by:
      mentionable in interface Role
      Returns:
      True if the role is mentionable, false otherwise.
    • tags

      public RoleTags tags()
      Description copied from interface: Role
      The tags for this role. Role tags are things like:
      1. Whether or not this is the Nitro boost role.
      2. Whether or not this is a bot-specific role.
      3. Whether or not this is an integration-specific role.
      Specified by:
      tags in interface Role
      Returns:
      The tags for this role.
    • icon

      public String icon()
      Description copied from interface: Role
      This role's icon hash. Use with CDNFormat.roleIconUrl(String, String, ImageOptions). This property is only non-nullable if the guild has the GuildFeature.ROLE_ICONS feature.
      Specified by:
      icon in interface Role
    • unicodeEmoji

      public String unicodeEmoji()
      Specified by:
      unicodeEmoji in interface Role
      See Also:
    • idAsLong

      public RoleImpl idAsLong(long idAsLong)
      Returns:
      this.
    • guildIdAsLong

      public RoleImpl guildIdAsLong(long guildIdAsLong)
      Returns:
      this.
    • name

      public RoleImpl name(String name)
      Returns:
      this.
    • color

      public RoleImpl color(int color)
      Returns:
      this.
    • hoist

      public RoleImpl hoist(boolean hoist)
      Returns:
      this.
    • position

      public RoleImpl position(int position)
      Returns:
      this.
    • permissionsRaw

      public RoleImpl permissionsRaw(long permissionsRaw)
      Returns:
      this.
    • managed

      public RoleImpl managed(boolean managed)
      Returns:
      this.
    • mentionable

      public RoleImpl mentionable(boolean mentionable)
      Returns:
      this.
    • tags

      public RoleImpl tags(RoleTags tags)
      Returns:
      this.
    • icon

      public RoleImpl icon(String icon)
      Returns:
      this.
    • unicodeEmoji

      public RoleImpl unicodeEmoji(String unicodeEmoji)
      Returns:
      this.