I created a Discord bot for my server using the discord.py library. The bot works perfectly when I run it on my local machine, but after deploying it to Heroku through GitHub integration, it’s not responding to commands.
I connected my GitHub repository directly to Heroku and deployed from there. The deployment process completed without errors, but when I try to use any bot commands in Discord, nothing happens. The bot appears online but doesn’t execute any functions.
Has anyone experienced similar issues with Discord bots on Heroku? What could be causing the bot to work locally but fail in the cloud environment?
Had this exact issue when I moved my bot to Heroku. Problem was my environment variables weren’t set up right on the production server. Your bot token and other credentials from your .env file won’t automatically transfer - you’ve got to manually add them to Heroku’s config vars in the dashboard. Also check if you’re missing dependencies. Make sure your requirements.txt has all the packages with the right versions. And double-check your bot’s intents in the Discord developer portal - some hosts are pickier about permissions than your local setup.
you might wanna check if ur dyno is asleep or if you need to scale it up. on the heroku dashboard, look for a worker dyno 'cuz discord bots need one. also, double check your Procfile has the start command set right.
Check your Heroku logs first - that’s where you’ll find what’s actually breaking. Run heroku logs --tail or check the dashboard. When this happened to me, the bot was crashing silently and the logs showed it was missing a Python version requirement. Make sure your Procfile syntax is right too - should be worker: python bot.py, not web: python bot.py since Discord bots don’t serve web traffic. Also heads up - if you’re on the free tier, you might’ve hit your monthly dyno hours limit.