Intents#

Intents are Discord API feature that tells the gateway about which events you want your bot’s websocket to recieve.

By default, they are set to 98045 in hikari.GatewayBot which includes all intents except privileged intents.

Enabling intents in code#

For telling your GatewayBot what intents to request from discord, you need to pass a hikari.Intents object as the intents kwarg inside your GatewayBot object.

You can read about functionality of all intents described here: https://www.hikari-py.dev/hikari/index.html

Creating Intents

A hikari.Intents class can be initialised using intent enums mentioned with pipes ( | ) to declare the intents.

import hikari

intents = hikari.Intents(
    hikari.Intents.ALL_GUILDS  # enables all guild related intents
    | hikari.Intents.DM_MESSAGES  # enables dm message intents
    | hikari.Intents.MESSAGE_CONTENT  # allows you to get message content from a message object, else it's None for servers
)

Passing Intents to GatewayBot

bot = hikari.GatewayBot("token", intents=intents)

Privilaged Intents#

Some intents need to be explicitly enabled from the Discord Developer portal to use them, which include:

  • Member Intents

  • Presence Intents

  • Message Content Intents (applicable after 31 august)

These intents can be used freely for non-verified bots which need no data-whitelisting. While verification, the application owner needs to request for these separately. Read more about privileged intents here


Intents Table#

Intents

Value

Gateway Events

DM_MESSAGES

4096

MESSAGE_CREATE
MESSAGE_UPDATE
MESSAGE_DELETE (DMs only.)

DM_MESSAGE_REACTIONS

8192

MESSAGE_REACTION_ADD
MESSAGE_REACTION_REMOVE
MESSAGE_REACTION_REMOVE_ALL
MESSAGE_REACTION_REMOVE_EMOJI (DMs only.)

DM_MESSAGE_TYPING

16384

TYPING_START (DMs only.)

GUILDS

1

GUILD_CREATE
GUILD_UPDATE
GUILD_DELETE
GUILD_ROLE_CREATE
GUILD_ROLE_UPDATE
GUILD_ROLE_DELETE
CHANNEL_CREATE
CHANNEL_UPDATE
CHANNEL_DELETE
CHANNEL_PINS_UPDATE

GUILD_BANS

4

GUILD_BAN_ADD
GUILD_BAN_REMOVE

GUILD_EMOJIS

8

GUILD_EMOJIS_UPDATE

GUILD_INTEGRATIONS

16

INTEGRATION_CREATE
INTEGRATION_DELETE
INTEGRATION_UPDATE

GUILD_INVITES

64

INVITE_CREATE
INVITE_DELETE

GUILD_MEMBERS*

2

GUILD_MEMBER_ADD
GUILD_MEMBER_UPDATE
GUILD_MEMBER_REMOVE

GUILD_MESSAGES

512

MESSAGE_CREATE (in guilds only)
MESSAGE_UPDATE (in guilds only)
MESSAGE_DELETE (in guilds only)
MESSAGE_BULK_DELETE (in guilds only)

GUILD_MESSAGE_REACTIONS

1024

MESSAGE_REACTION_ADD (in guilds only)
MESSAGE_REACTION_REMOVE (in guilds only)
MESSAGE_REACTION_REMOVE_ALL (in guilds only)
MESSAGE_REACTION_REMOVE_EMOJI (in guilds only)

GUILD_MESSAGE_TYPING

2048

TYPING_START (in guilds only)

GUILD_PRESENCES*

256

PRESENCE_UPDATE

GUILD_SCHEDULED_EVENTS

65536

GUILD_SCHEDULED_EVENT_CREATE
GUILD_SCHEDULED_EVENT_UPDATE
GUILD_SCHEDULED_EVENT_DELETE
GUILD_SCHEDULED_EVENT_USER_ADD
GUILD_SCHEDULED_EVENT_USER_REMOVE

GUILD_VOICE_STATES

128

VOICE_STATE_UPDATE

GUILD_WEBHOOKS

32

WEBHOOKS_UPDATE

MESSAGE_CONTENT*

32768

-

NONE

0

-

NOTE: * = Previleged Intent

Other Enums:

ALL , ALL_DMS , ALL_GUILDS , ALL_GUILDS_PRIVILEGED , ALL_GUILDS_UNPRIVILEGED , ALL_MESSAGES , ALL_MESSAGE_REACTIONS , ALL_MESSAGE_TYPING , ALL_PRIVILEGED , ALL_UNPRIVILEGED


Enabling Privilaged Intents#

  • Go to Discord Developer Portal and select the bot application you want to enable the intents for.

  • Select the “Bot” menu in the sidebar.

  • Enable the intents you need.

  • Save changes.