diff --git a/src/main/java/net/dv8tion/jda/api/JDA.java b/src/main/java/net/dv8tion/jda/api/JDA.java
index 7f50e3b45c..6557c74fde 100644
--- a/src/main/java/net/dv8tion/jda/api/JDA.java
+++ b/src/main/java/net/dv8tion/jda/api/JDA.java
@@ -32,6 +32,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;
@@ -775,6 +776,7 @@ default CommandCreateAction upsertCommand(@Nonnull String name, @Nonnull String
/**
* Configures the complete list of global commands.
*
This will replace the existing command list for this bot. You should only use this once on startup!
+ *
If your bot has activities enabled, you must {@link GlobalCommandListUpdateAction#setEntryPointCommand(EntryPointCommandData) set your entry point command}.
*
*
This operation is idempotent.
* Commands will persist between restarts of your bot, you only have to create a command once.
@@ -799,13 +801,13 @@ default CommandCreateAction upsertCommand(@Nonnull String name, @Nonnull String
* jda.updateCommands().queue();
* }
*
- * @return {@link CommandListUpdateAction}
+ * @return {@link GlobalCommandListUpdateAction}
*
* @see Guild#updateCommands()
*/
@Nonnull
@CheckReturnValue
- CommandListUpdateAction updateCommands();
+ GlobalCommandListUpdateAction updateCommands();
/**
* Edit an existing global command by id.
diff --git a/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java b/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java
index d7391675f0..3716611698 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java
@@ -425,7 +425,7 @@ enum Flag
GATEWAY_GUILD_MEMBERS_LIMITED(1 << 15),
/** Indicates unusual growth of an app that prevents verification */
VERIFICATION_PENDING_GUILD_LIMIT(1 << 16),
- /** Indicates if an app is embedded within the Discord client (currently unavailable publicly) */
+ /** Indicates if an app is embedded within the Discord client, or is an app with an Activity */
EMBEDDED(1 << 17),
/** Bot can use {@link net.dv8tion.jda.api.requests.GatewayIntent#MESSAGE_CONTENT GatewayIntent.MESSAGE_CONTENT} in 100 or more guilds */
GATEWAY_MESSAGE_CONTENT(1 << 18),
diff --git a/src/main/java/net/dv8tion/jda/api/events/interaction/ModalInteractionEvent.java b/src/main/java/net/dv8tion/jda/api/events/interaction/ModalInteractionEvent.java
index 36224ec2cf..e8825be6af 100644
--- a/src/main/java/net/dv8tion/jda/api/events/interaction/ModalInteractionEvent.java
+++ b/src/main/java/net/dv8tion/jda/api/events/interaction/ModalInteractionEvent.java
@@ -23,6 +23,7 @@
import net.dv8tion.jda.api.interactions.modals.Modal;
import net.dv8tion.jda.api.interactions.modals.ModalInteraction;
import net.dv8tion.jda.api.interactions.modals.ModalMapping;
+import net.dv8tion.jda.api.requests.restaction.interactions.LaunchActivityCallbackAction;
import net.dv8tion.jda.api.requests.restaction.interactions.MessageEditCallbackAction;
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
@@ -101,6 +102,14 @@ public MessageEditCallbackAction deferEdit()
return interaction.deferEdit();
}
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ public LaunchActivityCallbackAction replyWithLaunchedActivity()
+ {
+ return interaction.replyWithLaunchedActivity();
+ }
+
@Nonnull
@Override
public MessageChannelUnion getChannel()
diff --git a/src/main/java/net/dv8tion/jda/api/events/interaction/command/GenericCommandInteractionEvent.java b/src/main/java/net/dv8tion/jda/api/events/interaction/command/GenericCommandInteractionEvent.java
index 7a0c4ef531..4c2ab2ae1b 100644
--- a/src/main/java/net/dv8tion/jda/api/events/interaction/command/GenericCommandInteractionEvent.java
+++ b/src/main/java/net/dv8tion/jda/api/events/interaction/command/GenericCommandInteractionEvent.java
@@ -23,6 +23,7 @@
import net.dv8tion.jda.api.interactions.commands.CommandInteraction;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.modals.Modal;
+import net.dv8tion.jda.api.requests.restaction.interactions.LaunchActivityCallbackAction;
import net.dv8tion.jda.api.requests.restaction.interactions.ModalCallbackAction;
import net.dv8tion.jda.api.requests.restaction.interactions.PremiumRequiredCallbackAction;
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
@@ -131,4 +132,12 @@ public PremiumRequiredCallbackAction replyWithPremiumRequired()
{
return getInteraction().replyWithPremiumRequired();
}
+
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ public LaunchActivityCallbackAction replyWithLaunchedActivity()
+ {
+ return getInteraction().replyWithLaunchedActivity();
+ }
}
diff --git a/src/main/java/net/dv8tion/jda/api/events/interaction/command/PrimaryEntryPointInteractionEvent.java b/src/main/java/net/dv8tion/jda/api/events/interaction/command/PrimaryEntryPointInteractionEvent.java
new file mode 100644
index 0000000000..d9a930e999
--- /dev/null
+++ b/src/main/java/net/dv8tion/jda/api/events/interaction/command/PrimaryEntryPointInteractionEvent.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dv8tion.jda.api.events.interaction.command;
+
+import net.dv8tion.jda.api.JDA;
+import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
+import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
+import net.dv8tion.jda.api.interactions.commands.PrimaryEntryPointInteraction;
+import net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData;
+import net.dv8tion.jda.api.requests.restaction.GlobalCommandListUpdateAction;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Indicates that an activity entry point was used in a {@link MessageChannel}.
+
+ *
This interaction requires activities to be enabled,
+ * and an {@link GlobalCommandListUpdateAction#setEntryPointCommand(EntryPointCommandData) entry point}
+ * with its {@link EntryPointCommandData#setHandler(EntryPointCommandData.Handler) handler}
+ * set to {@link EntryPointCommandData.Handler#APP_HANDLER APP_HANDLER} to be configured.
+ *
+ *
Requirements
+ * To receive these events, you must unset the Interactions Endpoint URL in your application dashboard.
+ * You can simply remove the URL for this endpoint in your settings at the Discord Developers Portal.
+ *
+ * @see PrimaryEntryPointInteraction
+ */
+public class PrimaryEntryPointInteractionEvent extends GenericCommandInteractionEvent implements PrimaryEntryPointInteraction
+{
+ private final PrimaryEntryPointInteraction interaction;
+
+ public PrimaryEntryPointInteractionEvent(@Nonnull JDA api, long responseNumber, @Nonnull PrimaryEntryPointInteraction interaction)
+ {
+ super(api, responseNumber, interaction);
+ this.interaction = interaction;
+ }
+
+ @Nonnull
+ @Override
+ public PrimaryEntryPointInteraction getInteraction()
+ {
+ return interaction;
+ }
+
+ @Nonnull
+ @Override
+ public MessageChannelUnion getChannel()
+ {
+ return interaction.getChannel();
+ }
+}
diff --git a/src/main/java/net/dv8tion/jda/api/events/interaction/component/GenericComponentInteractionCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/interaction/component/GenericComponentInteractionCreateEvent.java
index a470852bea..763910f11d 100644
--- a/src/main/java/net/dv8tion/jda/api/events/interaction/component/GenericComponentInteractionCreateEvent.java
+++ b/src/main/java/net/dv8tion/jda/api/events/interaction/component/GenericComponentInteractionCreateEvent.java
@@ -25,10 +25,7 @@
import net.dv8tion.jda.api.interactions.components.Component;
import net.dv8tion.jda.api.interactions.components.ComponentInteraction;
import net.dv8tion.jda.api.interactions.modals.Modal;
-import net.dv8tion.jda.api.requests.restaction.interactions.MessageEditCallbackAction;
-import net.dv8tion.jda.api.requests.restaction.interactions.ModalCallbackAction;
-import net.dv8tion.jda.api.requests.restaction.interactions.PremiumRequiredCallbackAction;
-import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
+import net.dv8tion.jda.api.requests.restaction.interactions.*;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
@@ -138,4 +135,12 @@ public PremiumRequiredCallbackAction replyWithPremiumRequired()
{
return interaction.replyWithPremiumRequired();
}
+
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ public LaunchActivityCallbackAction replyWithLaunchedActivity()
+ {
+ return interaction.replyWithLaunchedActivity();
+ }
}
diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java
index 81e5ae6a49..a5722bbf8a 100644
--- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java
+++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java
@@ -149,6 +149,7 @@ public void onException(@Nonnull ExceptionEvent event) {}
public void onSlashCommandInteraction(@Nonnull SlashCommandInteractionEvent event) {}
public void onUserContextInteraction(@Nonnull UserContextInteractionEvent event) {}
public void onMessageContextInteraction(@Nonnull MessageContextInteractionEvent event) {}
+ public void onPrimaryEntryPointInteraction(@Nonnull PrimaryEntryPointInteractionEvent event) {}
public void onButtonInteraction(@Nonnull ButtonInteractionEvent event) {}
public void onCommandAutoCompleteInteraction(@Nonnull CommandAutoCompleteInteractionEvent event) {}
public void onModalInteraction(@Nonnull ModalInteractionEvent event) {}
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/Interaction.java b/src/main/java/net/dv8tion/jda/api/interactions/Interaction.java
index 9f2e154d5e..bae15d8fe4 100644
--- a/src/main/java/net/dv8tion/jda/api/interactions/Interaction.java
+++ b/src/main/java/net/dv8tion/jda/api/interactions/Interaction.java
@@ -48,6 +48,8 @@
*
Which supports choice suggestions for auto-complete interactions via {@link IAutoCompleteCallback#replyChoices(Command.Choice...)}
*
Once the interaction is acknowledged, you can not reply with these methods again. If the interaction is a {@link IDeferrableCallback deferrable}, diff --git a/src/main/java/net/dv8tion/jda/api/interactions/callbacks/ILaunchActivityReplyCallback.java b/src/main/java/net/dv8tion/jda/api/interactions/callbacks/ILaunchActivityReplyCallback.java new file mode 100644 index 0000000000..92263241ce --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/interactions/callbacks/ILaunchActivityReplyCallback.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.interactions.callbacks; + +import net.dv8tion.jda.api.requests.restaction.interactions.LaunchActivityCallbackAction; + +import javax.annotation.CheckReturnValue; +import javax.annotation.Nonnull; + +/** + * Callback which launches this app's activity. + * + *
Replying with {@link #replyWithLaunchedActivity()} will automatically acknowledge this interaction. + * + *
Note:This interaction requires activities to be enabled. + */ +public interface ILaunchActivityReplyCallback extends IDeferrableCallback +{ + /** + * Launches this app's activity and acknowledges this interaction. + * + * @return {@link LaunchActivityCallbackAction} + */ + @Nonnull + @CheckReturnValue + LaunchActivityCallbackAction replyWithLaunchedActivity(); +} diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/Command.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/Command.java index 2b1c1c3798..57f82e7200 100644 --- a/src/main/java/net/dv8tion/jda/api/interactions/commands/Command.java +++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/Command.java @@ -22,6 +22,7 @@ import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.interactions.DiscordLocale; import net.dv8tion.jda.api.interactions.commands.build.CommandData; +import net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData; import net.dv8tion.jda.api.interactions.commands.localization.LocalizationMap; import net.dv8tion.jda.api.interactions.commands.privileges.IntegrationPrivilege; import net.dv8tion.jda.api.requests.RestAction; @@ -146,6 +147,14 @@ public interface Command extends ISnowflake, ICommandReference @Nonnull LocalizationMap getDescriptionLocalizations(); + /** + * The handler, if this is an {@link EntryPointCommandData entry point command}. + * + * @return The entry point handler + */ + @Nullable + EntryPointCommandData.Handler getHandler(); + /** * The {@link Option Options} of this command. * @@ -249,7 +258,8 @@ enum Type UNKNOWN(-1), SLASH(1), USER(2), - MESSAGE(3); + MESSAGE(3), + PRIMARY_ENTRY_POINT(4); private final int id; diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/CommandInteraction.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/CommandInteraction.java index d0a87b1ed5..1940f0a5d4 100644 --- a/src/main/java/net/dv8tion/jda/api/interactions/commands/CommandInteraction.java +++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/CommandInteraction.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.api.interactions.commands; +import net.dv8tion.jda.api.interactions.callbacks.ILaunchActivityReplyCallback; import net.dv8tion.jda.api.interactions.callbacks.IModalCallback; import net.dv8tion.jda.api.interactions.callbacks.IPremiumRequiredReplyCallback; import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback; @@ -29,6 +30,6 @@ * @see ContextInteraction * @see SlashCommandInteraction */ -public interface CommandInteraction extends IReplyCallback, CommandInteractionPayload, IModalCallback, IPremiumRequiredReplyCallback +public interface CommandInteraction extends IReplyCallback, CommandInteractionPayload, IModalCallback, IPremiumRequiredReplyCallback, ILaunchActivityReplyCallback { } diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/PrimaryEntryPointInteraction.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/PrimaryEntryPointInteraction.java new file mode 100644 index 0000000000..d528ff1abf --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/PrimaryEntryPointInteraction.java @@ -0,0 +1,51 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.interactions.commands; + +import net.dv8tion.jda.api.entities.channel.unions.GuildMessageChannelUnion; +import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion; +import net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData; +import net.dv8tion.jda.api.requests.restaction.GlobalCommandListUpdateAction; + +import javax.annotation.Nonnull; + +/** + * Interaction to launch your app's activity. + * + *
Note: This interaction requires activities to be enabled,
+ * and an {@link GlobalCommandListUpdateAction#setEntryPointCommand(EntryPointCommandData) entry point}
+ * with its {@link EntryPointCommandData#setHandler(EntryPointCommandData.Handler) handler}
+ * set to {@link EntryPointCommandData.Handler#APP_HANDLER APP_HANDLER} to be configured.
+ */
+public interface PrimaryEntryPointInteraction extends CommandInteraction
+{
+ /**
+ * The respective {@link MessageChannelUnion} for this interaction.
+ *
+ * @return The {@link MessageChannelUnion}
+ */
+ @Nonnull
+ @Override
+ MessageChannelUnion getChannel();
+
+ @Nonnull
+ @Override
+ default GuildMessageChannelUnion getGuildChannel()
+ {
+ return (GuildMessageChannelUnion) CommandInteraction.super.getGuildChannel();
+ }
+}
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/CommandData.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/CommandData.java
index e1122a060b..99330e5746 100644
--- a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/CommandData.java
+++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/CommandData.java
@@ -19,8 +19,11 @@
import net.dv8tion.jda.api.interactions.DiscordLocale;
import net.dv8tion.jda.api.interactions.commands.Command;
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
+import net.dv8tion.jda.api.interactions.commands.build.attributes.IAgeRestrictedCommandData;
+import net.dv8tion.jda.api.interactions.commands.build.attributes.INamedCommandData;
+import net.dv8tion.jda.api.interactions.commands.build.attributes.IRestrictedCommandData;
+import net.dv8tion.jda.api.interactions.commands.build.attributes.IScopedCommandData;
import net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction;
-import net.dv8tion.jda.api.interactions.commands.localization.LocalizationMap;
import net.dv8tion.jda.api.utils.data.DataObject;
import net.dv8tion.jda.api.utils.data.SerializableData;
import net.dv8tion.jda.internal.interactions.CommandDataImpl;
@@ -37,189 +40,43 @@
*
* @see Commands
*/
-public interface CommandData extends SerializableData
+public interface CommandData
+ extends INamedCommandData, IScopedCommandData, IRestrictedCommandData, IAgeRestrictedCommandData,
+ SerializableData
{
- /**
- * The maximum length the name of a command can be. ({@value})
- */
- int MAX_NAME_LENGTH = 32;
-
- /**
- * The maximum length the description of a command can be. ({@value})
- */
- int MAX_DESCRIPTION_LENGTH = 100;
-
/**
* The maximum amount of options/subcommands/groups that can be added to a command or subcommand. ({@value})
*/
int MAX_OPTIONS = 25;
- /**
- * Sets the {@link LocalizationFunction} for this command
- *
This enables you to have the entirety of this command to be localized.
- *
- * @param localizationFunction
- * The localization function
- *
- * @throws IllegalArgumentException
- * If the localization function is null
- *
- * @return The builder instance, for chaining
- */
@Nonnull
+ @Override
CommandData setLocalizationFunction(@Nonnull LocalizationFunction localizationFunction);
- /**
- * Configure the command name.
- *
- * @param name
- * The name, 1-{@value #MAX_NAME_LENGTH} characters (lowercase and alphanumeric for {@link Command.Type#SLASH})
- *
- * @throws IllegalArgumentException
- * If the name is not between 1-{@value #MAX_NAME_LENGTH} characters long, or not lowercase and alphanumeric for slash commands
- *
- * @return The builder instance, for chaining
- */
@Nonnull
+ @Override
CommandData setName(@Nonnull String name);
- /**
- * Sets a {@link DiscordLocale language-specific} localization of this command's name.
- *
- * @param locale
- * The locale to associate the translated name with
- *
- * @param name
- * The translated name to put
- *
- * @throws IllegalArgumentException
- *
These configurations can be overwritten by moderators in each guild. See {@link Command#retrievePrivileges(net.dv8tion.jda.api.entities.Guild)} to get moderator defined overrides.
- *
- * @param permission
- * {@link DefaultMemberPermissions} representing the default permissions of this command.
- *
- * @return The builder instance, for chaining
- *
- * @see DefaultMemberPermissions#ENABLED
- * @see DefaultMemberPermissions#DISABLED
- */
@Nonnull
+ @Override
CommandData setDefaultPermissions(@Nonnull DefaultMemberPermissions permission);
- /**
- * Sets whether this command is only usable in a guild (Default: false).
- *
This only has an effect if this command is registered globally.
- *
- * @param guildOnly
- * Whether to restrict this command to guilds
- *
- * @return The builder instance, for chaining
- */
@Nonnull
+ @Override
CommandData setGuildOnly(boolean guildOnly);
- /**
- * Sets whether this command should only be usable in NSFW (age-restricted) channels.
- *
Default: false
- *
- *
Note: Age-restricted commands will not show up in direct messages by default unless the user enables them in their settings.
- *
- * @param nsfw
- * True, to make this command nsfw
- *
- * @return The builder instance, for chaining
- *
- * @see Age-Restricted Commands FAQ
- */
@Nonnull
+ @Override
CommandData setNSFW(boolean nsfw);
- /**
- * The current command name
- *
- * @return The command name
- */
- @Nonnull
- String getName();
-
- /**
- * The localizations of this command's name for {@link DiscordLocale various languages}.
- *
- * @return The {@link LocalizationMap} containing the mapping from {@link DiscordLocale} to the localized name
- */
- @Nonnull
- LocalizationMap getNameLocalizations();
-
- /**
- * The {@link Command.Type}
- *
- * @return The {@link Command.Type}
- */
- @Nonnull
- Command.Type getType();
-
- /**
- * Gets the {@link DefaultMemberPermissions} of this command.
- *
If no permissions have been set, this returns {@link DefaultMemberPermissions#ENABLED}.
- *
- * @return DefaultMemberPermissions of this command.
- *
- * @see DefaultMemberPermissions#ENABLED
- * @see DefaultMemberPermissions#DISABLED
- */
- @Nonnull
- DefaultMemberPermissions getDefaultPermissions();
-
- /**
- * Whether the command can only be used inside a guild.
- *
Always true for guild commands.
- *
- * @return True, if this command is restricted to guilds.
- */
- boolean isGuildOnly();
-
- /**
- * Whether this command should only be usable in NSFW (age-restricted) channels
- *
- * @return True, if this command is restricted to NSFW channels
- *
- * @see Age-Restricted Commands FAQ
- */
- boolean isNSFW();
-
/**
* Converts the provided {@link Command} into a CommandData instance.
*
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/Commands.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/Commands.java
index 96796b4477..4cd6de3d87 100644
--- a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/Commands.java
+++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/Commands.java
@@ -20,6 +20,7 @@
import net.dv8tion.jda.api.utils.data.DataArray;
import net.dv8tion.jda.api.utils.data.DataObject;
import net.dv8tion.jda.internal.interactions.CommandDataImpl;
+import net.dv8tion.jda.internal.interactions.EntryPointCommandDataImpl;
import net.dv8tion.jda.internal.utils.Checks;
import javax.annotation.Nonnull;
@@ -129,11 +130,37 @@ public static CommandData context(@Nonnull Command.Type type, @Nonnull String na
return new CommandDataImpl(type, name);
}
+ /**
+ * Create an activity entry point command builder.
+ *
+ *
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 + *
Note: This does not take into account {@link #entryPoint(String, String) entry point commands}.
+ *
* @param array
* Array of serialized {@link DataObject} representing the commands
*
@@ -146,6 +173,7 @@ public static CommandData context(@Nonnull Command.Type type, @Nonnull String na
*
* @see CommandData#fromData(DataObject)
* @see SlashCommandData#fromData(DataObject)
+ * @see EntryPointCommandData#fromData(DataObject)
*/
@Nonnull
public static List Note: This does not take into account {@link #entryPoint(String, String) entry point commands}.
+ *
* @param collection
* Collection of serialized {@link DataObject} representing the commands
*
@@ -172,6 +202,7 @@ public static List This command can only be added via {@link GlobalCommandListUpdateAction#setEntryPointCommand(EntryPointCommandData)}.
+ *
+ * @see Commands#entryPoint(String, String)
+ */
+public interface EntryPointCommandData
+ extends IDescribedCommandData, INamedCommandData, IScopedCommandData, IRestrictedCommandData,
+ IAgeRestrictedCommandData, SerializableData
+{
+ @Nonnull
+ @Override
+ EntryPointCommandData setLocalizationFunction(@Nonnull LocalizationFunction localizationFunction);
+
+ @Nonnull
+ @Override
+ EntryPointCommandData setName(@Nonnull String name);
+
+ @Nonnull
+ @Override
+ EntryPointCommandData setNameLocalization(@Nonnull DiscordLocale locale, @Nonnull String name);
+
+ @Nonnull
+ @Override
+ EntryPointCommandData setNameLocalizations(@Nonnull Map Note: Age-restricted commands will not show up in direct messages by default unless the user enables them in their settings.
+ *
+ * @param nsfw
+ * True, to make this command nsfw
+ *
+ * @return The builder instance, for chaining
+ *
+ * @see Age-Restricted Commands FAQ
+ */
+ @Nonnull
+ IAgeRestrictedCommandData setNSFW(boolean nsfw);
+
+ /**
+ * Whether this command should only be usable in NSFW (age-restricted) channels
+ *
+ * @return True, if this command is restricted to NSFW channels
+ *
+ * @see Age-Restricted Commands FAQ
+ */
+ boolean isNSFW();
+}
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IDescribedCommandData.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IDescribedCommandData.java
new file mode 100644
index 0000000000..5ad821ad9a
--- /dev/null
+++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IDescribedCommandData.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dv8tion.jda.api.interactions.commands.build.attributes;
+
+import net.dv8tion.jda.api.interactions.DiscordLocale;
+import net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction;
+import net.dv8tion.jda.api.interactions.commands.localization.LocalizationMap;
+
+import javax.annotation.Nonnull;
+import java.util.Map;
+
+/**
+ * Builder for describable Application Commands.
+ *
+ * @see net.dv8tion.jda.api.interactions.commands.build.SlashCommandData
+ * @see net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData
+ */
+public interface IDescribedCommandData extends INamedCommandData
+{
+ /**
+ * The maximum length the description of a command can be. ({@value})
+ */
+ int MAX_DESCRIPTION_LENGTH = 100;
+
+ @Nonnull
+ @Override
+ IDescribedCommandData setLocalizationFunction(@Nonnull LocalizationFunction localizationFunction);
+
+ @Nonnull
+ @Override
+ IDescribedCommandData setName(@Nonnull String name);
+
+ @Nonnull
+ @Override
+ IDescribedCommandData setNameLocalization(@Nonnull DiscordLocale locale, @Nonnull String name);
+
+ @Nonnull
+ @Override
+ IDescribedCommandData setNameLocalizations(@Nonnull Map These configurations can be overwritten by moderators in each guild. See {@link Command#retrievePrivileges(net.dv8tion.jda.api.entities.Guild)} to get moderator defined overrides.
+ *
+ * @param permission
+ * {@link DefaultMemberPermissions} representing the default permissions of this command.
+ *
+ * @return The builder instance, for chaining
+ *
+ * @see DefaultMemberPermissions#ENABLED
+ * @see DefaultMemberPermissions#DISABLED
+ */
+ @Nonnull
+ IRestrictedCommandData setDefaultPermissions(@Nonnull DefaultMemberPermissions permission);
+
+ /**
+ * Gets the {@link DefaultMemberPermissions} of this command.
+ * Instead of {@link #deferReply()} and {@link #reply(String)} you can use {@link #deferEdit()} and {@link #editMessage(String)} with these interactions!
* You can only acknowledge an interaction once!
*/
-public interface ComponentInteraction extends IReplyCallback, IMessageEditCallback, IModalCallback, IPremiumRequiredReplyCallback
+public interface ComponentInteraction extends IReplyCallback, IMessageEditCallback, IModalCallback, IPremiumRequiredReplyCallback, ILaunchActivityReplyCallback
{
/**
* The custom component ID provided to the component when it was originally created.
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/modals/ModalInteraction.java b/src/main/java/net/dv8tion/jda/api/interactions/modals/ModalInteraction.java
index f602cdc82f..9f28f8734f 100644
--- a/src/main/java/net/dv8tion/jda/api/interactions/modals/ModalInteraction.java
+++ b/src/main/java/net/dv8tion/jda/api/interactions/modals/ModalInteraction.java
@@ -19,6 +19,7 @@
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.unions.GuildMessageChannelUnion;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
+import net.dv8tion.jda.api.interactions.callbacks.ILaunchActivityReplyCallback;
import net.dv8tion.jda.api.interactions.callbacks.IMessageEditCallback;
import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback;
import net.dv8tion.jda.internal.utils.Checks;
@@ -36,7 +37,7 @@
*
* @see net.dv8tion.jda.api.events.interaction.ModalInteractionEvent
*/
-public interface ModalInteraction extends IReplyCallback, IMessageEditCallback
+public interface ModalInteraction extends IReplyCallback, IMessageEditCallback, ILaunchActivityReplyCallback
{
/**
* Returns the custom id of the Modal in question
diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/GlobalCommandListUpdateAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/GlobalCommandListUpdateAction.java
new file mode 100644
index 0000000000..450a184862
--- /dev/null
+++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/GlobalCommandListUpdateAction.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dv8tion.jda.api.requests.restaction;
+
+import net.dv8tion.jda.api.interactions.commands.build.CommandData;
+import net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData;
+import net.dv8tion.jda.api.requests.RestAction;
+
+import javax.annotation.CheckReturnValue;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BooleanSupplier;
+
+/**
+ * Specialized {@link RestAction} used to replace existing commands globally.
+ * This operation is idempotent. Commands will persist between restarts of your bot, you only have to create a command once.
+ */
+public interface GlobalCommandListUpdateAction extends CommandListUpdateAction
+{
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ GlobalCommandListUpdateAction timeout(long timeout, @Nonnull TimeUnit unit);
+
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ GlobalCommandListUpdateAction deadline(long timestamp);
+
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ GlobalCommandListUpdateAction setCheck(@Nullable BooleanSupplier checks);
+
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ GlobalCommandListUpdateAction addCheck(@Nonnull BooleanSupplier checks);
+
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ GlobalCommandListUpdateAction addCommands(@Nonnull Collection extends CommandData> commands);
+
+ @Nonnull
+ @Override
+ @CheckReturnValue
+ GlobalCommandListUpdateAction addCommands(@Nonnull CommandData... commands);
+
+ /**
+ * Sets your app's activity primary entry point.
+ *
This is the reverse function for {@link CommandData#toData()}.
*
+ *
Use {@link Commands#entryPoint(String, String)} to create instances of this interface.
+ *
+ *
This is the reverse function for {@link EntryPointCommandData#toData()}.
+ *
+ * @param object
+ * The serialized {@link DataObject} representing the command
+ *
+ * @throws net.dv8tion.jda.api.exceptions.ParsingException
+ * If the serialized object is missing required fields
+ * @throws IllegalArgumentException
+ * If any of the values are failing the respective checks such as length
+ *
+ * @return The parsed {@link EntryPointCommandData} instance, which can be further configured through setters
+ */
+ @Nonnull
+ static EntryPointCommandData fromData(@Nonnull DataObject object)
+ {
+ Checks.notNull(object, "DataObject");
+
+ Command.Type commandType = Command.Type.fromId(object.getInt("type", 1));
+ Checks.check(commandType == Command.Type.PRIMARY_ENTRY_POINT, "Cannot convert command of type " + commandType + " to EntryPointCommandData!");
+
+ String name = object.getString("name");
+ String description = object.getString("description");
+ EntryPointCommandDataImpl command = new EntryPointCommandDataImpl(name, description);
+ command.setGuildOnly(!object.getBoolean("dm_permission", true));
+ command.setNSFW(object.getBoolean("nsfw"));
+
+ command.setDefaultPermissions(
+ object.isNull("default_member_permissions")
+ ? DefaultMemberPermissions.ENABLED
+ : DefaultMemberPermissions.enabledFor(object.getLong("default_member_permissions"))
+ );
+
+ command.setNameLocalizations(LocalizationUtils.mapFromProperty(object, "name_localizations"));
+ command.setDescriptionLocalizations(LocalizationUtils.mapFromProperty(object, "description_localizations"));
+
+ command.setHandler(Handler.fromValue(object.getLong("handler")));
+
+ return command;
+ }
+
+ /**
+ * Defines the behavior of an Entry Point Command.
+ */
+ enum Handler
+ {
+ UNKNOWN(-1),
+ /**
+ * Lets this app handle the activity start via an interaction.
+ */
+ APP_HANDLER(1),
+ /**
+ * Lets Discord handle the activity start,
+ * and sends a follow-up message without coordinating with this app.
+ */
+ DISCORD_LAUNCH_ACTIVITY(2);
+
+ private final int value;
+
+ Handler(int value)
+ {
+ this.value = value;
+ }
+
+ public int getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Converts the value to the corresponding handler.
+ *
+ * @param value
+ * The value of the handler
+ *
+ * @return {@link Handler}
+ */
+ @Nonnull
+ public static Handler fromValue(long value)
+ {
+ for (Handler handler : values())
+ {
+ if (handler.value == value)
+ return handler;
+ }
+ return UNKNOWN;
+ }
+ }
+}
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/SlashCommandData.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/SlashCommandData.java
index fde42cb574..0e0914bed8 100644
--- a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/SlashCommandData.java
+++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/SlashCommandData.java
@@ -21,8 +21,8 @@
import net.dv8tion.jda.api.interactions.commands.Command;
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
import net.dv8tion.jda.api.interactions.commands.OptionType;
+import net.dv8tion.jda.api.interactions.commands.build.attributes.IDescribedCommandData;
import net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction;
-import net.dv8tion.jda.api.interactions.commands.localization.LocalizationMap;
import net.dv8tion.jda.api.utils.data.DataArray;
import net.dv8tion.jda.api.utils.data.DataObject;
import net.dv8tion.jda.internal.interactions.CommandDataImpl;
@@ -39,7 +39,7 @@
/**
* Extension of {@link CommandData} which allows setting slash-command specific settings such as options and subcommands.
*/
-public interface SlashCommandData extends CommandData
+public interface SlashCommandData extends CommandData, IDescribedCommandData
{
@Nonnull
@Override
@@ -69,76 +69,18 @@ public interface SlashCommandData extends CommandData
@Override
SlashCommandData setNSFW(boolean nsfw);
- /**
- * Configure the description
- *
- * @param description
- * The description, 1-{@value #MAX_DESCRIPTION_LENGTH} characters
- *
- * @throws IllegalArgumentException
- * If the name is null or not between 1-{@value #MAX_DESCRIPTION_LENGTH} characters
- *
- * @return The builder, for chaining
- */
@Nonnull
+ @Override
SlashCommandData setDescription(@Nonnull String description);
- /**
- * Sets a {@link DiscordLocale language-specific} localizations of this command's description.
- *
- * @param locale
- * The locale to associate the translated description with
- *
- * @param description
- * The translated description to put
- *
- * @throws IllegalArgumentException
- *
- *
- *
- * @return This builder instance, for chaining
- */
@Nonnull
+ @Override
SlashCommandData setDescriptionLocalization(@Nonnull DiscordLocale locale, @Nonnull String description);
- /**
- * Sets multiple {@link DiscordLocale language-specific} localizations of this command's description.
- *
- * @param map
- * The map from which to transfer the translated descriptions
- *
- * @throws IllegalArgumentException
- *
- *
- *
- * @return This builder instance, for chaining
- */
@Nonnull
+ @Override
SlashCommandData setDescriptionLocalizations(@Nonnull Map
This will not affect options within subcommands.
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IAgeRestrictedCommandData.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IAgeRestrictedCommandData.java
new file mode 100644
index 0000000000..bdec558acf
--- /dev/null
+++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IAgeRestrictedCommandData.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dv8tion.jda.api.interactions.commands.build.attributes;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Builder for age restricted Application Commands.
+ *
+ * @see net.dv8tion.jda.api.interactions.commands.build.CommandData
+ * @see net.dv8tion.jda.api.interactions.commands.build.SlashCommandData
+ * @see net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData
+ */
+public interface IAgeRestrictedCommandData extends INamedCommandData
+{
+ /**
+ * Sets whether this command should only be usable in NSFW (age-restricted) channels.
+ *
Default: false
+ *
+ *
+ *
+ *
+ * @return This builder instance, for chaining
+ */
+ @Nonnull
+ IDescribedCommandData setDescriptionLocalization(@Nonnull DiscordLocale locale, @Nonnull String description);
+
+ /**
+ * Sets multiple {@link DiscordLocale language-specific} localizations of this command's description.
+ *
+ * @param map
+ * The map from which to transfer the translated descriptions
+ *
+ * @throws IllegalArgumentException
+ *
+ *
+ *
+ * @return This builder instance, for chaining
+ */
+ @Nonnull
+ IDescribedCommandData setDescriptionLocalizations(@Nonnull Map
This enables you to have the entirety of this command to be localized.
+ *
+ * @param localizationFunction
+ * The localization function
+ *
+ * @throws IllegalArgumentException
+ * If the localization function is null
+ *
+ * @return The builder instance, for chaining
+ */
+ @Nonnull
+ INamedCommandData setLocalizationFunction(@Nonnull LocalizationFunction localizationFunction);
+
+ /**
+ * Configure the command name.
+ *
+ * @param name
+ * The name, 1-{@value #MAX_NAME_LENGTH} characters (lowercase and alphanumeric for {@link Command.Type#SLASH})
+ *
+ * @throws IllegalArgumentException
+ * If the name is not between 1-{@value #MAX_NAME_LENGTH} characters long, or not lowercase and alphanumeric for slash commands
+ *
+ * @return The builder instance, for chaining
+ */
+ @Nonnull
+ INamedCommandData setName(@Nonnull String name);
+
+ /**
+ * Sets a {@link DiscordLocale language-specific} localization of this command's name.
+ *
+ * @param locale
+ * The locale to associate the translated name with
+ *
+ * @param name
+ * The translated name to put
+ *
+ * @throws IllegalArgumentException
+ *
+ *
+ *
+ * @return This builder instance, for chaining
+ */
+ @Nonnull
+ INamedCommandData setNameLocalization(@Nonnull DiscordLocale locale, @Nonnull String name);
+
+ /**
+ * Sets multiple {@link DiscordLocale language-specific} localizations of this command's name.
+ *
+ * @param map
+ * The map from which to transfer the translated names
+ *
+ * @throws IllegalArgumentException
+ *
+ *
+ *
+ * @return This builder instance, for chaining
+ */
+ @Nonnull
+ INamedCommandData setNameLocalizations(@Nonnull Map
By default, everyone can use this command ({@link DefaultMemberPermissions#ENABLED}). Additionally, a command can be disabled for everyone but admins via {@link DefaultMemberPermissions#DISABLED}.
+ *
If no permissions have been set, this returns {@link DefaultMemberPermissions#ENABLED}.
+ *
+ * @return DefaultMemberPermissions of this command.
+ *
+ * @see DefaultMemberPermissions#ENABLED
+ * @see DefaultMemberPermissions#DISABLED
+ */
+ @Nonnull
+ DefaultMemberPermissions getDefaultPermissions();
+}
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IScopedCommandData.java b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IScopedCommandData.java
new file mode 100644
index 0000000000..2018d53c86
--- /dev/null
+++ b/src/main/java/net/dv8tion/jda/api/interactions/commands/build/attributes/IScopedCommandData.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dv8tion.jda.api.interactions.commands.build.attributes;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Builder for scoped Application Commands.
+ *
+ * @see net.dv8tion.jda.api.interactions.commands.build.CommandData
+ * @see net.dv8tion.jda.api.interactions.commands.build.SlashCommandData
+ * @see net.dv8tion.jda.api.interactions.commands.build.EntryPointCommandData
+ */
+public interface IScopedCommandData extends INamedCommandData
+{
+ /**
+ * Sets whether this command is only usable in a guild (Default: false).
+ *
This only has an effect if this command is registered globally.
+ *
+ * @param guildOnly
+ * Whether to restrict this command to guilds
+ *
+ * @return The builder instance, for chaining
+ */
+ @Nonnull
+ IScopedCommandData setGuildOnly(boolean guildOnly);
+
+ /**
+ * Whether the command can only be used inside a guild.
+ *
Always true for guild commands.
+ *
+ * @return True, if this command is restricted to guilds.
+ */
+ boolean isGuildOnly();
+}
diff --git a/src/main/java/net/dv8tion/jda/api/interactions/components/ComponentInteraction.java b/src/main/java/net/dv8tion/jda/api/interactions/components/ComponentInteraction.java
index 2b2290c213..0f3c477cce 100644
--- a/src/main/java/net/dv8tion/jda/api/interactions/components/ComponentInteraction.java
+++ b/src/main/java/net/dv8tion/jda/api/interactions/components/ComponentInteraction.java
@@ -19,10 +19,7 @@
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.unions.GuildMessageChannelUnion;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
-import net.dv8tion.jda.api.interactions.callbacks.IMessageEditCallback;
-import net.dv8tion.jda.api.interactions.callbacks.IModalCallback;
-import net.dv8tion.jda.api.interactions.callbacks.IPremiumRequiredReplyCallback;
-import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback;
+import net.dv8tion.jda.api.interactions.callbacks.*;
import javax.annotation.Nonnull;
@@ -32,7 +29,7 @@
*
Any commands that currently exist and are not listed through {@link #addCommands(CommandData...)} will be DELETED!
+ *
If your bot has activities enabled, you must {@link #setEntryPointCommand(EntryPointCommandData) set your entry point command}.
+ *
+ *
This must be set if your application has activities enabled.
+ *
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);
+}
diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/interactions/InteractionCallbackAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/interactions/InteractionCallbackAction.java
index 10c3363a8c..a7d85d3623 100644
--- a/src/main/java/net/dv8tion/jda/api/requests/restaction/interactions/InteractionCallbackAction.java
+++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/interactions/InteractionCallbackAction.java
@@ -65,6 +65,8 @@ enum ResponseType
*/
@Deprecated
PREMIUM_REQUIRED(10),
+ /** Launch the app's activity */
+ LAUNCH_ACTIVITY(12),
;
private final int raw;
diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/interactions/LaunchActivityCallbackAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/interactions/LaunchActivityCallbackAction.java
new file mode 100644
index 0000000000..d234bcb0f5
--- /dev/null
+++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/interactions/LaunchActivityCallbackAction.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dv8tion.jda.api.requests.restaction.interactions;
+
+import net.dv8tion.jda.api.requests.FluentRestAction;
+
+/**
+ * An {@link InteractionCallbackAction} that can be used to launch an activity.
+ *
+ * @see net.dv8tion.jda.api.interactions.callbacks.ILaunchActivityReplyCallback
+ */
+public interface LaunchActivityCallbackAction extends InteractionCallbackAction