diff --git a/src/main.py b/src/main.py index 49a1a56..14048c9 100644 --- a/src/main.py +++ b/src/main.py @@ -111,6 +111,21 @@ class Client(commands.Bot): super().__init__(*args, **kwargs) self.web: typing.Optional[asyncio.Task] = None self.uptime_thread = None + + async def on_connect(self): + log.debug("Walking the following application commands: %r", list(self.walk_application_commands())) + for command in self.walk_application_commands(): + log.debug("Checking %r", command) + try: + assert command.input_type is not None, "Input type was None!" + _ = command.to_dict() + except Exception as e: + log.error("Failed to convert %r to dict", command, exc_info=e) + self.remove_application_command(command) + else: + log.debug("Loaded command %r.", command) + log.info("Connected to Discord.") + super().on_connect() async def start(self, token: str, *, reconnect: bool = True) -> None: if CONFIG["jimmy"].get("uptime_kuma_url"): @@ -276,16 +291,4 @@ if __disabled: else: log.info("No commands to disable. Full steam ahead!") -log.debug("Walking the following application commands: %r", list(bot.walk_application_commands())) -for command in bot.walk_application_commands(): - log.debug("Checking %r", command) - try: - assert command.input_type is not None, "Input type was None!" - d = command.to_dict() - except Exception as e: - log.error("Failed to convert %r to dict", command, exc_info=e) - bot.remove_application_command(command) - else: - log.debug("Loaded command %r.", command) - bot.run(CONFIG["jimmy"]["token"])