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:
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?
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)