ApplicationFlags

A collection of multiple ApplicationFlags.

Creating an instance of ApplicationFlags

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

// from individual ApplicationFlags
val applicationFlags1 = ApplicationFlags(ApplicationFlag.ApplicationAutoModerationRuleCreateBadge, ApplicationFlag.GatewayPresence)

// from an Iterable
val iterable: Iterable<ApplicationFlag> = TODO()
val applicationFlags2 = ApplicationFlags(iterable)

// using a builder
val applicationFlags3 = ApplicationFlags {
+applicationFlags2
+ApplicationFlag.ApplicationAutoModerationRuleCreateBadge
-ApplicationFlag.GatewayPresence
}

Modifying an existing instance of ApplicationFlags

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

applicationFlags.copy {
+ApplicationFlag.ApplicationAutoModerationRuleCreateBadge
}

Mathematical operators

All ApplicationFlags objects can use +/- operators:

val applicationFlags1 = applicationFlags + ApplicationFlag.ApplicationAutoModerationRuleCreateBadge
val applicationFlags2 = applicationFlags - ApplicationFlag.GatewayPresence
val applicationFlags3 = applicationFlags1 + applicationFlags2

Checking for ApplicationFlags

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

val hasApplicationFlag = ApplicationFlag.ApplicationAutoModerationRuleCreateBadge in applicationFlags
val hasApplicationFlags = ApplicationFlags(ApplicationFlag.ApplicationAutoModerationRuleCreateBadge, ApplicationFlag.GatewayPresence) in applicationFlags

Unknown ApplicationFlags

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

You can also use ApplicationFlag.fromShift to check for unknown ApplicationFlags.

val hasUnknownApplicationFlag = ApplicationFlag.fromShift(23) in applicationFlags

See also

Types

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

Properties

Link copied to clipboard
val code: Int

The raw code used by Discord.

Link copied to clipboard

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

Functions

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

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

operator fun contains(flags: ApplicationFlags): Boolean

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

Link copied to clipboard

Returns a copy of this instance of ApplicationFlags 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 ApplicationFlags that has all bits set that are set in this except the bits that are set in flag.

Returns an instance of ApplicationFlags 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 ApplicationFlags that has all bits set that are set in this and flag.

operator fun plus(flags: ApplicationFlags): ApplicationFlags

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

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