Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Add support for "sub apps"

未關閉
#320 8 則留言 11 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
python
領域
backend

研究方向

先檢視 slack_bolt.App 和 slack_bolt.async_app.AsyncApp 的組合 API,接著閱讀 issue #236 中描述的 workaround。將要求的 add_app 行為與 FastAPI 的 include_router 及 Typer 的 add_typer 進行比較。當獨立定義的子應用程式或 plugin 可以附加至兩種 app 變體,而不必手動傳遞父 app 或直接呼叫 decorator 時,工作即完成。

由索引模型根據 Issue 內容生成。

描述

auto-triage-skip discussion

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
分支
291
平均合併
1 天 14 小時
30 天內合併 PR
8

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

slackapi/bolt-python 的其他 Issue

查看 slackapi/bolt-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。