In some cases, the Discord provided role_mentions and mentions array
would be empty, such as wrapping a mention with a backtick or
other frivolous characters. Since we want to completely nullify
mentions, we should not rely on the Discord provided arrays and instead
use and resolve the IDs from the content itself.
The old code for some reason assumed that the length of the command
would be 1. This is because when I tested this I would use single
letter command names and it would "just work" when in reality it was
completely incorrect.
A reminder to thoroughly test instead of just fitting something to work
When unloading cogs, currently we do not remove submodules from
sys.modules, meaning they will not be reloaded. Removing here
makes new imports reload from file. Of course, any already imported
modules will still hold a reference to the old module, since they
will not re-import it, and will not be forcably unloaded.
Previously, Context.command was not guaranteed to be the actual command
being checked if it can run. This could be troublesome when
implementing help commands or when using the default help command.
This new change allows at least for the guarantee that Context.command
to be technically correct in Command.can_run.
There is a counterpart for this in cogs, called __global_check_once.
This allows for predicates that would filter a command globally that
do not necessarily require rechecking in the case of e.g. the help
command such as blocking users or blocking channels.
Context.reinvoke would be the new way to bypass checks and cooldowns.
However, with its addition comes a change in the invocation order of
checks, callbacks, and cooldowns. While previously cooldowns would
trigger after command argument parsing, the new behaviour parses
cooldowns before command argument parsing.
The implication of this change is that Context.args and Context.kwargs
will no longer be filled properly.
Along with this change comes with the removal of Converter.prepare and
adding two arguments to Converter.convert, the context and the argument.
I suppose an added benefit is that you don't have to do attribute
access since it's a local variable.