Welcomer bot for discord

Hey so i made my bot say Hi to when someone joins the server but i also want the bot to send a image with it but i just have the images url so how can i do that and where do i put the image code

Hi, we can’t provide support for that bot as we don’t make that bot. However you can see their documentation here.

This implies that they own the bot. In this case, it seems like they need help with their code.


There used to be a tutorial on this on https://discordjs.guide, but I can’t find it any longer. I happen to have it used it for my bot, so here you go:

client.on("guildMemberAdd", async member => {
    const general = member.guild.channels.cache.find(ch => ch.name === 'general'); // NAME OF THE CHANNEL TO SEND THE MESSAGE
    if (!general) return;

    const Canvas = require('canvas');

    const canvas = Canvas.createCanvas(700, 250);
    const ctx = canvas.getContext('2d');

    const background = await Canvas.loadImage('IMAGE_URL'); // replace IMAGE_URL with the url of the image that will be shown as background
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

    ctx.strokeStyle = '#74037b';
    ctx.strokeRect(0, 0, canvas.width, canvas.height);

    // Slightly smaller text placed above the member's display name
    ctx.font = '28px sans-serif';
    ctx.fillStyle = '#ffffff';
    ctx.fillText('Welcome to the server,', canvas.width / 2.5, canvas.height / 3.5);

    // Add an exclamation point here and below
    ctx.font = applyText(canvas, `${member.displayName}!`);
    ctx.fillStyle = '#ffffff';
    ctx.fillText(`${member.displayName}!`, canvas.width / 2.5, canvas.height / 1.8);

    ctx.arc(125, 125, 100, 0, Math.PI * 2, true);

    const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ format: 'jpg' }));
    ctx.drawImage(avatar, 25, 25, 200, 200);

    const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'welcome-image.png');

    general.send(`Welcome to the server, ${member}!`, attachment);

After re-reading your post, I realised that you already the URL to an image. So on Discord, sending the URL of an image will automatically load the image on Discord.


My above example allows you to dynamically generate a welcome picture, but it might be hard to customize whether or not you know how to use canvases.

1 Like