Skip to content

Commit

Permalink
Add "Competing" activity type (Fix kordlib#270) (kordlib#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed May 9, 2021
1 parent c9ad6ea commit f0d9bc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/src/main/kotlin/entity/DiscordActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ enum class ActivityType(val code: Int) {
Streaming(1),
Listening(2),
Watching(3),
Custom(4);
Custom(4),
Competing(5);

companion object ActivityTypeSerializer : KSerializer<ActivityType> {
override val descriptor: SerialDescriptor
Expand Down
4 changes: 4 additions & 0 deletions gateway/src/main/kotlin/builder/PresenceBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class PresenceBuilder {
game = DiscordBotActivity(name, ActivityType.Watching)
}

fun competing(name: String) {
game = DiscordBotActivity(name, ActivityType.Competing)
}

fun toUpdateStatus(): UpdateStatus = UpdateStatus(since?.toEpochMilli(), game?.let(::listOf), status, afk)

fun toPresence(): DiscordPresence = DiscordPresence(status, afk, since?.toEpochMilli(), game)
Expand Down

0 comments on commit f0d9bc6

Please sign in to comment.