Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Oct 15, 2024
1 parent 6459495 commit 6ae3821
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/dv8tion/jda/api/JDA.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import net.dv8tion.jda.api.interactions.commands.Command;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
import net.dv8tion.jda.api.interactions.commands.build.Commands;
import net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData;
import net.dv8tion.jda.api.managers.AudioManager;
import net.dv8tion.jda.api.managers.DirectAudioController;
import net.dv8tion.jda.api.managers.Presence;
Expand Down Expand Up @@ -773,6 +774,7 @@ default CommandCreateAction upsertCommand(@Nonnull String name, @Nonnull String
/**
* Configures the complete list of global commands.
* <br>This will replace the existing command list for this bot. You should only use this once on startup!
* <br>If your bot has activities enabled, you <b>must</b> {@link GlobalCommandListUpdateAction#setEntryPointCommand(EntryPointCommandData) set your entry point command}.
*
* <p>This operation is idempotent.
* Commands will persist between restarts of your bot, you only have to create a command once.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,25 @@ public static CommandData context(@Nonnull Command.Type type, @Nonnull String na
return new CommandDataImpl(type, name);
}

//TODO docs
/**
* Create an activity entry point command builder.
*
* <p>Only one entry point can be created per app.
*
* @param name
* The entry point name, 1-32 lowercase alphanumeric characters
* @param description
* The entry point description, 1-100 characters
*
* @throws IllegalArgumentException
* If any of the following requirements are not met
* <ul>
* <li>The name must be lowercase alphanumeric (with dash), 1-32 characters long</li>
* <li>The description must be 1-100 characters long</li>
* </ul>
*
* @return {@link EntryPointCommandData} builder for the app's activity entry point command
*/
@Nonnull
public static EntryPointCommandData entryPoint(@Nonnull String name, @Nonnull String description)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
import net.dv8tion.jda.api.interactions.commands.build.attributes.*;
import net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction;
import net.dv8tion.jda.api.requests.restaction.GlobalCommandListUpdateAction;
import net.dv8tion.jda.api.utils.data.DataObject;
import net.dv8tion.jda.api.utils.data.SerializableData;

Expand All @@ -29,9 +30,11 @@

/**
* Builder for Entry Point Commands.
* <br>Use the factory methods provided by {@link Commands} to create instances of this interface.
* <br>Use {@link Commands#entryPoint(String, String)} to create instances of this interface.
*
* @see Commands
* <p>This command can only be added via {@link GlobalCommandListUpdateAction#setEntryPointCommand(EntryPointCommandData)}.
*
* @see Commands#entryPoint(String, String)
*/
public interface EntryPointCommandData
extends IDescribedCommandData, INamedCommandData, IScopedCommandData, IRestrictedCommandData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
/**
* Specialized {@link RestAction} used to replace existing commands globally.
* <br>Any commands that currently exist and are not listed through {@link #addCommands(CommandData...)} will be <b>DELETED</b>!
* <br>If your bot has activities enabled, you <b>must</b> {@link #setEntryPointCommand(EntryPointCommandData) set your entry point command}.
*
* <p>This operation is idempotent. Commands will persist between restarts of your bot, you only have to create a command once.
*/
Expand Down Expand Up @@ -65,7 +66,16 @@ public interface GlobalCommandListUpdateAction extends CommandListUpdateAction
@CheckReturnValue
GlobalCommandListUpdateAction addCommands(@Nonnull CommandData... commands);

//TODO docs
/**
* Sets your app's activity primary entry point.
* <br>This <b>must</b> be set if your application has activities enabled.
* <br>Using this with activities disabled will not make the entry point appear.
*
* @param entryPoint
* The entry point data
*
* @return This instance, for chaining
*/
@Nonnull
@CheckReturnValue
GlobalCommandListUpdateAction setEntryPointCommand(@Nonnull EntryPointCommandData entryPoint);
Expand Down

0 comments on commit 6ae3821

Please sign in to comment.