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
}
Content copied to clipboard
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
}
Content copied to clipboard
Mathematical operators
All SkuFlags objects can use +
/-
operators:
val skuFlags1 = skuFlags + SkuFlag.Available
val skuFlags2 = skuFlags - SkuFlag.GuildSubscription
val skuFlags3 = skuFlags1 + skuFlags2
Content copied to clipboard
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
Content copied to clipboard
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
Content copied to clipboard