I currently have a discord.js bot hosted on Heroku. I want to schedule a daily message, but Heroku Scheduler takes a single .js
file to run a scheduled task. If I were to schedule it, I would have to copy the basic code from my index.js
and create another instance of the bot to send the scheduled message. Is there a better way to schedule a Discord message on Heroku?
CodePudding user response:
If you really want to keep it simple, you can use the Discord API directly, without discord.js. Take a look at the documentation for the Create Message endpoint. You can use a library like axios to make the request in your single scheduled .js
file.
You can also use the @discordjs/rest package, which allows you to more easily make requests to the Discord API without having to spin up an entire gateway-connected bot.