#๐Ÿ”’ missing intents discord bot

21 messages ยท Page 1 of 1 (latest)

chrome jasperBOT
#

@solemn phoenix

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fresh brook
#

!intents

chrome jasperBOT
#
Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see discord.py's related guide, and for general information about them, see the Discord developer documentation on intents.

solar vapor
#

You'll need to reset the bot token, don't share it with anyone

solemn phoenix
#

right

#

@solar vapor

#

what would i start the bot with now

#

client.run('token_key')?

#

or is there a new way to run the bot now

#

since there is discord.py2.0

fresh brook
#

You still have to pass a token to client.run.
Fix was informing you to reset the token, since you shared it publicly here.

solemn phoenix
#

ok so it shows this now

#

yeah thanks fix, i just saved it to a env file so ill just call the variable

#

much smarter haha

#

nvm it worked

#

i also needed to import interaction

chrome jasperBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ missing intents discord bot