Reputation: 1
I was using replit (maybe because replit doesnt work?) tryoing to make some code for a Discord bot when I saw this:
Type error: __init__ missing 1 required keyword-only argument: "intents"
Im not really sure what is means
Heres my code (BTW i used pip install discord in shell) `
import discord
token = "mytoken (not revealing it i guess)"# but even with right token it doesnt work
client = discord.Client()
name = "MIIB.BOT_v1.0"
@client.event
async def on_ready():
print("Bot logged in as ", name, "!")
client.run(token)
on_ready()
#i did *****pip install discord****** in shell btw
`
I tried some variations but not much. I expected:
Bot logged in as botname#6969
Upvotes: 0
Views: 188
Reputation: 1
You have to define your intents with:
client = discord.Client(intents=discord.Intents.default())
You won't need any other intents than this for your code. But if you ever run into an error you can do
client = discord.Client(intents=discord.Intents.all())
(But you have to turn intents all on in the Discord developer portal.)
Upvotes: 0
Reputation: 304
As per recently(-ish), you need to specify the intents your bot uses when login to the API, so you should populate the Client argument with an intent object.
Calling the default intents, if you don't plan on doing anything with any other that you might need to enable, would look like this
bot_intents = discord.Intents.default()
client = discord.Client(intents=bot_intents)
Upvotes: 0
Reputation: 79
Replace
client = discord.Client()
with
client = discord.Client(intents=discord.Intents.default())
Upvotes: 1