How do i define ''intents'' when making a python discord bot

Viewed 37

i am very new to coding. i'm using VS code, i watched a tutorial, this is my code. It says ''intents'' is not defined

code:

import discord 

token = "mytokencuzsecuritynstuff"

client = discord.Client(Intents)

@client.event
async def on_ready():
    print(f"logged in as {client.user}")

client.run(token) 

what do i do to fix this?

1 Answers
import discord
intents = discord.Intents.default()
intents.typing = False
intents.presences = False
token = 'your token'
#add other intents according to your needs
client = discord.Client(intents=intents)
client.run(token)

The error was because you hadn't defined intents in the first place. As you are new, I recommend you to learn discord.ext intead.

Related