0

I have tried running this script without the intents at first, but then VS Code told me that I needed it without giving me any hint as to what to put after intents.

Code:

import discord
client = discord.Client(intents=)

@client.event
async def on_connect():
    for user in client.user.friends:
        try:
            await user.send("MESSAGE")
            print(f"Working with: {user.name}")
        except:
            print(f"Not working on: {user.name}")

client.run("Tokennothereforprivacy" , bot=False)
  • Does this answer your question? [How do I get the discord.py intents to work?](https://stackoverflow.com/questions/64831017/how-do-i-get-the-discord-py-intents-to-work) – Elijah Nicol Oct 24 '22 at 06:36

1 Answers1

0

There are two parts to this:

First, you need to enable which intents you need in the Discord Developer portal. This is under Bots > Privileged Gateway Intents. Next, you need to go in your code, and type in the intents.

For example, if you just selected Message Content Intent, you would put this next to intents: message_content=True Altogether, it would be:

client = discord.Client(intents= message_content = True)

If you have more than 1 intent, use commas to separate them, like this

(intents= intent1 = True, intent2 = True)

I hope this helped.

donut28
  • 55
  • 6