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
}
Content copied to clipboard
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
}
Content copied to clipboard
Mathematical operators
All Intents objects can use +
/-
operators:
val intents1 = intents + Intent.Guilds
val intents2 = intents - Intent.GuildMembers
val intents3 = intents1 + intents2
Content copied to clipboard
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
Content copied to clipboard
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
Content copied to clipboard