@tinyclaw/plugin-channel-discord 2.0.0-patch.cfae164 → 2.0.0-pr.9e09860
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 +4 -8
- package/dist/pairing.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* userId format: "discord:<discord-user-id>"
|
|
15
15
|
* Prefixed to prevent collisions with web UI user IDs.
|
|
16
16
|
*/
|
|
17
|
-
import { Client, GatewayIntentBits, Partials, Events, } from 'discord.js';
|
|
18
17
|
import { logger } from '@tinyclaw/logger';
|
|
19
|
-
import {
|
|
18
|
+
import { Client, Events, GatewayIntentBits, Partials, } from 'discord.js';
|
|
19
|
+
import { createDiscordPairingTools, DISCORD_ENABLED_CONFIG_KEY, DISCORD_TOKEN_SECRET_KEY, } from './pairing.js';
|
|
20
20
|
let client = null;
|
|
21
21
|
const discordPlugin = {
|
|
22
22
|
id: '@tinyclaw/plugin-channel-discord',
|
|
@@ -56,16 +56,12 @@ const discordPlugin = {
|
|
|
56
56
|
if (msg.author.bot)
|
|
57
57
|
return;
|
|
58
58
|
const isDM = msg.channel.isDMBased();
|
|
59
|
-
const isMention = client?.user
|
|
60
|
-
? msg.mentions.users.has(client.user.id)
|
|
61
|
-
: false;
|
|
59
|
+
const isMention = client?.user ? msg.mentions.users.has(client.user.id) : false;
|
|
62
60
|
// Only respond to DMs or @mentions
|
|
63
61
|
if (!isDM && !isMention)
|
|
64
62
|
return;
|
|
65
63
|
// Strip @mention tokens from guild messages
|
|
66
|
-
const rawContent = msg.content
|
|
67
|
-
.replace(/<@!?[\d]+>/g, '')
|
|
68
|
-
.trim();
|
|
64
|
+
const rawContent = msg.content.replace(/<@!?[\d]+>/g, '').trim();
|
|
69
65
|
if (!rawContent)
|
|
70
66
|
return;
|
|
71
67
|
// Prefix userId to isolate Discord sessions from web UI sessions
|
package/dist/pairing.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* These tools are injected into the agent's tool list at boot so the agent
|
|
10
10
|
* can invoke them conversationally when a user asks to connect Discord.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { ConfigManagerInterface, SecretsManagerInterface, Tool } from '@tinyclaw/types';
|
|
13
13
|
/** Secret key for the Discord bot token. */
|
|
14
14
|
export declare const DISCORD_TOKEN_SECRET_KEY: string;
|
|
15
15
|
/** Config key for the enabled flag. */
|