Class GuildAction.ChannelData

  • All Implemented Interfaces:
    org.json.JSONString
    Enclosing class:
    GuildAction

    public static class GuildAction.ChannelData
    extends java.lang.Object
    implements org.json.JSONString
    Channel information used for the creation of Channels within the construction of a Guild via GuildAction.

    Use with GuildAction.addChannel(ChannelData).

    • Constructor Detail

      • ChannelData

        public ChannelData​(ChannelType type,
                           java.lang.String name)
        Constructs a data object containing information on a Channel to be used in the construction of a Guild!
        Parameters:
        type - The ChannelType of the resulting Channel
        This may be of type TEXT or VOICE!
        name - The name of the channel. This must be alphanumeric with underscores for type TEXT
        Throws:
        java.lang.IllegalArgumentException -
        • If provided with an invalid ChannelType
        • If the provided name is null or blank
        • If the provided name is not between 2-100 characters long
        • If the type is TEXT and the provided name is not alphanumeric with underscores
    • Method Detail

      • setTopic

        public GuildAction.ChannelData setTopic​(java.lang.String topic)
        Sets the topic for this channel.
        These are only relevant to channels of type TEXT.
        Parameters:
        topic - The topic for the channel
        Returns:
        This ChannelData instance for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided topic is bigger than 1024 characters
      • setNSFW

        public GuildAction.ChannelData setNSFW​(java.lang.Boolean nsfw)
        Sets the whether this channel should be marked NSFW.
        These are only relevant to channels of type TEXT.
        Parameters:
        nsfw - Whether this channel should be marked NSFW
        Returns:
        This ChannelData instance for chaining convenience
      • setBitrate

        public GuildAction.ChannelData setBitrate​(java.lang.Integer bitrate)
        Sets the bitrate for this channel.
        These are only relevant to channels of type VOICE.
        Parameters:
        bitrate - The bitrate for the channel (8000-96000)
        Returns:
        This ChannelData instance for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided bitrate is not between 8000-96000
      • setUserlimit

        public GuildAction.ChannelData setUserlimit​(java.lang.Integer userlimit)
        Sets the userlimit for this channel.
        These are only relevant to channels of type VOICE.
        Parameters:
        userlimit - The userlimit for the channel (0-99)
        Returns:
        This ChannelData instance for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided userlimit is not between 0-99
      • setPosition

        public GuildAction.ChannelData setPosition​(java.lang.Integer position)
        Sets the position for this channel.
        Parameters:
        position - The position for the channel
        Returns:
        This ChannelData instance for chaining convenience
      • addPermissionOverride

        public GuildAction.ChannelData addPermissionOverride​(GuildAction.RoleData role,
                                                             long allow,
                                                             long deny)
        Adds a PermissionOverride to this channel with the provided RoleData!
        Use GuildAction.newRole() to retrieve an instance of RoleData.
        Parameters:
        role - The target role
        allow - The permissions to grant in the override
        deny - The permissions to deny in the override
        Returns:
        This ChannelData instance for chaining convenience
        Throws:
        java.lang.IllegalArgumentException -
        • If the provided role is null
        • If the provided allow value is negative or exceeds maximum permissions
        • If the provided deny value is negative or exceeds maximum permissions
      • addPermissionOverride

        public GuildAction.ChannelData addPermissionOverride​(GuildAction.RoleData role,
                                                             @Nullable
                                                             java.util.Collection<Permission> allow,
                                                             @Nullable
                                                             java.util.Collection<Permission> deny)
        Adds a PermissionOverride to this channel with the provided RoleData!
        Use GuildAction.newRole() to retrieve an instance of RoleData.
        Parameters:
        role - The target role
        allow - The permissions to grant in the override
        deny - The permissions to deny in the override
        Returns:
        This ChannelData instance for chaining convenience
        Throws:
        java.lang.IllegalArgumentException -
        • If the provided role is null
        • If any permission is null
      • toJSONString

        public java.lang.String toJSONString()
        Specified by:
        toJSONString in interface org.json.JSONString