Discord.py WELCOMER – How to make a custom image for welcome messages

Tags: , , ,



I’d like to add the “custom” image for new discord users in my server. Just like this: Click here for the image.

This is what I have for now:

@client.event
async def on_member_join(member):

    #setting embed
    em = discord.Embed(color=0x12d600, description=f"Thank you {member.mention}, you're the member number {len(list(member.guild.members))}!")
    em.set_footer(text=f"{member.guild}", icon_url=f"{member.guild.icon_url}")
    em.set_image(url=f"{member.avatar_url}")
    em.timestamp = datetime.datetime.utcnow()
    
    channel = client.get_channel(797807634408275998)
    await channel.send(embed=em)

Answer

You need to use an image processing/manipulation library called pillow aka PIL. You’d have your default/template image, as you provided (without the user specific text). You’d then find the position as to where to write the user specific text.

I found this youtube tutorial, which actually shows how you could possibly implement it into a bot. https://www.youtube.com/watch?v=47CPq5NmhAQ



Source: stackoverflow