diff --git a/discord/ui/modal.py b/discord/ui/modal.py index 4a58dcc06..c85719a9b 100644 --- a/discord/ui/modal.py +++ b/discord/ui/modal.py @@ -235,3 +235,8 @@ class Modal(BaseView): } return payload + + def add_item(self, item: Item[Any]) -> Self: + if len(self._children) >= 5: + raise ValueError('maximum number of children exceeded (5)') + return super().add_item(item)