Currently, if a command requires an account to be registered, the bot has to ping NickServ every single time a user attempts to use the command. This can cause commands to be slow, or can cause commands to fail if the status check times out.
We can get around this by caching registered nicks. However, it can't be time-based, because an imposter could join immediately after a registered account quits. So the cache should only be maintained as long as the bot can confirm that the user has not logged out.
When a user uses a command, the bot checks if the user's nick is in the "known to be registered" cache. If so, authentication passes. Otherwise, the bot checks with NickServ as it does now, and writes to the cache if the response is successful.
If a user changes their nickname, the old nickname should be evicted from the cache.
If a user quits the network, their nickname should be evicted from the cache.
If a user leaves all of the channels where the bot is present, their nickname should be evicted from the cache. Note that this requires reference counting for all the users in the bot's channels.
Along the same lines, if a user uses a command by PM and is not in any of the bot's channels, their registration status should not be cached.
If the bot gets disconnected or quits the network, the cache should be cleared.
Currently, if a command requires an account to be registered, the bot has to ping NickServ every single time a user attempts to use the command. This can cause commands to be slow, or can cause commands to fail if the status check times out.
We can get around this by caching registered nicks. However, it can't be time-based, because an imposter could join immediately after a registered account quits. So the cache should only be maintained as long as the bot can confirm that the user has not logged out.