Home > database >  Placing the the user avatar image in the right place in the welcome banner discord.py
Placing the the user avatar image in the right place in the welcome banner discord.py

Time:01-02

I'm trying to place the user name and the user image in the right place in the welcome banner but I can't mess with pixel well

Banner

Try this

import  discord

from discord import File
from discord.ext import commands

from easy_pil import Editor
from easy_pil import Font
from easy_pil import load_image_async


bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())

@bot.event
async def on_member_join(member):
    channel = member.guild.system_channel

    background = Editor('assets/welcome.png')
    profile_image = await load_image_async(str(member.avatar.url))

    profile = Editor(profile_image).resize((310,310)).circle_image()
    poppins = Font.poppins(size=50, variant='bold')

    poppins_small = Font.poppins(size=20, variant='light')

    background.paste(profile,(115,105))
    background.ellipse((115,105), 310, 310, outline='white', stroke_width=5)
    background.text((115,415), f'{member.display_name}', color='white', font=poppins, align='center')

    file = File(fp=background.image_bytes,filename='assets/welcome.png')
    await channel.send(file=file)
    await channel.send(f'Hello {member.mention} Welcome To **{member.guild.name} You are the **{len(bot.get_all_members())}th**')

bot.run('')
  • Related