@mulmobridge/discord 0.1.0 → 0.1.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/README.md +43 -0
- package/dist/index.js +6 -12
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -47,6 +47,49 @@ npx @mulmobridge/discord
|
|
|
47
47
|
| `DISCORD_ALLOWED_CHANNELS` | No | CSV of channel IDs to restrict (empty = all) |
|
|
48
48
|
| `MULMOCLAUDE_API_URL` | No | Default `http://localhost:3001` |
|
|
49
49
|
| `MULMOCLAUDE_AUTH_TOKEN` | No | Bearer token (auto-read from workspace) |
|
|
50
|
+
| `DISCORD_BRIDGE_DEFAULT_ROLE` | No | Role id to seed new bridge sessions with (e.g. `coder`, `general`). Applied ONLY when a discord session first appears — once the user switches role via `/role <id>` the session's own role wins. Unknown role ids silently fall back to the server's default with a warn log. |
|
|
51
|
+
| `BRIDGE_DEFAULT_ROLE` | No | Same as above but shared across every bridge. Transport-specific `DISCORD_BRIDGE_DEFAULT_ROLE` wins when both are set. |
|
|
52
|
+
|
|
53
|
+
## Ecosystem
|
|
54
|
+
|
|
55
|
+
Part of the [`@mulmobridge/*`](https://www.npmjs.com/~mulmobridge) package family.
|
|
56
|
+
|
|
57
|
+
**Shared libraries:**
|
|
58
|
+
|
|
59
|
+
- [`@mulmobridge/client`](https://www.npmjs.com/package/@mulmobridge/client) — socket.io client library used by every bridge below
|
|
60
|
+
- [`@mulmobridge/protocol`](https://www.npmjs.com/package/@mulmobridge/protocol) — wire types and constants
|
|
61
|
+
- [`@mulmobridge/chat-service`](https://www.npmjs.com/package/@mulmobridge/chat-service) — server-side relay + session store
|
|
62
|
+
- [`@mulmobridge/relay`](https://www.npmjs.com/package/@mulmobridge/relay) — Cloudflare Workers webhook proxy
|
|
63
|
+
- [`@mulmobridge/mock-server`](https://www.npmjs.com/package/@mulmobridge/mock-server) — mock server for local bridge development
|
|
64
|
+
|
|
65
|
+
**Bridges** (one npm package per platform):
|
|
66
|
+
|
|
67
|
+
- [`@mulmobridge/bluesky`](https://www.npmjs.com/package/@mulmobridge/bluesky) — Bluesky DMs over atproto
|
|
68
|
+
- [`@mulmobridge/chatwork`](https://www.npmjs.com/package/@mulmobridge/chatwork) — Chatwork (Japanese business chat)
|
|
69
|
+
- [`@mulmobridge/cli`](https://www.npmjs.com/package/@mulmobridge/cli) — interactive terminal bridge
|
|
70
|
+
- [`@mulmobridge/discord`](https://www.npmjs.com/package/@mulmobridge/discord) — Discord bot via Gateway ← **this package**
|
|
71
|
+
- [`@mulmobridge/email`](https://www.npmjs.com/package/@mulmobridge/email) — IMAP poll + SMTP reply, threading preserved
|
|
72
|
+
- [`@mulmobridge/google-chat`](https://www.npmjs.com/package/@mulmobridge/google-chat) — Google Chat via MulmoBridge relay
|
|
73
|
+
- [`@mulmobridge/irc`](https://www.npmjs.com/package/@mulmobridge/irc) — IRC (Libera, Freenode, custom)
|
|
74
|
+
- [`@mulmobridge/line`](https://www.npmjs.com/package/@mulmobridge/line) — LINE Messaging API via MulmoBridge relay
|
|
75
|
+
- [`@mulmobridge/line-works`](https://www.npmjs.com/package/@mulmobridge/line-works) — LINE Works (enterprise LINE)
|
|
76
|
+
- [`@mulmobridge/mastodon`](https://www.npmjs.com/package/@mulmobridge/mastodon) — Mastodon DMs + mentions
|
|
77
|
+
- [`@mulmobridge/matrix`](https://www.npmjs.com/package/@mulmobridge/matrix) — Matrix / Element
|
|
78
|
+
- [`@mulmobridge/mattermost`](https://www.npmjs.com/package/@mulmobridge/mattermost) — Mattermost
|
|
79
|
+
- [`@mulmobridge/messenger`](https://www.npmjs.com/package/@mulmobridge/messenger) — Facebook Messenger via MulmoBridge relay
|
|
80
|
+
- [`@mulmobridge/nostr`](https://www.npmjs.com/package/@mulmobridge/nostr) — Nostr NIP-04 encrypted DMs
|
|
81
|
+
- [`@mulmobridge/rocketchat`](https://www.npmjs.com/package/@mulmobridge/rocketchat) — Rocket.Chat
|
|
82
|
+
- [`@mulmobridge/signal`](https://www.npmjs.com/package/@mulmobridge/signal) — Signal via signal-cli-rest-api
|
|
83
|
+
- [`@mulmobridge/slack`](https://www.npmjs.com/package/@mulmobridge/slack) — Slack Socket Mode
|
|
84
|
+
- [`@mulmobridge/teams`](https://www.npmjs.com/package/@mulmobridge/teams) — Microsoft Teams via Bot Framework
|
|
85
|
+
- [`@mulmobridge/telegram`](https://www.npmjs.com/package/@mulmobridge/telegram) — Telegram bot
|
|
86
|
+
- [`@mulmobridge/twilio-sms`](https://www.npmjs.com/package/@mulmobridge/twilio-sms) — SMS via Twilio Programmable Messaging
|
|
87
|
+
- [`@mulmobridge/viber`](https://www.npmjs.com/package/@mulmobridge/viber) — Viber Public Account bots
|
|
88
|
+
- [`@mulmobridge/webhook`](https://www.npmjs.com/package/@mulmobridge/webhook) — generic HTTP webhook bridge
|
|
89
|
+
- [`@mulmobridge/whatsapp`](https://www.npmjs.com/package/@mulmobridge/whatsapp) — WhatsApp Cloud API via MulmoBridge relay
|
|
90
|
+
- [`@mulmobridge/xmpp`](https://www.npmjs.com/package/@mulmobridge/xmpp) — XMPP / Jabber
|
|
91
|
+
- [`@mulmobridge/zulip`](https://www.npmjs.com/package/@mulmobridge/zulip) — Zulip
|
|
92
|
+
|
|
50
93
|
|
|
51
94
|
## License
|
|
52
95
|
|
package/dist/index.js
CHANGED
|
@@ -20,31 +20,25 @@ if (!token) {
|
|
|
20
20
|
}
|
|
21
21
|
const allowedChannels = new Set((process.env.DISCORD_ALLOWED_CHANNELS ?? "")
|
|
22
22
|
.split(",")
|
|
23
|
-
.map((
|
|
23
|
+
.map((channelId) => channelId.trim())
|
|
24
24
|
.filter(Boolean));
|
|
25
25
|
const allowAll = allowedChannels.size === 0;
|
|
26
26
|
const discord = new Client({
|
|
27
|
-
intents: [
|
|
28
|
-
GatewayIntentBits.Guilds,
|
|
29
|
-
GatewayIntentBits.GuildMessages,
|
|
30
|
-
GatewayIntentBits.DirectMessages,
|
|
31
|
-
GatewayIntentBits.MessageContent,
|
|
32
|
-
],
|
|
27
|
+
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.DirectMessages, GatewayIntentBits.MessageContent],
|
|
33
28
|
// Partials.Channel is required to receive DM messageCreate events —
|
|
34
29
|
// DM channels are not cached by default in discord.js v14.
|
|
35
30
|
partials: [Partials.Channel],
|
|
36
31
|
});
|
|
37
32
|
const mulmo = createBridgeClient({ transportId: TRANSPORT_ID });
|
|
38
|
-
mulmo.onPush(async (
|
|
33
|
+
mulmo.onPush(async (pushEvent) => {
|
|
39
34
|
try {
|
|
40
|
-
const channel = discord.channels.cache.get(
|
|
41
|
-
(await discord.channels.fetch(ev.chatId).catch(() => null));
|
|
35
|
+
const channel = discord.channels.cache.get(pushEvent.chatId) ?? (await discord.channels.fetch(pushEvent.chatId).catch(() => null));
|
|
42
36
|
if (channel?.isTextBased() && "send" in channel) {
|
|
43
37
|
const sendable = channel;
|
|
44
|
-
await sendChunkedToSendable(sendable,
|
|
38
|
+
await sendChunkedToSendable(sendable, pushEvent.message);
|
|
45
39
|
}
|
|
46
40
|
else {
|
|
47
|
-
console.warn(`[discord] push: channel ${
|
|
41
|
+
console.warn(`[discord] push: channel ${pushEvent.chatId} not found or not text-based`);
|
|
48
42
|
}
|
|
49
43
|
}
|
|
50
44
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mulmobridge/discord",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Discord bridge for MulmoBridge — connect a Discord bot to MulmoClaude",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"author": "Receptron Team",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@mulmobridge/client": "^0.1.
|
|
25
|
-
"@mulmobridge/protocol": "^0.1.
|
|
24
|
+
"@mulmobridge/client": "^0.1.4",
|
|
25
|
+
"@mulmobridge/protocol": "^0.1.4",
|
|
26
26
|
"discord.js": "^14.26.3",
|
|
27
27
|
"dotenv": "^17.0.0"
|
|
28
28
|
},
|