synicalsyntax / discord.js-heroku Goto Github PK
View Code? Open in Web Editor NEWAn in-depth guide on deploying your Discord.js bot on Heroku
License: MIT License
An in-depth guide on deploying your Discord.js bot on Heroku
License: MIT License
Instead of
setInterval(() => {
http.get('http://discordjs-heroku.herokuapp.com');
}, 900000);
Just change the text in the Procfile to
BOT: node index.js
And DISABLE the WEB Dyno on heroku, and ENABLE the BOT Dyno on heroku.
Using the npm start script and having the WEB Dyno enabled will tell heroku it is a website and that it can sleep.
This is the official way to disable sleeping and wont use excess resources loading the website every 15 mins.
the bot keeps leaving the vc whenever i request a song because of the code
what do i do
You have a bit of code that refreshes the web worker to keep the app awake, but if you had read the heroku docs, you would know that if you disable the web worker, put a custom name in the procfile and a custom start command, it will naturally not sleep.
Heroku only sleeps apps because its default action is for web hosting, which doesn't need to be awake 24/7.
But if you disable that and use a custom worker it will stay up 24/7 until you run out of hours.
In fact by doing this you are using more resources hosting the web dyno and connecting to it.
PR Incoming
Hello, after launching my heroku app it's giving me this log:
2018-04-06T11:46:07.785538+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-04-06T11:46:07.785690+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-04-06T11:46:07.918173+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-06T11:46:07.899719+00:00 heroku[web.1]: Process exited with status 137
Is there a way to fix this?
2018-09-23T08:14:48.963688+00:00 heroku[web.1]: State changed from crashed to starting
2018-09-23T08:14:52.000000+00:00 app[api]: Build succeeded
2018-09-23T08:14:54.586216+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-23T08:14:57.743158+00:00 app[web.1]:
2018-09-23T08:14:57.743175+00:00 app[web.1]: > [email protected] start /app
2018-09-23T08:14:57.743176+00:00 app[web.1]: > node index.js
2018-09-23T08:14:57.743178+00:00 app[web.1]:
2018-09-23T08:14:59.914132+00:00 app[web.1]: AUIB system online
2018-09-23T08:14:59.915952+00:00 app[web.1]: Found guild: Another Chance
2018-09-23T08:14:59.918248+00:00 app[web.1]: Found guild: /r/SpaceboyRoss
2018-09-23T08:15:55.143852+00:00 heroku[web.1]: State changed from starting to crashed
2018-09-23T08:15:55.005857+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-09-23T08:15:55.005857+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-09-23T08:15:55.125602+00:00 heroku[web.1]: Process exited with status 137
Hello,
I have followed your tutorial and the deploy works fine but when the app run it says the discord.js module could not be found. Seens like the server is not running npm install
before npm start
.
Here is my package.json
{
"name": "reign-bdo-discord-bot",
"version": "0.0.1",
"requires": true,
"lockfileVersion": 1,
"engines": {
"node": "8.x",
"npm": "*"
},
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"author": "ygordanniel",
"license": "MIT",
"dependencies": {
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha1-ePrtjD0HSrgfIrTphdeehzj3IPg="
},
"discord.js": {
"version": "11.3.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.3.0.tgz",
"integrity": "sha1-DT4q4ShG5OACvb3+PLJl4r8kvzI=",
"requires": {
"long": "3.2.0",
"prism-media": "0.0.1",
"snekfetch": "3.6.4",
"tweetnacl": "1.0.0",
"ws": "4.0.0"
}
},
"long": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
"integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s="
},
"moment": {
"version": "2.20.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.20.1.tgz",
"integrity": "sha512-Yh9y73JRljxW5QxN08Fner68eFLxM5ynNOAw2LbIB1YAGeQzZT8QFSUvkAz609Zf+IHhhaUxqZK8dG3W/+HEvg=="
},
"prism-media": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.1.tgz",
"integrity": "sha1-o0JcnKvVDRxsAuVDlBoRiVZnvRA="
},
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM="
},
"snekfetch": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",
"integrity": "sha1-0T6AphbYkvPTjarkKJ9NJYpkUSA="
},
"tweetnacl": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.0.tgz",
"integrity": "sha1-cT2LgY2kIGh0C/aDhtBHnmb8ins="
},
"ultron": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
"integrity": "sha1-n+FTahCmZKZSZqHjzPhf02MCvJw="
},
"ws": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-4.0.0.tgz",
"integrity": "sha1-v+HaTAjuuXgLmG4OTRDszXNFmZ8=",
"requires": {
"async-limiter": "1.0.0",
"safe-buffer": "5.1.1",
"ultron": "1.1.1"
}
}
}
}
Let me know if you need more information.
Hey!
This guide has really helped me, so thanks for doing it!
Even that, I faced a problem: GitHub recently changed the default branch from master to main, but your guide still says master. I think it could be a good idea to change "master" to "main" or, at least, advice both possibilities.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.