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 providing an argument by 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
On another PC the exact same code, with exact same modules and same Python version works just fine. What am I missing?
You could use the default Intents
unless you have a particular one to specify.
client = discord.Client(intents=discord.Intents.default())
As the first error message says, it is a keyword-only argument, so you cannot write discord.Client(discord.Intents.default())
without intents=
.
See Intents for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With