ActivityFlags

A collection of multiple ActivityFlags.

Creating an instance of ActivityFlags

You can create an instance of ActivityFlags using the following methods:

// from individual ActivityFlags
val activityFlags1 = ActivityFlags(ActivityFlag.Instance, ActivityFlag.Join)

// from an Iterable
val iterable: Iterable<ActivityFlag> = TODO()
val activityFlags2 = ActivityFlags(iterable)

// using a builder
val activityFlags3 = ActivityFlags {
+activityFlags2
+ActivityFlag.Instance
-ActivityFlag.Join
}

Modifying an existing instance of ActivityFlags

You can create a modified copy of an existing instance of ActivityFlags using the copy method:

activityFlags.copy {
+ActivityFlag.Instance
}

Mathematical operators

All ActivityFlags objects can use +/- operators:

val activityFlags1 = activityFlags + ActivityFlag.Instance
val activityFlags2 = activityFlags - ActivityFlag.Join
val activityFlags3 = activityFlags1 + activityFlags2

Checking for ActivityFlags

You can use the contains operator to check whether an instance of ActivityFlags contains specific ActivityFlags:

val hasActivityFlag = ActivityFlag.Instance in activityFlags
val hasActivityFlags = ActivityFlags(ActivityFlag.Instance, ActivityFlag.Join) in activityFlags

Unknown ActivityFlags

Whenever ActivityFlags haven't been added to Kord yet, they will be deserialized as instances of ActivityFlag.Unknown.

You can also use ActivityFlag.fromShift to check for unknown ActivityFlags.

val hasUnknownActivityFlag = ActivityFlag.fromShift(23) in activityFlags

See also

Types

Link copied to clipboard
class Builder(value: Int = 0)

Properties

Link copied to clipboard
val value: Int

The raw value used by Discord.

Link copied to clipboard

A Set of all ActivityFlags contained in this instance of ActivityFlags.

Functions

Link copied to clipboard
operator fun contains(flag: ActivityFlag): Boolean

Checks if this instance of ActivityFlags has all bits set that are set in flag.

operator fun contains(flags: ActivityFlags): Boolean

Checks if this instance of ActivityFlags has all bits set that are set in flags.

Link copied to clipboard
inline fun copy(builder: ActivityFlags.Builder.() -> Unit): ActivityFlags

Returns a copy of this instance of ActivityFlags modified with builder.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun minus(flag: ActivityFlag): ActivityFlags

Returns an instance of ActivityFlags that has all bits set that are set in this except the bits that are set in flag.

operator fun minus(flags: ActivityFlags): ActivityFlags

Returns an instance of ActivityFlags that has all bits set that are set in this except the bits that are set in flags.

Link copied to clipboard
operator fun plus(flag: ActivityFlag): ActivityFlags

Returns an instance of ActivityFlags that has all bits set that are set in this and flag.

operator fun plus(flags: ActivityFlags): ActivityFlags

Returns an instance of ActivityFlags that has all bits set that are set in this and flags.

Link copied to clipboard
open override fun toString(): String