Skip to content

Commit

Permalink
Move EntryPointCommandData.Handler
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Oct 18, 2024
1 parent 21f3a2f commit 4e381d5
Showing 1 changed file with 48 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,54 +43,6 @@ public interface EntryPointCommandData
extends IDescribedCommandData, INamedCommandData, IScopedCommandData, IRestrictedCommandData,
IAgeRestrictedCommandData, SerializableData
{
/**
* 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;
}
}

@Nonnull
@Override
EntryPointCommandData setLocalizationFunction(@Nonnull LocalizationFunction localizationFunction);
Expand Down Expand Up @@ -214,4 +166,52 @@ static EntryPointCommandData fromData(@Nonnull DataObject object)

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;
}
}
}

0 comments on commit 4e381d5

Please sign in to comment.