#π Need help making my bot send welcome messages in dms to new members.
26 messages Β· Page 1 of 1 (latest)
@lavish maple
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
what library do you use
vs code?
what discord library do you use
ive tried going through the discord.py information page but its hard to navigate
This might work, just make it so it's to the user dm's not a channel
import discord
client = discord.Client()
@client.event
async def on_message_join(member):
channel = client.get_channel(channel_id)
embed=discord.Embed(title=f"Welcome {member.name}", description=f"Thanks for joining {member.guild.name}!") # F-Strings!
embed.set_thumbnail(url=member.avatar_url) # Set the embed's thumbnail to the member's avatar image!
await channel.send(embed=embed)```
!d discord.on_member_join
discord.on_member_join(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member) joins a [`Guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild).
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.members) to be enabled.
did you write this?
It's what I use
hm alright
I tossed it at the end of my code tho, because it doesn't follow the rest of my code
no i thought it was AI generated because of the comments but i'm pretty sure i'm wrong
also btw member_url might be None because it doesnt include discord's default profiles
kek
member_url is not in that code
Or I don't see it
There's embed.set_thumbnail(url=member.avatar_url)
url=member.avatar_url
All o know it works for me
yeah i meant avatar url
what lib do you use?
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.