(interactions): Support component registration.

This commit is contained in:
2022-05-09 08:08:56 +03:00
parent e23544aff7
commit ad5ef537c9

View File

@@ -104,3 +104,11 @@ class InteractionManager:
def add_future(self, future): def add_future(self, future):
self.futures.append(future) self.futures.append(future)
return future return future
def register(self, component, callback, *args, **kwargs):
"""
Attaches the given awaitable interaction and adds the given callback.
"""
future = component.add_callback(*args, **kwargs)(callback)
self.add_future(future)
return component