n8n-nodes-discord-dnd 0.1.76 → 0.1.78
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.
@@ -4,6 +4,23 @@ exports.DiscordAction = void 0;
|
|
4
4
|
const discord_js_1 = require("discord.js");
|
5
5
|
const voice_1 = require("@discordjs/voice");
|
6
6
|
const client_1 = require("./client");
|
7
|
+
let discordClient = null; // 🧠 Client được cache
|
8
|
+
async function waitForConnectionReady(connection, timeout = 30000) {
|
9
|
+
await Promise.race([
|
10
|
+
(0, voice_1.entersState)(connection, voice_1.VoiceConnectionStatus.Ready, timeout),
|
11
|
+
new Promise((_, reject) => {
|
12
|
+
connection.once(voice_1.VoiceConnectionStatus.Disconnected, () => reject(new Error("Disconnected")));
|
13
|
+
connection.once("error", reject);
|
14
|
+
}),
|
15
|
+
]);
|
16
|
+
}
|
17
|
+
async function getOrCreateDiscordClient(token, options) {
|
18
|
+
if (discordClient && discordClient.isReady()) {
|
19
|
+
return discordClient;
|
20
|
+
}
|
21
|
+
discordClient = await (0, client_1.initializeDiscordClient)(token, options);
|
22
|
+
return discordClient;
|
23
|
+
}
|
7
24
|
class DiscordAction {
|
8
25
|
constructor() {
|
9
26
|
this.description = {
|
@@ -33,12 +50,10 @@ class DiscordAction {
|
|
33
50
|
{
|
34
51
|
name: "Join Voice Channel",
|
35
52
|
value: "joinVoiceChannel",
|
36
|
-
description: "Join a voice channel",
|
37
53
|
},
|
38
54
|
{
|
39
55
|
name: "Leave Voice Channel",
|
40
56
|
value: "leaveVoiceChannel",
|
41
|
-
description: "Leave the current voice channel",
|
42
57
|
},
|
43
58
|
],
|
44
59
|
default: "joinVoiceChannel",
|
@@ -50,7 +65,6 @@ class DiscordAction {
|
|
50
65
|
type: "string",
|
51
66
|
default: "",
|
52
67
|
required: true,
|
53
|
-
description: "The ID of the Discord server (guild)",
|
54
68
|
},
|
55
69
|
{
|
56
70
|
displayName: "Channel ID",
|
@@ -63,7 +77,6 @@ class DiscordAction {
|
|
63
77
|
},
|
64
78
|
},
|
65
79
|
required: true,
|
66
|
-
description: "The ID of the voice channel to join",
|
67
80
|
},
|
68
81
|
],
|
69
82
|
};
|
@@ -73,73 +86,40 @@ class DiscordAction {
|
|
73
86
|
const operation = this.getNodeParameter("operation", 0);
|
74
87
|
const guildId = this.getNodeParameter("guildId", 0);
|
75
88
|
const channelId = this.getNodeParameter("channelId", 0);
|
76
|
-
// Initialize Discord client with voice intents
|
77
89
|
const clientOptions = {
|
78
|
-
intents: [
|
79
|
-
discord_js_1.GatewayIntentBits.Guilds,
|
80
|
-
discord_js_1.GatewayIntentBits.GuildMessages,
|
81
|
-
discord_js_1.GatewayIntentBits.MessageContent,
|
82
|
-
discord_js_1.GatewayIntentBits.DirectMessages,
|
83
|
-
discord_js_1.GatewayIntentBits.GuildVoiceStates,
|
84
|
-
],
|
90
|
+
intents: [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildVoiceStates],
|
85
91
|
partials: [discord_js_1.Partials.Channel],
|
86
92
|
};
|
87
|
-
const client = await (
|
93
|
+
const client = await getOrCreateDiscordClient(credentials.botToken, clientOptions);
|
88
94
|
try {
|
89
95
|
const guild = await client.guilds.fetch(guildId);
|
90
|
-
if (!guild)
|
91
|
-
throw new Error(`Could not find guild
|
92
|
-
}
|
93
|
-
const voiceChannel = (await guild.channels.fetch(channelId));
|
94
|
-
if (!voiceChannel || voiceChannel.type !== 2) {
|
95
|
-
// 2 = GUILD_VOICE
|
96
|
-
throw new Error("Channel is not a voice channel!");
|
97
|
-
}
|
96
|
+
if (!guild)
|
97
|
+
throw new Error(`Could not find guild ${guildId}`);
|
98
98
|
switch (operation) {
|
99
99
|
case "joinVoiceChannel": {
|
100
|
-
|
101
|
-
//
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
// }
|
110
|
-
// if (!permissions?.has(PermissionsBitField.Flags.Speak)) {
|
111
|
-
// throw new Error(
|
112
|
-
// "Bot does not have permission to speak in this voice channel"
|
113
|
-
// );
|
114
|
-
// }
|
115
|
-
// Create connection
|
100
|
+
const voiceChannel = (await guild.channels.fetch(channelId));
|
101
|
+
// is voice channel
|
102
|
+
if (!voiceChannel || voiceChannel.type !== 2) {
|
103
|
+
throw new Error(`Channel ${channelId} is not a valid voice channel`);
|
104
|
+
}
|
105
|
+
const oldConnection = (0, voice_1.getVoiceConnection)(guildId);
|
106
|
+
if (oldConnection) {
|
107
|
+
oldConnection.destroy();
|
108
|
+
}
|
116
109
|
const connection = (0, voice_1.joinVoiceChannel)({
|
117
|
-
channelId,
|
118
|
-
guildId,
|
110
|
+
channelId: voiceChannel.id,
|
111
|
+
guildId: voiceChannel.guild.id,
|
119
112
|
adapterCreator: voiceChannel.guild
|
120
113
|
.voiceAdapterCreator,
|
121
114
|
selfDeaf: false,
|
122
115
|
selfMute: false,
|
123
116
|
});
|
124
|
-
// Create an audio player to keep the connection alive
|
125
117
|
const player = (0, voice_1.createAudioPlayer)();
|
126
118
|
connection.subscribe(player);
|
127
119
|
try {
|
128
|
-
|
129
|
-
await Promise.race([
|
130
|
-
(0, voice_1.entersState)(connection, voice_1.VoiceConnectionStatus.Ready, 30000),
|
131
|
-
new Promise((_, reject) => {
|
132
|
-
connection.on(voice_1.VoiceConnectionStatus.Disconnected, () => {
|
133
|
-
reject(new Error("Voice connection was disconnected"));
|
134
|
-
});
|
135
|
-
connection.on("error", (error) => {
|
136
|
-
reject(error);
|
137
|
-
});
|
138
|
-
}),
|
139
|
-
]);
|
120
|
+
await waitForConnectionReady(connection);
|
140
121
|
}
|
141
122
|
catch (error) {
|
142
|
-
// Clean up if connection fails
|
143
123
|
connection.destroy();
|
144
124
|
throw new Error(`Failed to join voice channel: ${(error === null || error === void 0 ? void 0 : error.message) || "Unknown error"}`);
|
145
125
|
}
|
@@ -153,25 +133,18 @@ class DiscordAction {
|
|
153
133
|
break;
|
154
134
|
}
|
155
135
|
default:
|
156
|
-
throw new Error(`
|
136
|
+
throw new Error(`Unsupported operation "${operation}"`);
|
157
137
|
}
|
158
|
-
// Clean up: Destroy the client after operation is complete
|
159
|
-
client.destroy();
|
160
|
-
// Return success with additional details
|
161
138
|
return [
|
162
139
|
this.helpers.returnJsonArray({
|
163
140
|
success: true,
|
164
141
|
operation,
|
165
142
|
guildId,
|
166
|
-
channelId: operation === "joinVoiceChannel"
|
167
|
-
? this.getNodeParameter("channelId", 0)
|
168
|
-
: undefined,
|
143
|
+
channelId: operation === "joinVoiceChannel" ? channelId : undefined,
|
169
144
|
}),
|
170
145
|
];
|
171
146
|
}
|
172
147
|
catch (error) {
|
173
|
-
// Clean up on error
|
174
|
-
client.destroy();
|
175
148
|
throw error;
|
176
149
|
}
|
177
150
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DiscordAction.node.js","sourceRoot":"","sources":["../../src/nodes/DiscordAction.node.ts"],"names":[],"mappings":";;;AAMA,
|
1
|
+
{"version":3,"file":"DiscordAction.node.js","sourceRoot":"","sources":["../../src/nodes/DiscordAction.node.ts"],"names":[],"mappings":";;;AAMA,2CAA+E;AAC/E,4CAQ0B;AAC1B,qCAAmD;AAEnD,IAAI,aAAa,GAAkB,IAAI,CAAC,CAAC,uBAAuB;AAEhE,KAAK,UAAU,sBAAsB,CACnC,UAA2B,EAC3B,OAAO,GAAG,KAAM;IAEhB,MAAM,OAAO,CAAC,IAAI,CAAC;QACjB,IAAA,mBAAW,EAAC,UAAU,EAAE,6BAAqB,CAAC,KAAK,EAAE,OAAO,CAAC;QAC7D,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;YACxB,UAAU,CAAC,IAAI,CAAC,6BAAqB,CAAC,YAAY,EAAE,GAAG,EAAE,CACvD,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAClC,CAAC;YACF,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC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AS,CAAC,CAAC,CAAC,SAAS;iBACpE,CAAC;aACH,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC;SACb;IACH,CAAC;CACF;AAlJD,sCAkJC"}
|
@@ -0,0 +1,144 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DiscordTrigger2 = void 0;
|
30
|
+
const discord_js_1 = require("discord.js");
|
31
|
+
const voice_1 = require("@discordjs/voice");
|
32
|
+
const prism_media_1 = __importDefault(require("prism-media"));
|
33
|
+
const stream_1 = require("stream");
|
34
|
+
class BufferStream extends stream_1.Writable {
|
35
|
+
constructor(onDone) {
|
36
|
+
super();
|
37
|
+
this.onDone = onDone;
|
38
|
+
this.chunks = [];
|
39
|
+
}
|
40
|
+
_write(chunk, _encoding, callback) {
|
41
|
+
this.chunks.push(chunk);
|
42
|
+
callback();
|
43
|
+
}
|
44
|
+
_final(callback) {
|
45
|
+
const buffer = Buffer.concat(this.chunks);
|
46
|
+
this.onDone(buffer);
|
47
|
+
callback();
|
48
|
+
}
|
49
|
+
}
|
50
|
+
class DiscordTrigger2 {
|
51
|
+
constructor() {
|
52
|
+
this.description = {
|
53
|
+
displayName: "Discord Trigger 2",
|
54
|
+
name: "discordTrigger2",
|
55
|
+
icon: "file:../assets/icon/discord.svg",
|
56
|
+
group: ["trigger"],
|
57
|
+
version: 1,
|
58
|
+
description: "Trigger when someone speaks in a voice channel",
|
59
|
+
defaults: { name: "Discord Trigger 2" },
|
60
|
+
inputs: [],
|
61
|
+
outputs: ["main"],
|
62
|
+
credentials: [{ name: "discordApi", required: true }],
|
63
|
+
properties: [
|
64
|
+
{
|
65
|
+
displayName: "Voice Channel ID",
|
66
|
+
name: "voiceChannelId",
|
67
|
+
type: "string",
|
68
|
+
required: true,
|
69
|
+
default: "",
|
70
|
+
},
|
71
|
+
],
|
72
|
+
};
|
73
|
+
}
|
74
|
+
async trigger() {
|
75
|
+
const self = this; // Giữ lại context
|
76
|
+
const credentials = (await this.getCredentials("discordApi"));
|
77
|
+
const voiceChannelId = this.getNodeParameter("voiceChannelId");
|
78
|
+
const { Client } = await Promise.resolve().then(() => __importStar(require("discord.js")));
|
79
|
+
const clientOptions = {
|
80
|
+
intents: [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildVoiceStates],
|
81
|
+
partials: [discord_js_1.Partials.Channel],
|
82
|
+
};
|
83
|
+
const client = new Client(clientOptions);
|
84
|
+
client.once("ready", async () => {
|
85
|
+
const channel = (await client.channels.fetch(voiceChannelId));
|
86
|
+
if (!(channel === null || channel === void 0 ? void 0 : channel.isVoiceBased()))
|
87
|
+
return;
|
88
|
+
const connection = (0, voice_1.joinVoiceChannel)({
|
89
|
+
channelId: channel.id,
|
90
|
+
guildId: channel.guild.id,
|
91
|
+
adapterCreator: channel.guild
|
92
|
+
.voiceAdapterCreator,
|
93
|
+
});
|
94
|
+
connection.on(voice_1.VoiceConnectionStatus.Ready, () => {
|
95
|
+
console.log("Bot joined voice channel.");
|
96
|
+
});
|
97
|
+
client.on("voiceStateUpdate", (oldState, newState) => {
|
98
|
+
if (newState.channelId !== voiceChannelId)
|
99
|
+
return;
|
100
|
+
const receiver = connection.receiver;
|
101
|
+
const userId = newState.id;
|
102
|
+
const stream = receiver.subscribe(userId, {
|
103
|
+
end: { behavior: voice_1.EndBehaviorType.AfterSilence, duration: 1000 },
|
104
|
+
});
|
105
|
+
const decoder = new prism_media_1.default.opus.Decoder({
|
106
|
+
rate: 48000,
|
107
|
+
channels: 2,
|
108
|
+
frameSize: 960,
|
109
|
+
});
|
110
|
+
const bufferStream = new BufferStream(async (buffer) => {
|
111
|
+
console.log("Audio captured for user:", userId);
|
112
|
+
// Trả dữ liệu về n8n (nó sẽ vào trong workflow)
|
113
|
+
await self.emit([
|
114
|
+
[
|
115
|
+
{
|
116
|
+
json: {
|
117
|
+
userId,
|
118
|
+
timestamp: Date.now(),
|
119
|
+
},
|
120
|
+
binary: {
|
121
|
+
audio: await self.helpers.prepareBinaryData(buffer, "audio.pcm"),
|
122
|
+
},
|
123
|
+
},
|
124
|
+
],
|
125
|
+
]);
|
126
|
+
});
|
127
|
+
stream.pipe(decoder).pipe(bufferStream);
|
128
|
+
});
|
129
|
+
});
|
130
|
+
await client.login(credentials.botToken);
|
131
|
+
const closeFunction = async () => {
|
132
|
+
const conn = (0, voice_1.getVoiceConnection)(voiceChannelId);
|
133
|
+
if (conn)
|
134
|
+
conn.destroy();
|
135
|
+
client.destroy();
|
136
|
+
};
|
137
|
+
return {
|
138
|
+
closeFunction,
|
139
|
+
manualTriggerFunction: async () => { },
|
140
|
+
};
|
141
|
+
}
|
142
|
+
}
|
143
|
+
exports.DiscordTrigger2 = DiscordTrigger2;
|
144
|
+
//# sourceMappingURL=DiscordTrigger2.node.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DiscordTrigger2.node.js","sourceRoot":"","sources":["../../src/nodes/DiscordTrigger2.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,2CAKoB;AACpB,4CAM0B;AAC1B,8DAAgC;AAChC,mCAAkC;AAElC,MAAM,YAAa,SAAQ,iBAAQ;IAEjC,YAAoB,MAAgC;QAClD,KAAK,EAAE,CAAC;QADU,WAAM,GAAN,MAAM,CAA0B;QAD5C,WAAM,GAAa,EAAE,CAAC;IAG9B,CAAC;IACD,MAAM,CAAC,KAAU,EAAE,SAAyB,EAAE,QAAoB;QAChE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,QAAQ,EAAE,CAAC;IACb,CAAC;IACD,MAAM,CAAC,QAAoB;QACzB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpB,QAAQ,EAAE,CAAC;IACb,CAAC;CACF;AAED,MAAa,eAAe;IAA5B;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,mBAAmB;YAChC,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,iCAAiC;YACvC,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;YACvC,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,E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,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,QAAkB,CAAC,CAAC;QAEnD,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;YAC/B,MAAM,IAAI,GAAG,IAAA,0BAAkB,EAAC,cAAc,CAAC,CAAC;YAChD,IAAI,IAAI;gBAAE,IAAI,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC;QAEF,OAAO;YACL,aAAa;YACb,qBAAqB,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;SACtC,CAAC;IACJ,CAAC;CACF;AA9GD,0CA8GC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "n8n-nodes-discord-dnd",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.78",
|
4
4
|
"description": "n8n node to create triggers for Discord events",
|
5
5
|
"keywords": [
|
6
6
|
"n8n",
|
@@ -34,7 +34,8 @@
|
|
34
34
|
],
|
35
35
|
"nodes": [
|
36
36
|
"dist/nodes/DiscordTrigger.node.js",
|
37
|
-
"dist/nodes/DiscordAction.node.js"
|
37
|
+
"dist/nodes/DiscordAction.node.js",
|
38
|
+
"dist/nodes/DiscordTrigger2.node.js"
|
38
39
|
]
|
39
40
|
},
|
40
41
|
"devDependencies": {
|
@@ -51,8 +52,12 @@
|
|
51
52
|
"dependencies": {
|
52
53
|
"@discordjs/opus": "^0.10.0",
|
53
54
|
"@discordjs/voice": "^0.16.1",
|
54
|
-
"
|
55
|
+
"axios": "^1.9.0",
|
56
|
+
"discord.js": "^14.19.2",
|
57
|
+
"ffmpeg-static": "^5.2.0",
|
58
|
+
"fluent-ffmpeg": "^2.1.3",
|
55
59
|
"libsodium-wrappers": "^0.7.15",
|
56
|
-
"n8n-core": "~1.5.0"
|
60
|
+
"n8n-core": "~1.5.0",
|
61
|
+
"prism-media": "^1.3.5"
|
57
62
|
}
|
58
63
|
}
|