Added slash command handling
This commit is contained in:
1 parent
10e9565e2e
commit
1bcadcf950
16 files changed
+567
-21
No files matched your search
@@ -71,6 +71,9 @@ TYPE_CHANNEL_LIST = "channel.list"
|
||||
TYPE_SEARCH = "search"
|
||||
TYPE_SEARCH_RESULTS = "search.results"
|
||||
|
||||
# Slash-command catalog (app's "/" drawer)
|
||||
TYPE_COMMANDS_CATALOG = "commands.catalog"
|
||||
|
||||
# Reconnect catch-up (M3 outbox; extended by M5 push)
|
||||
TYPE_SYNC = "sync"
|
||||
TYPE_SYNC_DONE = "sync.done"
|
||||
@@ -502,6 +505,24 @@ def search_results(
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Slash-command catalog frames
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def commands_catalog(commands: List[Dict[str, Any]], *, id: Optional[int] = None) -> Frame:
|
||||
"""Response to a ``commands.catalog`` request: the gateway's slash-command
|
||||
catalog for the app's ``/`` drawer.
|
||||
|
||||
Each entry: ``{name, description, args_hint, category, aliases}`` where
|
||||
``name``/``aliases`` carry the leading slash (``"/new"``, ``["/reset"]``).
|
||||
"""
|
||||
return Frame(
|
||||
type=TYPE_COMMANDS_CATALOG,
|
||||
id=id,
|
||||
payload={"commands": commands},
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Sync frames (M3 outbox)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user