Reputation:
I'm writing a bot for my discord server and I want to send an automatic direct message to anyone who joins the server for the first time. I have looked through the documentation and I can't find anything about how to do this. I am using python 3.5 and discord.py version 0.16.12.
Upvotes: 0
Views: 3793
Reputation: 21
this should work if you are using the discord py rewrite
make sure you have enabled intents for the bot as shown in this picture
intents=discord.Intents.all()
client = commands.Bot(command_prefix= cmd,intents=intents)
@client.event
async def on_member_join(member):
await member.send(f"your welcome message here")
Upvotes: 1
Reputation: 314
https://discordpy.readthedocs.io/en/latest/api.html#discord.on_member_join
You can do something along the lines of:
await bot.send_message(member, "hello")
Upvotes: 0