mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-09-21 03:27:42 +00:00
Fixed item state management in the UI View
* Fix ActionRow add_item type validation * Fix View item state tracking * Fix View add and remove item state * Add UI view item state tests
This commit is contained in:
@@ -260,15 +260,15 @@ class ActionRow(Item[V]):
|
||||
or (40) for the entire view.
|
||||
"""
|
||||
|
||||
if not isinstance(item, Item):
|
||||
raise TypeError(f'expected Item not {item.__class__.__name__}')
|
||||
|
||||
if (self._weight + item.width) > 5:
|
||||
raise ValueError('maximum number of children exceeded')
|
||||
|
||||
if len(self._children) >= 5:
|
||||
raise ValueError('maximum number of children exceeded')
|
||||
|
||||
if not isinstance(item, Item):
|
||||
raise TypeError(f'expected Item not {item.__class__.__name__}')
|
||||
|
||||
if self._view:
|
||||
self._view._add_count(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user