Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Commit

Permalink
[cleanup] docs + deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
b1naryth1ef committed Jul 18, 2017
1 parent 1180884 commit 320add9
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 25 deletions.
15 changes: 13 additions & 2 deletions disco/bot/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class CommandError(Exception):
An exception which is thrown when the arguments for a command are invalid,
or don't match the command's specifications.
"""
def __init__(self, msg):
self.msg = msg


class Command(object):
Expand Down Expand Up @@ -159,7 +161,16 @@ def __call__(self, *args, **kwargs):
def get_docstring(self):
return (self.func.__doc__ or '').format(**self.context)

def update(self, args=None, level=None, aliases=None, group=None, is_regex=None, oob=False, context=None, parser=False, **kwargs):
def update(self,
args=None,
level=None,
aliases=None,
group=None,
is_regex=None,
oob=False,
context=None,
parser=False,
**kwargs):
self.triggers += aliases or []

def resolve_role(ctx, rid):
Expand Down Expand Up @@ -280,7 +291,7 @@ def execute(self, event):
try:
parsed_kwargs = self.args.parse(event.args, ctx=event)
except ArgumentError as e:
raise CommandError(e.message)
raise CommandError(e.args[0])
elif self.parser:
event.parser = self.parser
parsed_kwargs['args'] = self.parser.parse_args(
Expand Down
2 changes: 1 addition & 1 deletion disco/bot/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def execute(self, event):
try:
return event.command.execute(event)
except CommandError as e:
event.msg.reply(e.message)
event.msg.reply(e.msg)
return False
finally:
self.ctx.drop()
Expand Down

0 comments on commit 320add9

Please sign in to comment.