From 6d5b92ad698034f848b1925613813cf3f8e1ece6 Mon Sep 17 00:00:00 2001 From: Slipstream Date: Tue, 10 Jun 2025 16:44:02 -0600 Subject: [PATCH] Fixes component type checking and import issues Changes component validation to use the more general ComponentModel instead of ActionRowModel, allowing broader component types to be processed correctly. Makes reply content parameter optional to improve API flexibility. Adds missing import for Cog class to prevent runtime errors during cog validation. --- disagreement/client.py | 4 ++-- disagreement/ext/commands/core.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/disagreement/client.py b/disagreement/client.py index b5c06ae..bd15b0b 100644 --- a/disagreement/client.py +++ b/disagreement/client.py @@ -920,12 +920,12 @@ class Client: await view._start(self) components_payload = view.to_components_payload() elif components: - from .models import ActionRow as ActionRowModel + from .models import Component as ComponentModel components_payload = [ comp.to_dict() for comp in components - if isinstance(comp, ActionRowModel) + if isinstance(comp, ComponentModel) ] message_data = await self._http.send_message( diff --git a/disagreement/ext/commands/core.py b/disagreement/ext/commands/core.py index 2091aaf..21dfa7b 100644 --- a/disagreement/ext/commands/core.py +++ b/disagreement/ext/commands/core.py @@ -128,7 +128,7 @@ class CommandContext: async def reply( self, - content: str, + content: Optional[str] = None, *, mention_author: Optional[bool] = None, **kwargs: Any, @@ -240,6 +240,7 @@ class CommandHandler: return self.commands.get(name.lower()) def add_cog(self, cog_to_add: "Cog") -> None: + from .cog import Cog if not isinstance(cog_to_add, Cog): raise TypeError("Argument must be a subclass of Cog.")