I need my discord bot to remember which channel to send a greeting to in different guilds. For now, I have the channel name as a prefix and I use that to recall where to send it:
//greeting new users script
bot.on('guildMemberAdd', member => {
// Send the message to a designated channel on a server:
const WelcomeChannel = member.guild.channels.cache.find(ch => ch.name === config.WelcomeChannelVar);
// Do nothing if the channel wasn't found on this server
if (!WelcomeChannel) return;
const welcomeEmbed = new Discord.MessageEmbed()
.setAuthor(member.displayName.toString() + '#' + member.user.discriminator, member.user.displayAvatarURL())
.setTitle('someone joined!')
.setDescription('welcome to **' + member.guild.name + '**, <@' + member.id + '> !')
.setColor(0x348a58)
.setThumbnail(member.user.avatarURL())
.setFooter('you\'re member #' + member.guild.memberCount + '!')
setTimeout(() => {
WelcomeChannel.send(welcomeEmbed)
}, 200);
member.send("welcome to " + member.guild.name + "! please **read the rules**, and *follow them* :) if you need any help, please **ping a staff member**.");
});
How do I set a command that owners can use when the bot joins their guild that sets a unique welcome channel for each guild (and obviously only send welcome messages to people who join in their guild).
Oh, and how do I set a command that eventually lets people change the welcome message for their guild?
Thanks! :)