Discord 'on_member_join' function not working
Solution 1:
You're probably using discord python 1.5.0 or above, it's a common error, you just need Intents. If there's a error, you are supposed to read it, it will redirect you to your bot in the discord dev portal, there you can activate the privileged gateway intents check this out
And add this to your code
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='.', intents=intents)