Skip to content

Commit

Permalink
Merge pull request #3 from bjoernpy/develop
Browse files Browse the repository at this point in the history
fix: Fixed new user messages
  • Loading branch information
bjoernpy authored Mar 28, 2020
2 parents 4aab59a + c88bbda commit 356862a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
14 changes: 11 additions & 3 deletions src/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 356862a

Please sign in to comment.