Skip to content

Commit

Permalink
Update core.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dasupergrasskakjd committed Jan 2, 2024
1 parent e29f7f0 commit 3f0168c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ async def __call__(self, ctx, *args, **kwargs):
convert the arguments beforehand, so take care to pass the correct
arguments in.
"""
if self.cog:
if self.cog is not None:
return await self.callback(self.cog, ctx, *args, **kwargs)
return await self.callback(ctx, *args, **kwargs)

Expand Down Expand Up @@ -392,7 +392,7 @@ async def can_run(self, ctx: ApplicationContext) -> bool:
predicates = self.parent.checks + predicates

cog = self.cog
if cog:
if cog is not None:
local_check = cog._get_overridden_method(cog.cog_check)
if local_check is not None:
ret = await maybe_coroutine(local_check, ctx)
Expand All @@ -414,13 +414,13 @@ async def dispatch_error(self, ctx: ApplicationContext, error: Exception) -> Non
pass
else:
injected = wrap_callback(coro)
if cog:
if cog is not None:
await injected(cog, ctx, error)
else:
await injected(ctx, error)

try:
if cog:
if cog is not None:
local = cog.__class__._get_overridden_method(cog.cog_command_error)
if local is not None:
wrapped = wrap_callback(local)
Expand Down Expand Up @@ -544,7 +544,7 @@ async def call_after_hooks(self, ctx: ApplicationContext) -> None:
await self._after_invoke(ctx) # type: ignore

# call the cog local hook if applicable:
if cog:
if cog is not None:
hook = cog.__class__._get_overridden_method(cog.cog_after_invoke)
if hook is not None:
await hook(ctx)
Expand Down Expand Up @@ -998,7 +998,7 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
if o._parameter_name not in kwargs:
kwargs[o._parameter_name] = o.default

if self.cog:
if self.cog is not None:
await self.callback(self.cog, ctx, **kwargs)
elif self.parent is not None and self.attached_to_group is True:
await self.callback(self.parent, ctx, **kwargs)
Expand Down

0 comments on commit 3f0168c

Please sign in to comment.