Class ChannelAction

    • Constructor Detail

      • ChannelAction

        public ChannelAction​(net.dv8tion.jda.core.requests.Route.CompiledRoute route,
                             java.lang.String name,
                             Guild guild,
                             ChannelType type)
        Creates a new ChannelAction instance
        Parameters:
        route - The CompileRoute to use for this action
        name - The name for the new Channel
        guild - The Guild the channel should be created in
        type - What kind of channel should be created
    • Method Detail

      • setCheck

        public ChannelAction setCheck​(java.util.function.BooleanSupplier checks)
        Description copied from class: RestAction
        Sets the last-second checks before finally executing the http request in the queue.
        If the provided supplier evaluates to false or throws an exception this will not be finished. When an exception is thrown from the supplier it will be provided to the failure callback.
        Overrides:
        setCheck in class AuditableRestAction<Channel>
        Parameters:
        checks - The checks to run before executing the request, or null to run no checks
        Returns:
        The current RestAction for chaining convenience
      • setName

        @CheckReturnValue
        public ChannelAction setName​(java.lang.String name)
        Sets the name for the new Channel
        Parameters:
        name - The not-null name for the new Channel (1-100 chars long)
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided name is null or not between 1-100 chars long
      • setParent

        @CheckReturnValue
        public ChannelAction setParent​(Category category)
        Sets the Category for the new Channel
        Parameters:
        category - The parent for the new Channel
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.UnsupportedOperationException - If this ChannelAction is for a Category
        java.lang.IllegalArgumentException - If the provided category is null or not from this Guild
      • setTopic

        @CheckReturnValue
        public ChannelAction setTopic​(java.lang.String topic)
        Sets the topic for the new TextChannel
        Parameters:
        topic - The topic for the new Channel (max 1024 chars)
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.UnsupportedOperationException - If this ChannelAction is not for a TextChannel
        java.lang.IllegalArgumentException - If the provided topic is longer than 1024 chars
      • setNSFW

        @CheckReturnValue
        public ChannelAction setNSFW​(boolean nsfw)
        Sets the NSFW flag for the new TextChannel
        Parameters:
        nsfw - The NSFW flag for the new Channel
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.UnsupportedOperationException - If this ChannelAction is not for a TextChannel
      • setSlowmode

        @CheckReturnValue
        public ChannelAction setSlowmode​(int slowmode)
        Sets the slowmode value, which limits the amount of time that individual users must wait between sending messages in the new TextChannel. This is measured in seconds.

        Note that only CLIENT type accounts are affected by slowmode, and that BOT accounts are immune to the restrictions.
        Having MESSAGE_MANAGE or MANAGE_CHANNEL permission also grants immunity to slowmode.

        Parameters:
        slowmode - The number of seconds required to wait between sending messages in the channel.
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the slowmode is greater than 120, or less than 0
      • addPermissionOverride

        @CheckReturnValue
        public ChannelAction addPermissionOverride​(IPermissionHolder target,
                                                   java.util.Collection<Permission> allow,
                                                   java.util.Collection<Permission> deny)
        Adds a new Role or Member PermissionOverride for the new Channel.

        Example:

        
         Role role = guild.getPublicRole();
         EnumSet<Permission> allow = EnumSet.of(Permission.MESSAGE_READ);
         EnumSet<Permission> deny = EnumSet.of(Permission.MESSAGE_WRITE);
         channelAction.addPermissionOverride(role, allow, deny);
         
        Parameters:
        target - The not-null Role or Member for the override
        allow - The granted Permissions for the override or null
        deny - The denied Permissions for the override or null
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the specified target is null or not within the same guild.
        See Also:
        EnumSet
      • setBitrate

        @CheckReturnValue
        public ChannelAction setBitrate​(java.lang.Integer bitrate)
        Sets the bitrate for the new VoiceChannel
        Parameters:
        bitrate - The bitrate for the new Channel (min 8000; max 96000/128000 (for VIP Guilds)) or null to use default (64000)
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.UnsupportedOperationException - If this ChannelAction is not for a VoiceChannel
        java.lang.IllegalArgumentException - If the provided bitrate is less than 8000 or greater than 128000
      • setUserlimit

        @CheckReturnValue
        public ChannelAction setUserlimit​(java.lang.Integer userlimit)
        Sets the userlimit for the new VoiceChannel
        Parameters:
        userlimit - The userlimit for the new VoiceChannel or null/0 to use no limit,
        Returns:
        The current ChannelAction, for chaining convenience
        Throws:
        java.lang.UnsupportedOperationException - If this ChannelAction is not for a VoiceChannel
        java.lang.IllegalArgumentException - If the provided userlimit is negative or above 99