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.
This commit is contained in:
parent
60a183742a
commit
6d5b92ad69
@ -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(
|
||||
|
@ -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.")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user