Skip to content

Commit

Permalink
refactor: missed a spot
Browse files Browse the repository at this point in the history
  • Loading branch information
AstreaTSS committed Aug 27, 2024
1 parent 484b64f commit 8bc1972
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,49 +91,6 @@ def on_error_sentry_hook(self: ipy.Task, error: Exception) -> None:


class PYTHIA(utils.THIABase):
def add_command(self, func: typing.Callable) -> None:
"""
Add a command to the client.
Args:
func: The command to add
"""
if isinstance(func, ipy.ModalCommand):
self.add_modal_callback(func)
elif isinstance(func, ipy.ComponentCommand):
self.add_component_callback(func)
elif isinstance(func, ipy.InteractionCommand):
self.add_interaction(func)
elif isinstance(func, ipy.Listener):
self.add_listener(func)
elif isinstance(func, ipy.GlobalAutoComplete):
self.add_global_autocomplete(func)
elif not isinstance(func, ipy.BaseCommand):
raise TypeError("Invalid command type")

for hook in self._add_command_hook:
hook(func)

if not func.callback:
# for group = SlashCommand(...) usage
return

if isinstance(func.callback, functools.partial):
ext = getattr(func, "extension", None)
self.logger.debug(
f"Added callback: {f'{ext.name}.' if ext else ''}{func.callback.func.__name__}" # noqa: G004
)
else:
self.logger.debug(f"Added callback: {func.callback.__name__}") # noqa: G004

self.dispatch(
ipy.events.CallbackAdded(
callback=func,
extension=func.extension if hasattr(func, "extension") else None,
)
)

@ipy.listen("ready")
async def on_ready(self) -> None:
utcnow = ipy.Timestamp.utcnow()
Expand Down

0 comments on commit 8bc1972

Please sign in to comment.