Skip to content

Intents

Bart Arys edited this page Jul 22, 2021 · 1 revision

Gateway Intents are Discord's way of allowing bots to communicate which events a bot wishes to receive through the gateway.

By default, Kord is set up to receive all non-privileged intents (Intents.nonPrivileged), you can change this when creating a new instance:

Kord(token){
    intents = Intents(Intent.Guilds, Intent.DirectMessages, Intent.GuildMessages)
}

Kord primarily caches data from the gateway, consider enabling intents not just based on the events you'll handle but also the data you'll need.

e.g.: the Intent.Guilds will help in keeping guild channels cached and up to date.

Privileged Intents

Privileged Intents are a special set of intents that need to be enabled through the developer's portal in addition to Kord's builder.

Because of the extra steps (and restrictions) surrounding these intents, Kord requires you to opt into a special annotation when using those intents (or parts of the API that require them):

Kord(token) {
    @OptIn(PrivilegedIntent::class)
    intents = Intents.nonPrivileged + Intent.GuildPresences
}
Clone this wiki locally