mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-18 12:04:54 +00:00
Move v2 item check from BaseView to View
This commit is contained in:
@@ -426,9 +426,6 @@ class BaseView:
|
|||||||
if not isinstance(item, Item):
|
if not isinstance(item, Item):
|
||||||
raise TypeError(f'expected Item not {item.__class__.__name__}')
|
raise TypeError(f'expected Item not {item.__class__.__name__}')
|
||||||
|
|
||||||
if item._is_v2() and not self._is_layout():
|
|
||||||
raise ValueError('v2 items cannot be added to this view')
|
|
||||||
|
|
||||||
item._update_view(self)
|
item._update_view(self)
|
||||||
self._add_count(item._total_count)
|
self._add_count(item._total_count)
|
||||||
self._children.append(item)
|
self._children.append(item)
|
||||||
@@ -737,6 +734,9 @@ class View(BaseView):
|
|||||||
if len(self._children) >= 25:
|
if len(self._children) >= 25:
|
||||||
raise ValueError('maximum number of children exceeded')
|
raise ValueError('maximum number of children exceeded')
|
||||||
|
|
||||||
|
if item._is_v2():
|
||||||
|
raise ValueError('v2 items cannot be added to this view')
|
||||||
|
|
||||||
super().add_item(item)
|
super().add_item(item)
|
||||||
try:
|
try:
|
||||||
self.__weights.add_item(item)
|
self.__weights.add_item(item)
|
||||||
|
Reference in New Issue
Block a user