Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

ThreadBroadcastMessageEvent is missing `bot_id`

オープン 初心者向け
#2,766 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
api

調査の方向性

issue は packages/types/src/events/message.ts、具体的には276〜300行あたりの ThreadBroadcastMessageEvent の定義を指しています。その型を GenericMessageEvent とあわせて読み、関連する型テストがあるか確認してください。bot_id?: string がブロードキャストイベントに表現され、型が event.bot_id へのアクセスを受け入れれば完了です。

索引モデルが 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 as a user in a channel where the app is a member.
  3. As the bot, reply in that thread with chat.postMessage({ channel, thread_ts, text, reply_broadcast: true }).
  4. Inspect the payload of the message event the app receives for that reply.

In TypeScript, the following code does not compile:

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

function isFromBot(event: ThreadBroadcastMessageEvent) {
  return !!event.bot_id; // error TS2339: Property 'bot_id' does not exist on type 'ThreadBroadcastMessageEvent'
}
Expected Result

ThreadBroadcastMessageEvent defines bot_id?: string, like GenericMessageEvent does. Slack sends this field, so we can check whether the broadcast reply itself was posted by a bot without a type assertion.

Actual Result

Slack sends a message event with subtype: "thread_broadcast". The event includes a top-level bot_id:

{
  "type": "message",
  "subtype": "thread_broadcast",
  "user": "U0XXXXXXX",
  "bot_id": "B0XXXXXXX",
  "app_id": "A0XXXXXXX",
  "text": "broadcast test",
  "ts": "1791786680.944589",
  "thread_ts": "1791786656.190749",
  "channel": "C0XXXXXXX",
  "channel_type": "channel",
  "event_ts": "1791786680.944589",
  "root": { "user": "U0YYYYYYY", "ts": "1791786656.190749", "reply_count": 2, ... },
  "blocks": [ ... ]
}

However, ThreadBroadcastMessageEvent does not define bot_id, even after #2763:

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

The only bot_id reachable from this type is root.bot_id, which describes the thread parent, not the broadcast reply. Code that uses root.bot_id to detect bot messages gets both cases wrong: a user's broadcast in a bot-started thread looks like a bot message, and a bot's broadcast in a user-started thread looks like a user message.

This is a follow-up to #2762, which covered other missing fields on the same type.

主要言語
TypeScript
スター
3.4k
フォーク
687
平均マージ
1日 2時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

slackapi/node-slack-sdk のほかの issue

slackapi/node-slack-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。