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
Properties
Functions
Checks if this instance of ActivityFlags has all bits set that are set in flag.
Checks if this instance of ActivityFlags has all bits set that are set in flags.
Returns a copy of this instance of ActivityFlags modified with builder.
Returns an instance of ActivityFlags that has all bits set that are set in this
except the bits that are set in flag.
Returns an instance of ActivityFlags that has all bits set that are set in this
except the bits that are set in flags.
Returns an instance of ActivityFlags that has all bits set that are set in this
and flag.
Returns an instance of ActivityFlags that has all bits set that are set in this
and flags.