Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

ThreadBroadcastMessageEvent is missing `files`, `upload`, `display_as_bot` and `parent_user_id`

已关闭 适合新手
#2,762 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
api

调研方向

接口是 packages/types/src/events/message.ts 中第 276-296 行左右的 ThreadBroadcastMessageEvent。从同一文件中的 FileShareMessageEvent 和 GenericMessageEvent 复制可选字段 files、upload、display_as_bot 和 parent_user_id,并保持其类型不变。当该接口声明了全部四个字段,且 issue 中的 event.files 示例通过类型检查时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

untriaged
Package

@slack/types

SDK Version

@slack/[email protected]

Node.js Version

N/A (type definition issue)

Operating System

No response

Steps to Reproduce
  1. Set up an app subscribed to the message.channels event.
  2. Start a thread in a channel where the app is a member.
  3. Reply in that thread. Attach a file and check "Also send to #channel".
  4. Inspect the payload of the message event the app receives.

In TypeScript, the following code does not compile:

import type { ThreadBroadcastMessageEvent } from "@slack/types";

function handle(event: ThreadBroadcastMessageEvent) {
  event.files; // error TS2339: Property 'files' does not exist on type 'ThreadBroadcastMessageEvent'
}
Expected Result

ThreadBroadcastMessageEvent defines files?: File[], upload?: boolean, display_as_bot?: boolean and parent_user_id?: string. Slack sends these fields, so we can access them without a type assertion.

Actual Result

Slack sends a message event with subtype: "thread_broadcast". The event includes files, upload, display_as_bot and parent_user_id:

{
  "type": "message",
  "subtype": "thread_broadcast",
  "user": "U0XXXXXXX",
  "text": "broadcast with a file",
  "ts": "1791448977.697319",
  "thread_ts": "1791447929.601119",
  "channel": "C0XXXXXXX",
  "channel_type": "channel",
  "event_ts": "1791448977.697319",
  "client_msg_id": "...",
  "parent_user_id": "U0XXXXXXX",
  "display_as_bot": false,
  "upload": false,
  "files": [{ "id": "F0XXXXXXX", "name": "image.png", "filetype": "png", ... }],
  "root": { ... },
  "blocks": [ ... ]
}

However, ThreadBroadcastMessageEvent does not define any of these four fields:

https://github.com/slackapi/node-slack-sdk/blob/b3190fd05b11c19e33a8c742ebff15369aa9a00d/packages/types/src/events/message.ts#L276-L296

In the same file, GenericMessageEvent defines files and parent_user_id, and FileShareMessageEvent defines all four.

主要语言
TypeScript
星标
3.4k
派生
688
平均合并
1 天 6 小时
30 天内合并 PR
18

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

slackapi/node-slack-sdk 的其他 Issue

查看 slackapi/node-slack-sdk 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。