Skip to content

Commit

Permalink
Merge pull request #2 from bjoernpy/develop
Browse files Browse the repository at this point in the history
feat: Added heroku support
  • Loading branch information
bjoernpy authored Mar 28, 2020
2 parents 462a303 + 3f0625a commit 4aab59a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: npm run start:prod
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.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "sf-discord-bot",
"version": "0.1.0",
"version": "0.2.0",
"description": "A discord bot for Shakes and Fidget.",
"main": "src/index.js",
"main": "src/bot.js",
"scripts": {
"start": "node .",
"start": "NODE_ENV=development node .",
"start:prod": "NODE_ENV=production node .",
"lint": "eslint .",
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down
13 changes: 9 additions & 4 deletions src/index.js → src/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@ 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.`);
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.`);
});

client.login(token);
// In production mode read the token from env
if (process.env.NODE_ENV === 'production') {
client.login(process.env.BOT_TOKEN);
} else {
client.login(token);
}

0 comments on commit 4aab59a

Please sign in to comment.