ChannelFlags
A collection of multiple ChannelFlags.
Creating an instance of ChannelFlags
You can create an instance of ChannelFlags using the following methods:
// from individual ChannelFlags
val channelFlags1 = ChannelFlags(ChannelFlag.Pinned, ChannelFlag.RequireTag)
// from an Iterable
val iterable: Iterable<ChannelFlag> = TODO()
val channelFlags2 = ChannelFlags(iterable)
// using a builder
val channelFlags3 = ChannelFlags {
+channelFlags2
+ChannelFlag.Pinned
-ChannelFlag.RequireTag
}
Modifying an existing instance of ChannelFlags
You can create a modified copy of an existing instance of ChannelFlags using the copy method:
channelFlags.copy {
+ChannelFlag.Pinned
}
Mathematical operators
All ChannelFlags objects can use +
/-
operators:
val channelFlags1 = channelFlags + ChannelFlag.Pinned
val channelFlags2 = channelFlags - ChannelFlag.RequireTag
val channelFlags3 = channelFlags1 + channelFlags2
Checking for ChannelFlags
You can use the contains operator to check whether an instance of ChannelFlags contains specific ChannelFlags:
val hasChannelFlag = ChannelFlag.Pinned in channelFlags
val hasChannelFlags = ChannelFlags(ChannelFlag.Pinned, ChannelFlag.RequireTag) in channelFlags
Unknown ChannelFlags
Whenever ChannelFlags haven't been added to Kord yet, they will be deserialized as instances of ChannelFlag.Unknown.
You can also use ChannelFlag.fromShift to check for unknown ChannelFlags.
val hasUnknownChannelFlag = ChannelFlag.fromShift(23) in channelFlags
See also
Properties
Functions
Checks if this instance of ChannelFlags has all bits set that are set in flag.
Checks if this instance of ChannelFlags has all bits set that are set in flags.
Returns a copy of this instance of ChannelFlags modified with builder.
Returns an instance of ChannelFlags that has all bits set that are set in this
except the bits that are set in flag.
Returns an instance of ChannelFlags that has all bits set that are set in this
except the bits that are set in flags.
Returns an instance of ChannelFlags that has all bits set that are set in this
and flag.
Returns an instance of ChannelFlags that has all bits set that are set in this
and flags.