mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-16 18:59:09 +00:00
Add View.remove_item and View.clear_items
This commit is contained in:
parent
3453992ce6
commit
97f308d219
@ -179,6 +179,24 @@ class View:
|
|||||||
item._view = self
|
item._view = self
|
||||||
self.children.append(item)
|
self.children.append(item)
|
||||||
|
|
||||||
|
def remove_item(self, item: Item) -> None:
|
||||||
|
"""Removes an item from the view.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
-----------
|
||||||
|
item: :class:`Item`
|
||||||
|
The item to remove from the view.
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.children.remove(item)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def clear_items(self) -> None:
|
||||||
|
"""Removes all items from the view."""
|
||||||
|
self.children.clear()
|
||||||
|
|
||||||
async def interaction_check(self, interaction: Interaction) -> bool:
|
async def interaction_check(self, interaction: Interaction) -> bool:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user