I'm trying to figure out how to create a command that "reloads" the Discord Bot commands and allows me to keep the bot running while I add new commands.
It just makes my life easier, so I don't need to restart the bot.
My bot is on Heroku. I've already tried reload_extension and load_extension, unload_extension, it reloads the cog, but no changes have been made. On repl.it, the same code works and changes are made
@client.command()
@commands.is_owner()
async def reload(ctx, extension):
client.unload_extension(f"cogs.{extension}")
client.load_extension(f"cogs.{extension}")
await ctx.message.add_reaction("✅")
@client.command()
@commands.is_owner()
async def reloadd(ctx, extension):
client.reload_extension(f"cogs.{extension}")
await ctx.message.add_reaction("✅")
I will be glad if you can help!
CodePudding user response:
This sadly isn't possible due to Heroku's deploy process. If you want to update code on Heroku, you would need to trigger a build, and during that phase, Heroku automatically restarts your bot to apply the new code changes.