I just followed tutorials on YouTube but my code does not work
import discord
import os
client = discord.Client(intents=discord.Intents.default())
@client.event
async def on_ready():
print("I'am ready")
@client.event
async def on_message(message):
print(message.content)
if message.author == client. User:
return
if message.content.startswith("sa"):
await message.channel.send("as")
client.run(os.environ['TOKEN'])
this code for read message and print it's content from any channel
all you need to do is change
client = discord. Client(intents=discord.Intents.default())
with
client = discord. Client(intents=discord.Intents.all())