I have been trying to make a Discord bot respond to on_message method and it is not replying for the 'haki.' prefix I added in Discord.
Here is what I have so far:
import discord
token = "mydiscordbottoken"
client = discord.Client(intents=discord.Intents.default())
command_prefix = "haki."
@client.event
async def on_ready():
print('{0.user} BOT is ready'.format(client))
@client.event
async def on_message(message):
if message.author != client.user and message.content.startswith(command_prefix):
await message.channel.send(message)
client.run(token)
Following a tutorial. He only uses client = discord.Client(), which when I tried would give me an TypeError: init() missing 1 required keyword-only argument: 'intents'. But when I use client = discord.Client(intents=discord.Intents.default()) then run it. My discord bot is online and ready on the server. I believe that the bot can't read my discord messages based of that, but I'm not entirely sure. Any fixes would be greatly appreciated. (ex: haki.Hello should prompt the bot to say Hello)