I was following this guide to do a discord bot and when I try out my bot, it didn't send messages when a member joined.
The bot connects but it doesn't send messages. My token and server name are replaced because of privacy
bot.py
import os
import discord
token="my token"
GUILD="server name"
intents = discord.Intents()
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'{client.user.name} has connected to Discord!')
@client.event
async def on_member_join(member):
await member.create_dm()
await member.dm_channel.send(
f'Hi {member.name}, welcome to my Discord server!'
)
client.run(token)