SkuFlags

A collection of multiple SkuFlags.

Creating an instance of SkuFlags

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

// from individual SkuFlags
val skuFlags1 = SkuFlags(SkuFlag.Available, SkuFlag.GuildSubscription)

// from an Iterable
val iterable: Iterable<SkuFlag> = TODO()
val skuFlags2 = SkuFlags(iterable)

// using a builder
val skuFlags3 = SkuFlags {
+skuFlags2
+SkuFlag.Available
-SkuFlag.GuildSubscription
}

Modifying an existing instance of SkuFlags

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

skuFlags.copy {
+SkuFlag.Available
}

Mathematical operators

All SkuFlags objects can use +/- operators:

val skuFlags1 = skuFlags + SkuFlag.Available
val skuFlags2 = skuFlags - SkuFlag.GuildSubscription
val skuFlags3 = skuFlags1 + skuFlags2

Checking for SkuFlags

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

val hasSkuFlag = SkuFlag.Available in skuFlags
val hasSkuFlags = SkuFlags(SkuFlag.Available, SkuFlag.GuildSubscription) in skuFlags

Unknown SkuFlags

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

You can also use SkuFlag.fromShift to check for unknown SkuFlags.

val hasUnknownSkuFlag = SkuFlag.fromShift(23) in skuFlags

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 SkuFlags contained in this instance of SkuFlags.

Functions

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

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

operator fun contains(flags: SkuFlags): Boolean

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

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

Returns a copy of this instance of SkuFlags 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: SkuFlag): SkuFlags

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

operator fun minus(flags: SkuFlags): SkuFlags

Returns an instance of SkuFlags 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: SkuFlag): SkuFlags

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

operator fun plus(flags: SkuFlags): SkuFlags

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

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