aboutsummaryrefslogtreecommitdiff
path: root/discord/ext
diff options
context:
space:
mode:
Diffstat (limited to 'discord/ext')
-rw-r--r--discord/ext/commands/bot.py7
-rw-r--r--discord/ext/commands/cog.py6
-rw-r--r--discord/ext/commands/context.py2
-rw-r--r--discord/ext/commands/core.py5
-rw-r--r--discord/ext/tasks/__init__.py2
5 files changed, 10 insertions, 12 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index c9ec03a6..a4e74125 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -165,9 +165,8 @@ class BotBase(GroupMixin):
return
cog = context.cog
- if cog:
- if Cog._get_overridden_method(cog.cog_command_error) is not None:
- return
+ if cog and Cog._get_overridden_method(cog.cog_command_error) is not None:
+ return
print('Ignoring exception in command {}:'.format(context.command), file=sys.stderr)
traceback.print_exception(type(exception), exception, exception.__traceback__, file=sys.stderr)
@@ -770,7 +769,7 @@ class BotBase(GroupMixin):
self._remove_module_references(lib.__name__)
self._call_module_finalizers(lib, name)
self.load_extension(name)
- except Exception as e:
+ except Exception:
# if the load failed, the remnants should have been
# cleaned from the load_extension function call
# so let's load it from our old compiled library.
diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py
index 57c78b4e..a7a76737 100644
--- a/discord/ext/commands/cog.py
+++ b/discord/ext/commands/cog.py
@@ -96,7 +96,7 @@ class CogMeta(type):
def __new__(cls, *args, **kwargs):
name, bases, attrs = args
attrs['__cog_name__'] = kwargs.pop('name', name)
- attrs['__cog_settings__'] = command_attrs = kwargs.pop('command_attrs', {})
+ attrs['__cog_settings__'] = kwargs.pop('command_attrs', {})
description = kwargs.pop('description', None)
if description is None:
@@ -126,7 +126,7 @@ class CogMeta(type):
commands[elem] = value
elif inspect.iscoroutinefunction(value):
try:
- is_listener = getattr(value, '__cog_listener__')
+ getattr(value, '__cog_listener__')
except AttributeError:
continue
else:
@@ -192,7 +192,7 @@ class Cog(metaclass=CogMeta):
parent = lookup[parent.qualified_name]
# Update our parent's reference to our self
- removed = parent.remove_command(command.name)
+ parent.remove_command(command.name)
parent.add_command(command)
return self
diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py
index 8af9c5e8..09449921 100644
--- a/discord/ext/commands/context.py
+++ b/discord/ext/commands/context.py
@@ -313,7 +313,7 @@ class Context(discord.abc.Messageable):
entity = bot.get_cog(entity) or bot.get_command(entity)
try:
- qualified_name = entity.qualified_name
+ entity.qualified_name
except AttributeError:
# if we're here then it's not a cog, group, or command.
return None
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 9cef19e5..16c1276c 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -715,9 +715,8 @@ class Command(_BaseCommand):
except RuntimeError:
break
- if not self.ignore_extra:
- if not view.eof:
- raise TooManyArguments('Too many arguments passed to ' + self.qualified_name)
+ if not self.ignore_extra and not view.eof:
+ raise TooManyArguments('Too many arguments passed to ' + self.qualified_name)
async def call_before_hooks(self, ctx):
# now that we're done preparing we can call the pre-command hooks
diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py
index 94917ca0..9f687005 100644
--- a/discord/ext/tasks/__init__.py
+++ b/discord/ext/tasks/__init__.py
@@ -103,7 +103,7 @@ class Loop:
now = datetime.datetime.now(datetime.timezone.utc)
if now > self._next_iteration:
self._next_iteration = now
- except self._valid_exception as exc:
+ except self._valid_exception:
self._last_iteration_failed = True
if not self.reconnect:
raise