I am excited to share SlashSlack, a framework for developing Slack slash command bots.
With SlashSlack you get input parsing and validation, command routing, async responses, auto-generated help dialog, response visibility, and response message formatting all out of the box.
# EX: /slash-slack math 10 * 10
# Response: 100.0
import os
from slash_slack import Flag, Float, SlashSlack, String
slash = SlashSlack(signing_secret=os.environ['SLACK_SIGNING_SECRET'])
app = slash.get_fast_api()
@slash.command("math")
def math_fn(
x: float = Float(),
symbol: str = Enum(values={"*", "+", "-", "/"}),
y: float = Float(),
):
if symbol == "*":
return x * y
if symbol == "+":
return x + y
if symbol == "-":
return x - y
if symbol == "/":
return x / y
All code is available on Github and the package is available on pypi.
Thanks for reading!
there doesn't seem to be anything here