DevChatterBot
DevChatterBot copied to clipboard
After adding/removing commands, commandhandler needs updates
When I removed !learn and added a new one, calling it still called the old one.
It seems like the SimpleCommands aren't refreshing.
Hi there! I saw your show today so I started digging into some issues. I was going to take a stab at this one, but I see a few options on how to approach this:
- We have a centralized CommandList as a static property in the application that we keep in sync
- We implement a caching strategy for the command list and other items, and invalidate the cache upon changes to the SimpleCommands
- We just do a local check where if commands hasn't been updated in x minutes, we have it reload itself
- We create a delegate that CommandHandler can register with the CommandsCommand that triggers a refresh when the Commands command is called
I'm up for any. I think the last one can work pretty elegantly, and the caching option will require more thought on what other entities should be cached.
I like the idea of a caching strategy for the SimpleCommands, which would invalidate when changing commands.