Spaces:
Paused
Paused
Sync from manelsen/donkey via hub-sync
Browse files
docs/hermes-mining/TRACEABILITY.md
CHANGED
|
@@ -26,3 +26,4 @@ completa dos 407 commits ainda não foi feita (ver `discord/SCOPE.md`).
|
|
| 26 |
| DS-003 | `efa6c9f715` | `tests/domain/channels/t_discord_pure.nim`, `tests/adapters/channel/t_requester_only_send_paths.nim` | `src/donkey/domain/channels/discord_pure.nim` (`withSafeMentions`) | portado |
|
| 27 |
| DS-004 | `68276773cf` | `tests/domain/channels/t_discord_pure.nim` | `src/donkey/domain/channels/discord_pure.nim` (`isBotAuthored`) | portado |
|
| 28 |
| DS-005 | `93ea9b04af` | `tests/domain/channels/t_discord_pure.nim` | `src/donkey/domain/channels/discord_pure.nim` (`DiscordMaxInboundAttachmentBytes`) | portado |
|
|
|
|
|
|
| 26 |
| DS-003 | `efa6c9f715` | `tests/domain/channels/t_discord_pure.nim`, `tests/adapters/channel/t_requester_only_send_paths.nim` | `src/donkey/domain/channels/discord_pure.nim` (`withSafeMentions`) | portado |
|
| 27 |
| DS-004 | `68276773cf` | `tests/domain/channels/t_discord_pure.nim` | `src/donkey/domain/channels/discord_pure.nim` (`isBotAuthored`) | portado |
|
| 28 |
| DS-005 | `93ea9b04af` | `tests/domain/channels/t_discord_pure.nim` | `src/donkey/domain/channels/discord_pure.nim` (`DiscordMaxInboundAttachmentBytes`) | portado |
|
| 29 |
+
| DS-006 | `cf7bf5bdc9` | `tests/domain/channels/t_discord_pure.nim`, `tests/adapters/channel/t_requester_only_send_paths.nim` | `src/donkey/domain/channels/discord_pure.nim` (`discordText`) | portado |
|
docs/hermes-mining/discord/SCOPE.md
CHANGED
|
@@ -85,6 +85,10 @@ sobre o gateway:
|
|
| 85 |
- **Teto de anexo recebido** (25 MiB, pelo `size` do evento): o anexo maior
|
| 86 |
não é baixado; o turno recebe uma nota com o nome do arquivo (`93ea9b04af`).
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
Ainda **não há**: ledger de entrega e cursor que só avança depois da entrega
|
| 89 |
final (hoje avança antes do despacho: at-most-once).
|
| 90 |
|
|
|
|
| 85 |
- **Teto de anexo recebido** (25 MiB, pelo `size` do evento): o anexo maior
|
| 86 |
não é baixado; o turno recebe uma nota com o nome do arquivo (`93ea9b04af`).
|
| 87 |
|
| 88 |
+
- **Tabelas** (`discordText`): o Discord não renderiza tabela GFM; cada linha
|
| 89 |
+
vira um bloco com a primeira célula em negrito e as outras como
|
| 90 |
+
`• Cabeçalho: valor`, fora de blocos de código (`cf7bf5bdc9`).
|
| 91 |
+
|
| 92 |
Ainda **não há**: ledger de entrega e cursor que só avança depois da entrega
|
| 93 |
final (hoje avança antes do despacho: at-most-once).
|
| 94 |
|
src/donkey/adapters/channel/discord.nim
CHANGED
|
@@ -514,10 +514,10 @@ proc send*(a: DiscordAdapter; msg: OutboundMessage): Result[void, string] =
|
|
| 514 |
## If msg.keyboard is non-empty, sends with component buttons.
|
| 515 |
## Splits messages longer than 2000 characters into multiple sends.
|
| 516 |
if msg.keyboard.len > 0:
|
| 517 |
-
discard a.sendKeyboard(msg.userId, msg.text, msg.keyboard)
|
| 518 |
return ok()
|
| 519 |
let chId = ? a.resolveOutboundChannelId(msg)
|
| 520 |
-
for chunk in splitChunks(msg.text, DiscordMaxChars):
|
| 521 |
? a.sendChunk(chId, chunk)
|
| 522 |
ok()
|
| 523 |
|
|
@@ -632,8 +632,9 @@ proc sendReturnId*(a: DiscordAdapter; msg: OutboundMessage): Result[string, stri
|
|
| 632 |
## Used by the streaming machinery to obtain the id for subsequent editMessage calls.
|
| 633 |
## Uses >>= to chain HTTP response → JSON parse → id extraction.
|
| 634 |
let chId = ? a.resolveOutboundChannelId(msg)
|
| 635 |
-
let
|
| 636 |
-
|
|
|
|
| 637 |
var body = %* {"content": txt}
|
| 638 |
if msg.keyboard.len > 0:
|
| 639 |
body.add("components", %makeComponentRows(msg.keyboard))
|
|
@@ -647,7 +648,8 @@ proc editMessage*(a: DiscordAdapter; userId: UserId;
|
|
| 647 |
if discordId.len == 0:
|
| 648 |
return err("DiscordAdapter.editMessage: no Discord ID for " & $userId)
|
| 649 |
let chId = ? a.dmChannelFor(discordId)
|
| 650 |
-
let
|
|
|
|
| 651 |
let body = %* {"content": txt}
|
| 652 |
let headers = @[a.authHeader(), ("Content-Type", "application/json")]
|
| 653 |
let url = a.base() & "/channels/" & chId & "/messages/" & msgId
|
|
|
|
| 514 |
## If msg.keyboard is non-empty, sends with component buttons.
|
| 515 |
## Splits messages longer than 2000 characters into multiple sends.
|
| 516 |
if msg.keyboard.len > 0:
|
| 517 |
+
discard a.sendKeyboard(msg.userId, discordText(msg.text), msg.keyboard)
|
| 518 |
return ok()
|
| 519 |
let chId = ? a.resolveOutboundChannelId(msg)
|
| 520 |
+
for chunk in splitChunks(discordText(msg.text), DiscordMaxChars):
|
| 521 |
? a.sendChunk(chId, chunk)
|
| 522 |
ok()
|
| 523 |
|
|
|
|
| 632 |
## Used by the streaming machinery to obtain the id for subsequent editMessage calls.
|
| 633 |
## Uses >>= to chain HTTP response → JSON parse → id extraction.
|
| 634 |
let chId = ? a.resolveOutboundChannelId(msg)
|
| 635 |
+
let shown = discordText(msg.text)
|
| 636 |
+
let txt = if shown.len > DiscordMaxChars: shown[0 ..< DiscordMaxChars]
|
| 637 |
+
else: shown
|
| 638 |
var body = %* {"content": txt}
|
| 639 |
if msg.keyboard.len > 0:
|
| 640 |
body.add("components", %makeComponentRows(msg.keyboard))
|
|
|
|
| 648 |
if discordId.len == 0:
|
| 649 |
return err("DiscordAdapter.editMessage: no Discord ID for " & $userId)
|
| 650 |
let chId = ? a.dmChannelFor(discordId)
|
| 651 |
+
let shown = discordText(text)
|
| 652 |
+
let txt = if shown.len > DiscordMaxChars: shown[0 ..< DiscordMaxChars] else: shown
|
| 653 |
let body = %* {"content": txt}
|
| 654 |
let headers = @[a.authHeader(), ("Content-Type", "application/json")]
|
| 655 |
let url = a.base() & "/channels/" & chId & "/messages/" & msgId
|