[SOLVED] client = MyClient() TypeError: __init__() missing 1 required keyword-only argument: ‘intents’

Question

This Content is from Stack Overflow. Question asked by Ahmad Al Nasser

why do I get this error?

imported discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged in as')
        print(self.user.name)
        print(self.user.id)
        print('------')
                   
client = discord.Client()
client = MyClient()
client.run('token')

Solution

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

Answered by Cory Kramer


This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 4.0.

people found this article helpful. What about you?