Skip to content

Commit

Permalink
Enable signing if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Aug 9, 2023
1 parent 9c6b492 commit 003aed3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/src/commonMain/kotlin/entity/DiscordActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import kotlinx.serialization.encoding.Encoder
public data class DiscordBotActivity(
val name: String,
val type: ActivityType,
val state: Optional<String?> = Optional.Missing(),
val url: Optional<String?> = Optional.Missing()
)

Expand Down Expand Up @@ -68,7 +69,7 @@ public enum class ActivityFlag(public val value: Int) {
public class ActivityFlags(public val value: Int) {

public val flags: Set<ActivityFlag>
get() = ActivityFlag.values().filter { (it.value and value) == it.value }.toSet()
get() = ActivityFlag.entries.filter { (it.value and value) == it.value }.toSet()

public operator fun contains(flag: ActivityFlag): Boolean = (flag.value and value) == flag.value

Expand Down
4 changes: 4 additions & 0 deletions gateway/src/commonMain/kotlin/builder/PresenceBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public class PresenceBuilder {
game = DiscordBotActivity(name, ActivityType.Competing)
}

public fun custom(name: String, state: String) {
game = DiscordBotActivity(name, state = Optional(state), type = ActivityType.Custom)
}

public fun toUpdateStatus(): UpdateStatus = UpdateStatus(since, listOfNotNull(game), status, afk)

public fun toPresence(): DiscordPresence = DiscordPresence(status, afk, since, game)
Expand Down

0 comments on commit 003aed3

Please sign in to comment.