Closed Tadas closed 6 years ago
I don't know if there is an official/better way, but I don't restart the bot. I make changes to my plugins and then I run !rp sompluginname
to remove it, followed by !ip somepluginname
to install it again. There is also the command !updateplugin somepluginname
to update the existing plugin.
If you are just restarting the bot, it will keep the same plugin version you've already loaded.
My standard workflow when changing/updating a plugin is to update the code in the psm1 file, update the version in the psd1 file and then remove/(re)install or update the plugin. I never stop the bot
Yeah !rp
would work since https://github.com/poshbotio/PoshBot/issues/100 has been fixed
Still, it's kind of surprising that restarting something doesn't completely re-initialise the state, it's one of the core tenets of IT :)
@Tadas Adding -Force
here will probably work. I suspect that is why your changes to a plugin/module without changing the version is why they aren't being picked up. https://github.com/poshbotio/PoshBot/blob/d1fba821896d58a01656b01a5224e6be0171ea06/PoshBot/Classes/PluginManager.ps1#L467
When you say you're restarting the bot, are you running it interactively, as a job, or as a service? Depending on what you're doing, the PS session isn't closing and therefore the plugin/module is still loaded. Adding -Force
to Import-Module
should fix that.
While working on a plugin I've added a new function to the plugin module. I've restarted PoshBot but the new function isn't detected. Changes to existing functions seem to get picked up.
Expected Behavior
If I make changes to a plugin module and restart the bot I'd expect the changes to become live
Current Behavior
Possible Solution
Add
-Force
to Import-Module ? https://github.com/poshbotio/PoshBot/blob/d1fba821896d58a01656b01a5224e6be0171ea06/PoshBot/Classes/PluginManager.ps1#L467Steps to Reproduce (for bugs)
!help
and observe functions in our plugin!help
and observe functions in our pluginContext
Your Environment