Discord Bot Tutorial Outdated [Python]

After attempting to complete the Discord But Tutorial a few times recently on Replit, it appears that the Tutorial is outdated at this point.

After following all the steps in Feb-2023, I receive the following error in the console:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    client = discord.Client()
TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

Ghostwriter debugger told me to update the line:

client = discord.Client()


client = discord.Client(intents=discord.Intents.all())

But then, once I try to run the application again, I receive a new error message that is more detailed about the issue at hand:

  File "/home/runner/SandlerBot/venv/lib/python3.10/site-packages/discord/client.py", line 672, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead

The documentation doesn’t list any follow up steps here, but I managed to stumble upon this Stackoverflow post that talks about the simple steps you need to take to make it work. So that others don’t have to get frustrated with the documentation as is, can someone update the actual documentation to account for the change in how Discord Bots work?


Thanks @Dprevoznik I’ll pass this on to someone who can update the documentation! Much appreciated!

Discord.py seemed to change to fit the new intents system for discord bots.

So basically, try using some fork of discord.py like pycord, nextcord, etc.

Hey @Dprevoznik!

Thank you for pointing this out. We are working on revising the docs and should release a fix soon.

I actually made a new Template for discord bots because of this. The official replit templates don’t work because the new discord.py requires you to use intents.

1 Like

This might be considered advertising but this is a working template: https://replit.com/@InvisibleOne/Working-Discordpy-Template?v=1