Intents

A collection of multiple Intents.

Creating an instance of Intents

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

// from individual Intents
val intents1 = Intents(Intent.Guilds, Intent.GuildMembers)

// from an Iterable
val iterable: Iterable<Intent> = TODO()
val intents2 = Intents(iterable)

// using a builder
val intents3 = Intents {
+intents2
+Intent.Guilds
-Intent.GuildMembers
}

Modifying an existing instance of Intents

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

intents.copy {
+Intent.Guilds
}

Mathematical operators

All Intents objects can use +/- operators:

val intents1 = intents + Intent.Guilds
val intents2 = intents - Intent.GuildMembers
val intents3 = intents1 + intents2

Checking for Intents

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

val hasIntent = Intent.Guilds in intents
val hasIntents = Intents(Intent.Guilds, Intent.GuildMembers) in intents

Unknown Intents

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

You can also use Intent.fromShift to check for unknown Intents.

val hasUnknownIntent = Intent.fromShift(23) in intents

See also

Types

Link copied to clipboard
class Builder(code: DiscordBitSet = EmptyBitSet())

Properties

Link copied to clipboard

The raw code used by Discord.

Link copied to clipboard

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

Functions

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

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

operator fun contains(flags: Intents): Boolean

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

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

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

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

operator fun minus(flags: Intents): Intents

Returns an instance of Intents 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: Intent): Intents

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

operator fun plus(flags: Intents): Intents

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

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