Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

Can somebody assist me here with the error I’m getting?

The code:

import discord
import os
from dotenv import load_dotenv
from neuralintents import GenericAssistant


chatbot = GenericAssistant('intents.json')
chatbot.train_model()
chatbot.save_model()

client = discord.Client()

load_dotenv()
TOKEN = os.getenv('TOKEN')
TOKEN = "my token"

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith("!"):
        response = chatbot.request(message.content[2:])
        await message.channel.send(response)

client.run("my token")

The error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Traceback (most recent call last):
  File "C:\Users\-----\Desktop\Bot\main.py", line 11, in <module>
    client = discord.Client()
TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

I am not quite sure why I’m getting this error, it used to work like this in the past.

Have there been any changes made?

>Solution :

You shoud pass the argument ‘intent’ to the Client constructor. You can try to replace the line:

client = discord.Client()

with:

intents = discord.Intents.default()
intents.message_content = True

client = discord.Client(intents=intents)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading