SystemChannelFlags

A collection of multiple SystemChannelFlags.

Creating an instance of SystemChannelFlags

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

// from individual SystemChannelFlags
val systemChannelFlags1 = SystemChannelFlags(SystemChannelFlag.SuppressJoinNotifications, SystemChannelFlag.SuppressPremiumSubscriptions)

// from an Iterable
val iterable: Iterable<SystemChannelFlag> = TODO()
val systemChannelFlags2 = SystemChannelFlags(iterable)

// using a builder
val systemChannelFlags3 = SystemChannelFlags {
+systemChannelFlags2
+SystemChannelFlag.SuppressJoinNotifications
-SystemChannelFlag.SuppressPremiumSubscriptions
}

Modifying an existing instance of SystemChannelFlags

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

systemChannelFlags.copy {
+SystemChannelFlag.SuppressJoinNotifications
}

Mathematical operators

All SystemChannelFlags objects can use +/- operators:

val systemChannelFlags1 = systemChannelFlags + SystemChannelFlag.SuppressJoinNotifications
val systemChannelFlags2 = systemChannelFlags - SystemChannelFlag.SuppressPremiumSubscriptions
val systemChannelFlags3 = systemChannelFlags1 + systemChannelFlags2

Checking for SystemChannelFlags

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

val hasSystemChannelFlag = SystemChannelFlag.SuppressJoinNotifications in systemChannelFlags
val hasSystemChannelFlags = SystemChannelFlags(SystemChannelFlag.SuppressJoinNotifications, SystemChannelFlag.SuppressPremiumSubscriptions) in systemChannelFlags

Unknown SystemChannelFlags

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

You can also use SystemChannelFlag.fromShift to check for unknown SystemChannelFlags.

val hasUnknownSystemChannelFlag = SystemChannelFlag.fromShift(23) in systemChannelFlags

See also

Types

Link copied to clipboard
class Builder(code: Int = 0)
Link copied to clipboard
object Companion
Link copied to clipboard

Properties

Link copied to clipboard
val code: Int

The raw code used by Discord.

Link copied to clipboard

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

Functions

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

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

operator fun contains(flags: SystemChannelFlags): Boolean

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

Link copied to clipboard

Returns a copy of this instance of SystemChannelFlags 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

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

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

Link copied to clipboard

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

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

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