web-api: Blocks in client.conversations.history are different to blocks that use in message posting

Offen
#1,903 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
node.js, typescript
Bereich
api

Rechercherichtung

Das Issue nennt client.conversations.history, chat.postMessage und chat.update als Einstiegspunkte. Lies zuerst deren TypeScript-Blocktypen und bestätige, ob zurückgegebene Blöcke gültige Eingaben sind; die Aufgabe gilt erst dann als erledigt, wenn eine entschiedene, getestete Lösung für die Inkompatibilität vorliegt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area:typescript auto-triage-skip discussion enhancement pkg:web-api
Description

If I want to copy message from one channel to another, or if I want to edit something in message, when I use TS and bolt js, I can't do it.

For example:

    const result = await client.conversations.history({
      channel: FROM_CHANNEL,
      latest: TARGET_TS,
      inclusive: true,
      limit: 1,
    });
    if (result.messages !== undefined) {
      const message = result.messages[0];
      if (message) {
      await client.chat.postMessage({
        channel: TO_CHANNEL,
        text: message.text,
        blocks: message.blocks,
      });
      await client.chat.update({
        channel: FROM_CHANNEL,
        ts: TARGET_TS,
        blocks: [{type: 'divider'}, ...message.blocks],
      });
    }

In both cases, I've got error with blocks field. ConversationsHistoryResponse Block have many differences to normal Block type. For example field type declared to be string|undefined in first, and string in second.
Are those types correspond to reality?
If so, maybe we can create some converter, that will check blocks from conversations.history and fix them, so they will be OK to use as KnownBlocks?

What type of issue is this? (place an x in one of the [ ])
  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion
Requirements (place an x in each of the [ ])
  • [ x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x ] I've read and agree to the Code of Conduct.
  • [x ] I've searched for any related issues and avoided creating a duplicate issue.

Vorherrschende Sprache
TypeScript
Sterne
3.4k
Forks
694
Ø Merge
1 T. 10 Std.
Gemergte PRs (30 T.)
75

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus slackapi/node-slack-sdk

Alle Issues in slackapi/node-slack-sdk

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.