8 Commits

Author SHA1 Message Date
Rapptz
5010e7dc55 [commands] Add UserInputError into the exception hierarchy.
This is for exceptions that are inherently based on user errors and not
permission based. e.g. passing incorrect number of arguments, too many
arguments, or an invalid argument. CommandNotFound is not classified
under this since it isn't inherently a user input error in all cases.

Some invalid commands can simply be due to an odd bot prefix. It would
also diminish the usefulness of the new parent class if CommandNotFound
was included.
2016-07-21 23:53:16 -04:00
Rapptz
324d10c9d9 [commands] Add Command.ignore_extra attribute to ignore extra arguments
This allows you to strictly require a number of arguments. The default
behaviour in this case is still `True`, since it would be a breaking
change otherwise and is a sane default. However if someone would want
to set this to `False`, they would receive an exception of type
`TooManyArguments` if too many arguments are passed to a command.

Hopefully this removes the uses of `ctx.message.content == 'stuff'`
inside commands.
2016-06-20 21:38:17 -04:00
Rapptz
5f9ed8c9d2 [commands] Make the CommandError required argument optional again. 2016-06-10 23:50:17 -04:00
Rapptz
74cfc53bc8 [commands] Make it so CommandError does not contain @everyone mentions.
Mitigates some permission elevation issues.
2016-06-10 20:40:35 -04:00
Rapptz
43bbecd519 [commands] Exceptions raised while invocation raise CommandInvokeError.
This change should make it a bit more intuitive to get the original
exception without having the gotcha of checking ``isinstance`` inside
the error handler.
2016-06-10 20:32:05 -04:00
Rapptz
25588955e4 [commands] Add a way to enable or disable certain commands. 2016-01-07 17:59:26 -05:00
Rapptz
51186c3ca4 [commands] Add CommandNotFound error. 2016-01-05 01:11:52 -05:00
Rapptz
59ca5ec386 Initial implementation of commands extension module. 2016-01-04 22:22:52 -05:00