Class WidgetUtil.Widget

  • All Implemented Interfaces:
    ISnowflake
    Enclosing class:
    WidgetUtil

    public static class WidgetUtil.Widget
    extends java.lang.Object
    implements ISnowflake
    • Method Detail

      • isAvailable

        public boolean isAvailable()
        Shows whether or not the widget for a guild is available. If this method returns false, all other values will be null
        Returns:
        True, if the widget is available, false otherwise
      • getIdLong

        public long getIdLong()
        Description copied from interface: ISnowflake
        The Snowflake id of this entity. This is unique to every entity and will never change.
        Specified by:
        getIdLong in interface ISnowflake
        Returns:
        Long containing the Id.
      • getName

        @Nonnull
        public java.lang.String getName()
        Gets the name of the guild
        Returns:
        the name of the guild
        Throws:
        java.lang.IllegalStateException - If the widget is not available
      • getInviteCode

        @Nullable
        public java.lang.String getInviteCode()
        Gets an invite code for the guild, or null if no invite channel is enabled in the widget
        Returns:
        an invite code for the guild, if widget invites are enabled
        Throws:
        java.lang.IllegalStateException - If the widget is not available
      • getVoiceChannels

        @Nonnull
        public java.util.List<WidgetUtil.Widget.VoiceChannel> getVoiceChannels()
        Gets the list of voice channels in the guild
        Returns:
        the list of voice channels in the guild
        Throws:
        java.lang.IllegalStateException - If the widget is not available
      • getVoiceChannelById

        @Nullable
        public WidgetUtil.Widget.VoiceChannel getVoiceChannelById​(java.lang.String id)
        Gets a voice channel with the given ID, or null if the voice channel is not found
        Parameters:
        id - the ID of the voice channel
        Returns:
        possibly-null VoiceChannel with the given ID.
        Throws:
        java.lang.IllegalStateException - If the widget is not available
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getVoiceChannelById

        @Nullable
        public WidgetUtil.Widget.VoiceChannel getVoiceChannelById​(long id)
        Gets a voice channel with the given ID, or null if the voice channel is not found
        Parameters:
        id - the ID of the voice channel
        Returns:
        possibly-null VoiceChannel with the given ID.
        Throws:
        java.lang.IllegalStateException - If the widget is not available
      • getMembers

        @Nonnull
        public java.util.List<WidgetUtil.Widget.Member> getMembers()
        Gets a list of online members in the guild
        Returns:
        the list of members
        Throws:
        java.lang.IllegalStateException - If the widget is not available
      • getMemberById

        @Nullable
        public WidgetUtil.Widget.Member getMemberById​(java.lang.String id)
        Gets a member with the given ID, or null if the member is not found
        Parameters:
        id - the ID of the member
        Returns:
        possibly-null Member with the given ID.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
        java.lang.IllegalStateException - If the widget is not available
      • getMemberById

        @Nullable
        public WidgetUtil.Widget.Member getMemberById​(long id)
        Gets a member with the given ID, or null if the member is not found
        Parameters:
        id - the ID of the member
        Returns:
        possibly-null Member with the given ID.
        Throws:
        java.lang.IllegalStateException - If the widget is not available
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object