(interactions): Basic select menu support.

This commit is contained in:
2022-04-18 13:40:38 +03:00
parent cc7c988007
commit e73302d21f
2 changed files with 83 additions and 58 deletions

View File

@@ -43,10 +43,20 @@ class ButtonPress(ComponentInteraction):
__slots__ = ()
class Selection(ComponentInteraction):
__slots__ = ('values',)
def _from_data(self, data):
super()._from_data(data)
self.values = data['data']['values']
def _component_interaction_factory(data):
component_type = data['data']['component_type']
if component_type == ComponentType.BUTTON:
return ButtonPress
elif component_type == ComponentType.SELECTMENU:
return Selection
else:
return None