Currently, App/AsyncApp accepts only static methods as listeners. Developers may want to use instance/class methods in a class for some reason. We can update the kwrags_injection mechanism to accept cls, self along with other args.
from slack_bolt import App
app = App()
class Foo:
def i(self, ack):
ack()
@classmethod
def c(cls, ack):
ack()
@classmethod
def c2(cls):
def _c(ack):
ack()
return _c
@staticmethod
def s(ack):
ack()
foo = Foo()
# This works
@app.command('/hello-bolt-python')
def handle(ack):
ack()
# This works
app.command('/hello-bolt-python')(handle)
# This does not work
app.command('/hello-bolt-python')(foo.i)
# This does not work
app.command('/hello-bolt-python')(Foo.c)
# This works
app.command('/hello-bolt-python')(Foo.c2())
# This works
app.command('/hello-bolt-python')(Foo.s)
Category (place an x in each of the [ ])
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Currently,
App/AsyncAppaccepts only static methods as listeners. Developers may want to use instance/class methods in a class for some reason. We can update the kwrags_injection mechanism to acceptcls,selfalong with other args.Category (place an
xin each of the[ ])Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.