Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the COMPETING Activity type #775

Merged
merged 1 commit into from Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/src/main/java/discord4j/core/GatewayDiscordClient.java
Expand Up @@ -310,6 +310,7 @@ private GuildData toGuildData(GuildUpdateData guild) {
* <li>{@link Activity#playing(String)}</li>
* <li>{@link Activity#streaming(String, String)}</li>
* <li>{@link Activity#watching(String)}</li>
* <li>{@link Activity#competing(String)}</li>
* </ul>
*
* @param statusUpdate The updated client status.
Expand Down Expand Up @@ -337,6 +338,7 @@ public Mono<Void> updatePresence(final StatusUpdate statusUpdate) {
* <li>{@link Activity#playing(String)}</li>
* <li>{@link Activity#streaming(String, String)}</li>
* <li>{@link Activity#watching(String)}</li>
* <li>{@link Activity#competing(String)}</li>
* </ul>
*
* @param statusUpdate The updated client presence.
Expand Down
13 changes: 12 additions & 1 deletion core/src/main/java/discord4j/core/object/presence/Activity.java
Expand Up @@ -61,6 +61,13 @@ public static ActivityUpdateRequest watching(String name) {
.build();
}

public static ActivityUpdateRequest competing(String name) {
return ActivityUpdateRequest.builder()
.name(name)
.type(Type.COMPETING.getValue())
.build();
}

private final ActivityData data;

Activity(final ActivityData data) {
Expand Down Expand Up @@ -311,7 +318,10 @@ public enum Type {
WATCHING(3),

/** {emoji} {name} */
CUSTOM(4);
CUSTOM(4),

/** "Competing in {name}" */
COMPETING(5);

/** The underlying value as represented by Discord. */
private final int value;
Expand Down Expand Up @@ -348,6 +358,7 @@ public static Type of(final int value) {
case 2: return LISTENING;
case 3: return WATCHING;
case 4: return CUSTOM;
case 5: return COMPETING;
default: return UNKNOWN;
}
}
Expand Down
Expand Up @@ -64,6 +64,7 @@ public static StatusUpdate online() {
* <li>{@link Activity#playing(String)}</li>
* <li>{@link Activity#streaming(String, String)}</li>
* <li>{@link Activity#watching(String)}</li>
* <li>{@link Activity#competing(String)}</li>
* </ul>
*
* @return a {@link StatusUpdate} for the ONLINE status
Expand Down Expand Up @@ -100,6 +101,7 @@ public static StatusUpdate doNotDisturb() {
* <li>{@link Activity#playing(String)}</li>
* <li>{@link Activity#streaming(String, String)}</li>
* <li>{@link Activity#watching(String)}</li>
* <li>{@link Activity#competing(String)}</li>
* </ul>
*
* @return a {@link StatusUpdate} for the DO_NOT_DISTURB status
Expand Down Expand Up @@ -136,6 +138,7 @@ public static StatusUpdate idle() {
* <li>{@link Activity#playing(String)}</li>
* <li>{@link Activity#streaming(String, String)}</li>
* <li>{@link Activity#watching(String)}</li>
* <li>{@link Activity#competing(String)}</li>
* </ul>
*
* @return a {@link StatusUpdate} for the IDLE status
Expand Down