Skip to content
How to make a setwelcome command that displays the welcome message discord.js
Profile icon
[deleted]

Hi there! I am currently making a discord.js v12 bot, and I have a welcome message command in the bot. As of now, the code just finds a channel name of welcome, and puts the message there. I want to change that to where a user can run a .setwelcome command, and it will then display the welcome message there. How could I do this?

(Here is my current code):

client.on('guildMemberAdd', member => { if (!member.guild) return; let guild = member.guild let channel = guild.channels.cache.find(c => c.name === "welcome"); let membercount = guild.members if (!channel) return; let embed = new Discord.MessageEmbed() .setColor("GREEN") .setTitle("New Server Member!") .setDescription(`Welcome, ${member.user.tag} to **${guild.name}!**`) .setThumbnail(member.user.displayAvatarURL()) //.setFooter(`You are the ${membercount}th member to join`); channel.send(embed); });
You are viewing a single comment. View All
Profile icon
Coder100

You would need a database for that.

Profile icon
[deleted]

could I use a .json file?

@Coder100