@mulmobridge/discord 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -15,14 +15,15 @@
|
|
|
15
15
|
// MULMOCLAUDE_AUTH_TOKEN — bearer token (or read from workspace)
|
|
16
16
|
import "dotenv/config";
|
|
17
17
|
import { Client, GatewayIntentBits, Partials } from "discord.js";
|
|
18
|
-
import { createBridgeClient, installProcessGuards } from "@mulmobridge/client";
|
|
18
|
+
import { createBridgeClient, installProcessGuards, replyAfterProcessingIndicator } from "@mulmobridge/client";
|
|
19
19
|
import { parseCsvSet } from "@mulmoclaude/common";
|
|
20
20
|
import { collectAttachments, resolveMessageText } from "./attachments.js";
|
|
21
21
|
import { buildExternalChatId, isChannelAllowed, parseGranularity, readChannelRef } from "./sessionId.js";
|
|
22
|
-
import { replyAfterTyping } from "./typing.js";
|
|
23
22
|
const TRANSPORT_ID = "discord";
|
|
24
23
|
installProcessGuards({ name: TRANSPORT_ID });
|
|
25
24
|
const MAX_DISCORD_LENGTH = 2000;
|
|
25
|
+
// Discord drops "typing…" about 10 s after each request.
|
|
26
|
+
const TYPING_REFRESH_MS = 8_000;
|
|
26
27
|
const token = process.env.DISCORD_BOT_TOKEN;
|
|
27
28
|
if (!token) {
|
|
28
29
|
console.error("DISCORD_BOT_TOKEN is required.\nSee README for setup instructions.");
|
|
@@ -91,10 +92,10 @@ async function onMessageCreate(msg) {
|
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
async function relayMessage(msg, externalChatId, text, files) {
|
|
94
|
-
await
|
|
95
|
+
await replyAfterProcessingIndicator(() => sendTypingTo(msg), {
|
|
95
96
|
produce: () => produceReply(externalChatId, text, files),
|
|
96
97
|
post: (reply) => (reply.chunked ? sendChunked(msg, reply.text) : msg.reply(reply.text)),
|
|
97
|
-
}, { log: console });
|
|
98
|
+
}, { refreshMs: TYPING_REFRESH_MS, label: TRANSPORT_ID, log: console });
|
|
98
99
|
}
|
|
99
100
|
async function sendTypingTo(msg) {
|
|
100
101
|
if (msg.channel.isSendable())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mulmobridge/discord",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Discord bridge for MulmoBridge — connect a Discord bot to MulmoClaude",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"author": "Receptron Team",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mulmobridge/client": "^1.
|
|
25
|
+
"@mulmobridge/client": "^1.5.0",
|
|
26
26
|
"@mulmobridge/protocol": "^1.1.0",
|
|
27
27
|
"@mulmoclaude/common": "^1.5.0",
|
|
28
28
|
"discord.js": "^14.27.0",
|