Client.__init__() missing 1 required keyword-only argument: 'intents'
Question:
I was trying to make a quick bot for discord and I used this code:
import discord
from discord.ui import button, view
from discord.ext import commands
client = discord.Client()
@client.event
async def on_ready():
print('Autenticazione riuscita. {0.user} è online!'.format(client))
But this error pops up:
Client.__init__() missing 1 required keyword-only argument: 'intents'
I tried putting something between the brackets, like this:
import discord
from discord.ui import button, view
from discord.ext import commands
client = discord.Client(0)
@client.event
async def on_ready():
print('Autenticazione riuscita. {0.user} è online!'.format(client))
But instead I get this error:
Client.__init__() takes 1 positional argument but 2 were given
I’m probably missing something obvious, since on another pc the exact same code, with exact same modules and same python version works just fine. Any suggestions?
Answers:
You could use the default Intents
unless you have a particular one to specify
client = discord.Client(intents=discord.Intents.default())
See Intents for more details
client = discord.Client(intents=discord.Intents.default())
I tried this but I’m still having the same error, I even tried
bot = commands.Bot(intents=discord.Intents.all() , command_prefix= "!" , description='The Best Bot For the Best User!')
bot.add_cog(Music(bot))
but it doesn’t see my commands.
My suggestion here would actually be to uninstall the version of Discord.py you have downloaded & pip install version 1.7.3. I was having the same issue & realized that a new version of the module had been released recently. Once I reverted back everything worked by just using ‘client = discord.Client()’
i had the same issue, its a version issue use:
pip install -U discord==1.7.3
pip install -U discord.py==1.7.3
this should fix it,
at least for me it did
with older versions of it you cant get the messages try using this
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
I was trying to make a quick bot for discord and I used this code:
import discord
from discord.ui import button, view
from discord.ext import commands
client = discord.Client()
@client.event
async def on_ready():
print('Autenticazione riuscita. {0.user} è online!'.format(client))
But this error pops up:
Client.__init__() missing 1 required keyword-only argument: 'intents'
I tried putting something between the brackets, like this:
import discord
from discord.ui import button, view
from discord.ext import commands
client = discord.Client(0)
@client.event
async def on_ready():
print('Autenticazione riuscita. {0.user} è online!'.format(client))
But instead I get this error:
Client.__init__() takes 1 positional argument but 2 were given
I’m probably missing something obvious, since on another pc the exact same code, with exact same modules and same python version works just fine. Any suggestions?
You could use the default Intents
unless you have a particular one to specify
client = discord.Client(intents=discord.Intents.default())
See Intents for more details
client = discord.Client(intents=discord.Intents.default())
I tried this but I’m still having the same error, I even tried
bot = commands.Bot(intents=discord.Intents.all() , command_prefix= "!" , description='The Best Bot For the Best User!')
bot.add_cog(Music(bot))
but it doesn’t see my commands.
My suggestion here would actually be to uninstall the version of Discord.py you have downloaded & pip install version 1.7.3. I was having the same issue & realized that a new version of the module had been released recently. Once I reverted back everything worked by just using ‘client = discord.Client()’
i had the same issue, its a version issue use:
pip install -U discord==1.7.3
pip install -U discord.py==1.7.3
this should fix it,
at least for me it did
with older versions of it you cant get the messages try using this
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)