Add support for "sub apps"
还没有人认领这个 Issue。
评估
调研方向
首先查看 slack_bolt.App 和 slack_bolt.async_app.AsyncApp 的组合 API,然后阅读 issue #236 中描述的 workaround。将所请求的 add_app 行为与 FastAPI 的 include_router 和 Typer 的 add_typer 进行比较。当独立定义的子应用或插件可以附加到两种 app 变体,而无需手动传递父 app 或直接调用装饰器时,工作即告完成。
由索引模型根据 Issue 内容生成。
描述
When creating a large slack application it would be nice to be able to reuse components in a more pythonic way than what is possible right now.
A workaround is described in issue #236, but it requires passing the app object around and manually wiring up things by registering and calling decorators as functions directly.
I suggest adding a feature much like include_router in FastAPI or add_typer in Typer.
This feature will let us create sub-apps in separate files or even separate packages, like plugins that can be published on pypi.org separately.
Here is a small example illustrating what I mean:
main.py
Here is our main app, where we add a plugin from a separate package
import os
from slack_bolt import App
from my_plugin import my_plugin
# Initializes your app with your bot token and signing secret
app = App(
token=os.environ.get("SLACK_BOT_TOKEN"),
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)
app.add_app(my_plugin)
my_plugin.py
A simple plugin that just creates a slack_bolt app, but without any config
from slack_bolt import App
my_plugin = App()
@my_plugin.message("hello")
def message_hello(message, say):
say("Hello world")
Category
- slack_bolt.App and/or its core components
- slack_bolt.async_app.AsyncApp and/or its core components
- Adapters in slack_bolt.adapter
- Others
- 主要语言
- Python
- 星标
- 1.3k
- 派生
- 288
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
slackapi/bolt-python 的其他 Issue
-
docs enhancement server-side
难度 1/5 1 小时以内 新手友好度 88/100
slackapi/bolt-python#1576 · 1 条评论 ·
-
auto-triage-skip bug security semver:major
难度 2/5 1-3 小时 新手友好度 72/100
slackapi/bolt-python#1447 · 9 条评论 ·
-
难度 3/5 1-2 天 新手友好度 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
难度 3/5 1-2 天 新手友好度 65/100
slackapi/bolt-python#1472 · 1 条评论 · 1 个 reaction ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 条评论 · 已指派 1 人 ·
查看 slackapi/bolt-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main 未关闭area: ci bug perceived difficulty: 3
难度 2/5 1-3 小时 新手友好度 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
-
难度 2/5 1-3 小时 新手友好度 78/100
ClickHouse/clickhouse-connect#1057 ·