1

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)
jowell
  • 11
  • 2
  • Have you checked the following? https://stackoverflow.com/questions/64831017/how-do-i-get-the-discord-py-intents-to-work – CarlosSR Jan 30 '23 at 18:39

0 Answers0