@link-os/discord 0.1.0
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/discord-client.d.ts +57 -0
- package/dist/discord-client.d.ts.map +1 -0
- package/dist/discord-client.js +177 -0
- package/dist/discord-client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ChannelClass, BaseMessage } from '@link-os/types';
|
|
2
|
+
export interface DiscordClientConfig {
|
|
3
|
+
/** Discord bot token from the Developer Portal */
|
|
4
|
+
token: string;
|
|
5
|
+
/**
|
|
6
|
+
* Optional prefix for session IDs.
|
|
7
|
+
* Defaults to 'dc'.
|
|
8
|
+
*/
|
|
9
|
+
sessionIdPrefix?: string;
|
|
10
|
+
/**
|
|
11
|
+
* If true, the bot responds to ALL messages in guild channels.
|
|
12
|
+
* If false (default), the bot only responds when @mentioned or in DMs.
|
|
13
|
+
*/
|
|
14
|
+
respondToAll?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Discord bot client implementing the Linkos ChannelClass interface.
|
|
18
|
+
*
|
|
19
|
+
* Setup:
|
|
20
|
+
* 1. Create a bot at https://discord.com/developers/applications
|
|
21
|
+
* 2. Enable the "MESSAGE CONTENT" privileged intent under Bot settings
|
|
22
|
+
* 3. Invite the bot with scopes: bot + applications.commands
|
|
23
|
+
* 4. Pass the Bot Token as `config.token`
|
|
24
|
+
*/
|
|
25
|
+
export declare class DiscordClient implements ChannelClass {
|
|
26
|
+
readonly channel: "discord";
|
|
27
|
+
private client;
|
|
28
|
+
private config;
|
|
29
|
+
private messageHandler?;
|
|
30
|
+
private statusHandler?;
|
|
31
|
+
constructor(config: DiscordClientConfig);
|
|
32
|
+
private setupHandlers;
|
|
33
|
+
private handleIncomingMessage;
|
|
34
|
+
on(event: 'message', handler: (message: BaseMessage) => Promise<void>): void;
|
|
35
|
+
on(event: 'status', handler: (status: {
|
|
36
|
+
type: string;
|
|
37
|
+
data?: unknown;
|
|
38
|
+
}) => void): void;
|
|
39
|
+
start(): Promise<void>;
|
|
40
|
+
stop(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Send a text message to a Discord channel or DM by channel ID.
|
|
43
|
+
* @param channelId The Discord channel ID (TextChannel, DMChannel, etc.)
|
|
44
|
+
* @param content The message text to send
|
|
45
|
+
*/
|
|
46
|
+
sendMessage(channelId: string, content: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Returns a list of text channels the bot has access to across all guilds.
|
|
49
|
+
* Useful for the Hub's /connections/:id/contexts endpoint.
|
|
50
|
+
*/
|
|
51
|
+
getAvailableContexts(): Promise<{
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
type: 'group' | 'user';
|
|
55
|
+
}[]>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=discord-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discord-client.d.ts","sourceRoot":"","sources":["../src/discord-client.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAChC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAID;;;;;;;;GAQG;AACH,qBAAa,aAAc,YAAW,YAAY;IAC9C,QAAQ,CAAC,OAAO,EAAG,SAAS,CAAU;IAEtC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,cAAc,CAAC,CAA0C;IACjE,OAAO,CAAC,aAAa,CAAC,CAAqD;gBAE/D,MAAM,EAAE,mBAAmB;IAwBvC,OAAO,CAAC,aAAa;YAgBP,qBAAqB;IA4DnC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAC5E,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI;IAShF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B;;;;OAIG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAapE;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;CAsBhG"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Client, GatewayIntentBits, Events, ChannelType, Partials, } from 'discord.js';
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
+
/**
|
|
4
|
+
* Discord bot client implementing the Linkos ChannelClass interface.
|
|
5
|
+
*
|
|
6
|
+
* Setup:
|
|
7
|
+
* 1. Create a bot at https://discord.com/developers/applications
|
|
8
|
+
* 2. Enable the "MESSAGE CONTENT" privileged intent under Bot settings
|
|
9
|
+
* 3. Invite the bot with scopes: bot + applications.commands
|
|
10
|
+
* 4. Pass the Bot Token as `config.token`
|
|
11
|
+
*/
|
|
12
|
+
export class DiscordClient {
|
|
13
|
+
channel = 'discord';
|
|
14
|
+
client;
|
|
15
|
+
config;
|
|
16
|
+
messageHandler;
|
|
17
|
+
statusHandler;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.config = {
|
|
20
|
+
sessionIdPrefix: 'dc',
|
|
21
|
+
respondToAll: false,
|
|
22
|
+
...config,
|
|
23
|
+
};
|
|
24
|
+
this.client = new Client({
|
|
25
|
+
intents: [
|
|
26
|
+
GatewayIntentBits.Guilds,
|
|
27
|
+
GatewayIntentBits.GuildMessages,
|
|
28
|
+
GatewayIntentBits.MessageContent,
|
|
29
|
+
GatewayIntentBits.DirectMessages,
|
|
30
|
+
],
|
|
31
|
+
partials: [Partials.Channel],
|
|
32
|
+
});
|
|
33
|
+
this.setupHandlers();
|
|
34
|
+
}
|
|
35
|
+
// -------------------------------------------------------------------------
|
|
36
|
+
// Private helpers
|
|
37
|
+
// -------------------------------------------------------------------------
|
|
38
|
+
setupHandlers() {
|
|
39
|
+
this.client.once(Events.ClientReady, (readyClient) => {
|
|
40
|
+
console.log(`✅ Connected to Discord as ${readyClient.user.tag}`);
|
|
41
|
+
this.statusHandler?.({ type: 'connected', data: { tag: readyClient.user.tag } });
|
|
42
|
+
});
|
|
43
|
+
this.client.on(Events.MessageCreate, async (message) => {
|
|
44
|
+
await this.handleIncomingMessage(message);
|
|
45
|
+
});
|
|
46
|
+
this.client.on(Events.Error, (error) => {
|
|
47
|
+
console.error('[Discord] Client error:', error);
|
|
48
|
+
this.statusHandler?.({ type: 'error', data: error });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async handleIncomingMessage(message) {
|
|
52
|
+
// Ignore messages from bots (including self)
|
|
53
|
+
if (message.author.bot)
|
|
54
|
+
return;
|
|
55
|
+
if (!this.messageHandler)
|
|
56
|
+
return;
|
|
57
|
+
const isDM = message.channel.type === ChannelType.DM;
|
|
58
|
+
const isMentioned = this.client.user
|
|
59
|
+
? message.mentions.has(this.client.user)
|
|
60
|
+
: false;
|
|
61
|
+
// In guild channels: only respond when mentioned (unless respondToAll is set)
|
|
62
|
+
if (!isDM && !isMentioned && !this.config.respondToAll)
|
|
63
|
+
return;
|
|
64
|
+
// Strip the bot mention from the content so the agent gets clean text
|
|
65
|
+
// Handles both <@ID> and <@!ID> (nickname) formats
|
|
66
|
+
const content = this.client.user
|
|
67
|
+
? message.content.replace(new RegExp(`<@!?${this.client.user.id}>`, 'g'), '').trim()
|
|
68
|
+
: message.content.trim();
|
|
69
|
+
if (!content)
|
|
70
|
+
return;
|
|
71
|
+
// Show typing indicator in Discord
|
|
72
|
+
try {
|
|
73
|
+
await message.channel.sendTyping();
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
console.warn('[Discord] Failed to send typing indicator:', err);
|
|
77
|
+
}
|
|
78
|
+
// Build a stable session ID:
|
|
79
|
+
// - Guild channel: "<prefix>_<guildId>_<channelId>"
|
|
80
|
+
// - DM: "<prefix>_dm_<authorId>"
|
|
81
|
+
const sessionId = isDM
|
|
82
|
+
? `${this.config.sessionIdPrefix}_dm_${message.author.id}`
|
|
83
|
+
: `${this.config.sessionIdPrefix}_${message.guildId}_${message.channelId}`;
|
|
84
|
+
const baseMessage = {
|
|
85
|
+
id: message.id || uuidv4(),
|
|
86
|
+
channel: 'discord',
|
|
87
|
+
// userId is the channel/DM ID so sendMessage() can reply to the right place
|
|
88
|
+
userId: message.channelId,
|
|
89
|
+
sessionId,
|
|
90
|
+
content,
|
|
91
|
+
messageType: 'text',
|
|
92
|
+
timestamp: message.createdAt,
|
|
93
|
+
metadata: {
|
|
94
|
+
authorId: message.author.id,
|
|
95
|
+
authorTag: message.author.tag,
|
|
96
|
+
guildId: message.guildId ?? undefined,
|
|
97
|
+
channelId: message.channelId,
|
|
98
|
+
isDM,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
await this.messageHandler(baseMessage);
|
|
102
|
+
}
|
|
103
|
+
on(event, handler) {
|
|
104
|
+
if (event === 'message') {
|
|
105
|
+
this.messageHandler = handler;
|
|
106
|
+
}
|
|
107
|
+
else if (event === 'status') {
|
|
108
|
+
this.statusHandler = handler;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async start() {
|
|
112
|
+
console.log('🤖 Starting Discord client...');
|
|
113
|
+
try {
|
|
114
|
+
await this.client.login(this.config.token);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.error('❌ Failed to connect Discord client:', error);
|
|
118
|
+
this.statusHandler?.({ type: 'error', data: error });
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async stop() {
|
|
123
|
+
console.log('🛑 Stopping Discord client...');
|
|
124
|
+
try {
|
|
125
|
+
await this.client.destroy();
|
|
126
|
+
console.log('✅ Discord client stopped');
|
|
127
|
+
this.statusHandler?.({ type: 'disconnected' });
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
console.warn('⚠️ Discord client failed to stop gracefully:', error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Send a text message to a Discord channel or DM by channel ID.
|
|
135
|
+
* @param channelId The Discord channel ID (TextChannel, DMChannel, etc.)
|
|
136
|
+
* @param content The message text to send
|
|
137
|
+
*/
|
|
138
|
+
async sendMessage(channelId, content) {
|
|
139
|
+
try {
|
|
140
|
+
const channel = await this.client.channels.fetch(channelId);
|
|
141
|
+
if (!channel || !channel.isTextBased()) {
|
|
142
|
+
throw new Error(`Channel ${channelId} is not a text-based channel`);
|
|
143
|
+
}
|
|
144
|
+
await channel.send(content);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.error(`❌ Failed to send Discord message to channel ${channelId}:`, error);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Returns a list of text channels the bot has access to across all guilds.
|
|
153
|
+
* Useful for the Hub's /connections/:id/contexts endpoint.
|
|
154
|
+
*/
|
|
155
|
+
async getAvailableContexts() {
|
|
156
|
+
const contexts = [];
|
|
157
|
+
for (const guild of this.client.guilds.cache.values()) {
|
|
158
|
+
try {
|
|
159
|
+
const channels = await guild.channels.fetch();
|
|
160
|
+
for (const channel of channels.values()) {
|
|
161
|
+
if (channel && channel.isTextBased() && channel.type === ChannelType.GuildText) {
|
|
162
|
+
contexts.push({
|
|
163
|
+
id: channel.id,
|
|
164
|
+
name: `${guild.name} / #${channel.name}`,
|
|
165
|
+
type: 'group',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
console.error(`[Discord] Failed to fetch channels for guild ${guild.id}:`, error);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return contexts;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=discord-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discord-client.js","sourceRoot":"","sources":["../src/discord-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,iBAAiB,EACjB,MAAM,EAMN,WAAW,EACX,QAAQ,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAoBpC;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACb,OAAO,GAAG,SAAkB,CAAC;IAE9B,MAAM,CAAS;IACf,MAAM,CAAgC;IACtC,cAAc,CAA2C;IACzD,aAAa,CAAsD;IAE3E,YAAY,MAA2B;QACnC,IAAI,CAAC,MAAM,GAAG;YACV,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,KAAK;YACnB,GAAG,MAAM;SACZ,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC;YACrB,OAAO,EAAE;gBACL,iBAAiB,CAAC,MAAM;gBACxB,iBAAiB,CAAC,aAAa;gBAC/B,iBAAiB,CAAC,cAAc;gBAChC,iBAAiB,CAAC,cAAc;aACnC;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC,OAAO,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AAK,WAAW,CAAC,SAAS,EAAE,CAAC;wBAC7E,QAAQ,CAAC,IAAI,CAAC;4BACV,EAAE,EAAE,OAAO,CAAC,EAAE;4BACd,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,OAAO,OAAO,CAAC,IAAI,EAAE;4BACxC,IAAI,EAAE,OAAO;yBAChB,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,gDAAgD,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YACtF,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@link-os/discord",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Discord platform client for Linkos",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"discord.js": "^14.16.0",
|
|
22
|
+
"uuid": "^13.0.0",
|
|
23
|
+
"@link-os/types": "0.1.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^20.0.0",
|
|
27
|
+
"typescript": "^5.3.0"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"dev": "tsc --watch",
|
|
32
|
+
"clean": "rm -rf dist"
|
|
33
|
+
}
|
|
34
|
+
}
|