diff --git a/package-lock.json b/package-lock.json index c58364b..a1d8b24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "sf-discord-bot", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3eb7cbd..aa45928 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sf-discord-bot", - "version": "0.2.0", + "version": "0.2.1", "description": "A discord bot for Shakes and Fidget.", "main": "src/bot.js", "scripts": { diff --git a/src/bot.js b/src/bot.js index 25ddf6d..ee73656 100644 --- a/src/bot.js +++ b/src/bot.js @@ -45,9 +45,17 @@ client.on('message', message => { }); client.on('guildMemberAdd', member => { - const channel = client.channels.cache.get(welcome_channel_id); - if (!channel) return; - channel.send(`Welcome ${member} to our Server. If you want my help call me with ${prefix}help.`); + var channel; + if (process.env.NODE_ENV === 'production') { + channel = client.channels.cache.get(process.env.WELCOME_CHANNEL_ID); + } else { + channel = client.channels.cache.get(welcome_channel_id); + } + if (!channel) { + console.log(`A new member called ${member.displayName} joined the Server ${member.guild.name}, but no welcome channel was found.`); + return; + } + channel.send(`Welcome ${member.displayName} to our Server ${member.guild.name}. If you want my help call me with ${prefix}help.`); }); // In production mode read the token from env