n8n-nodes-discord-dnd 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.
Files changed (31) hide show
  1. package/dist/credentials/DiscordApi.credentials.d.ts +7 -0
  2. package/dist/credentials/DiscordApi.credentials.js +33 -0
  3. package/dist/credentials/DiscordApi.credentials.js.map +1 -0
  4. package/dist/nodes/DiscordTrigger/DiscordTrigger.node.d.ts +2 -0
  5. package/dist/nodes/DiscordTrigger/DiscordTrigger.node.js +6 -0
  6. package/dist/nodes/DiscordTrigger/DiscordTrigger.node.js.map +1 -0
  7. package/dist/nodes/src/discord-trigger/client.d.ts +17 -0
  8. package/dist/nodes/src/discord-trigger/client.js +52 -0
  9. package/dist/nodes/src/discord-trigger/client.js.map +1 -0
  10. package/dist/nodes/src/discord-trigger/event-handlers.d.ts +18 -0
  11. package/dist/nodes/src/discord-trigger/event-handlers.js +91 -0
  12. package/dist/nodes/src/discord-trigger/event-handlers.js.map +1 -0
  13. package/dist/nodes/src/discord-trigger/filters.d.ts +23 -0
  14. package/dist/nodes/src/discord-trigger/filters.js +65 -0
  15. package/dist/nodes/src/discord-trigger/filters.js.map +1 -0
  16. package/dist/nodes/src/discord-trigger/index.d.ts +9 -0
  17. package/dist/nodes/src/discord-trigger/index.js +84 -0
  18. package/dist/nodes/src/discord-trigger/index.js.map +1 -0
  19. package/dist/nodes/src/discord-trigger/node-description.d.ts +2 -0
  20. package/dist/nodes/src/discord-trigger/node-description.js +234 -0
  21. package/dist/nodes/src/discord-trigger/node-description.js.map +1 -0
  22. package/dist/nodes/src/discord-trigger/trigger-logic.d.ts +10 -0
  23. package/dist/nodes/src/discord-trigger/trigger-logic.js +85 -0
  24. package/dist/nodes/src/discord-trigger/trigger-logic.js.map +1 -0
  25. package/dist/nodes/src/discord-trigger/types.d.ts +82 -0
  26. package/dist/nodes/src/discord-trigger/types.js +3 -0
  27. package/dist/nodes/src/discord-trigger/types.js.map +1 -0
  28. package/dist/nodes/src/discord-trigger/utils.d.ts +6 -0
  29. package/dist/nodes/src/discord-trigger/utils.js +28 -0
  30. package/dist/nodes/src/discord-trigger/utils.js.map +1 -0
  31. package/package.json +52 -0
@@ -0,0 +1,7 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class DiscordApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscordApi = void 0;
4
+ class DiscordApi {
5
+ constructor() {
6
+ this.name = 'discordApi';
7
+ this.displayName = 'Discord API';
8
+ this.documentationUrl = 'https://discord.com/developers/docs/intro';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Bot Token',
12
+ name: 'botToken',
13
+ type: 'string',
14
+ typeOptions: {
15
+ password: true,
16
+ },
17
+ default: '',
18
+ required: true,
19
+ description: 'The token of your Discord bot',
20
+ },
21
+ {
22
+ displayName: 'Application ID',
23
+ name: 'applicationId',
24
+ type: 'string',
25
+ default: '',
26
+ required: true,
27
+ description: 'The application ID of your Discord application',
28
+ },
29
+ ];
30
+ }
31
+ }
32
+ exports.DiscordApi = DiscordApi;
33
+ //# sourceMappingURL=DiscordApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscordApi.credentials.js","sourceRoot":"","sources":["../../credentials/DiscordApi.credentials.ts"],"names":[],"mappings":";;;AAKA,MAAa,UAAU;IAAvB;QACC,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,2CAA2C,CAAC;QAC/D,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,+BAA+B;aAC5C;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gDAAgD;aAC7D;SACD,CAAC;IACH,CAAC;CAAA;AAzBD,gCAyBC"}
@@ -0,0 +1,2 @@
1
+ import { DiscordTrigger } from '../src/discord-trigger';
2
+ export { DiscordTrigger };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscordTrigger = void 0;
4
+ const discord_trigger_1 = require("../src/discord-trigger");
5
+ Object.defineProperty(exports, "DiscordTrigger", { enumerable: true, get: function () { return discord_trigger_1.DiscordTrigger; } });
6
+ //# sourceMappingURL=DiscordTrigger.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscordTrigger.node.js","sourceRoot":"","sources":["../../../nodes/DiscordTrigger/DiscordTrigger.node.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AAE/C,+FAFA,gCAAc,OAEA"}
@@ -0,0 +1,17 @@
1
+ import { Client } from 'discord.js';
2
+ /**
3
+ * Creates and initializes a Discord client with the required intents
4
+ * @returns Configured Discord client
5
+ */
6
+ export declare const createDiscordClient: () => Client;
7
+ /**
8
+ * Sets up the Discord client event listeners and status
9
+ * @param client Discord client instance
10
+ */
11
+ export declare const setupClientEvents: (client: Client) => void;
12
+ /**
13
+ * Initializes the Discord client, sets up events, and logs in
14
+ * @param token Bot token for authentication
15
+ * @returns Discord client instance
16
+ */
17
+ export declare const initializeDiscordClient: (token: string) => Promise<Client>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initializeDiscordClient = exports.setupClientEvents = exports.createDiscordClient = void 0;
4
+ const discord_js_1 = require("discord.js");
5
+ /**
6
+ * Creates and initializes a Discord client with the required intents
7
+ * @returns Configured Discord client
8
+ */
9
+ const createDiscordClient = () => {
10
+ // Initialize Discord client with necessary intents
11
+ const client = new discord_js_1.Client({
12
+ intents: [
13
+ discord_js_1.GatewayIntentBits.Guilds,
14
+ discord_js_1.GatewayIntentBits.GuildMessages,
15
+ discord_js_1.GatewayIntentBits.MessageContent,
16
+ discord_js_1.GatewayIntentBits.DirectMessages,
17
+ discord_js_1.GatewayIntentBits.GuildMembers,
18
+ ],
19
+ });
20
+ return client;
21
+ };
22
+ exports.createDiscordClient = createDiscordClient;
23
+ /**
24
+ * Sets up the Discord client event listeners and status
25
+ * @param client Discord client instance
26
+ */
27
+ const setupClientEvents = (client) => {
28
+ // Set an activity status for the bot when ready
29
+ client.once('ready', () => {
30
+ var _a, _b;
31
+ console.log(`Discord bot logged in as ${(_a = client.user) === null || _a === void 0 ? void 0 : _a.tag}`);
32
+ (_b = client.user) === null || _b === void 0 ? void 0 : _b.setActivity('with n8n workflows', { type: discord_js_1.ActivityType.Playing });
33
+ });
34
+ };
35
+ exports.setupClientEvents = setupClientEvents;
36
+ /**
37
+ * Initializes the Discord client, sets up events, and logs in
38
+ * @param token Bot token for authentication
39
+ * @returns Discord client instance
40
+ */
41
+ const initializeDiscordClient = async (token) => {
42
+ if (!token) {
43
+ throw new Error('No bot token provided in credentials!');
44
+ }
45
+ const client = (0, exports.createDiscordClient)();
46
+ (0, exports.setupClientEvents)(client);
47
+ // Login to Discord
48
+ await client.login(token);
49
+ return client;
50
+ };
51
+ exports.initializeDiscordClient = initializeDiscordClient;
52
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/client.ts"],"names":[],"mappings":";;;AAAA,2CAAqE;AAErE;;;GAGG;AACI,MAAM,mBAAmB,GAAG,GAAW,EAAE;IAC9C,mDAAmD;IACnD,MAAM,MAAM,GAAG,IAAI,mBAAM,CAAC;QACxB,OAAO,EAAE;YACP,8BAAiB,CAAC,MAAM;YACxB,8BAAiB,CAAC,aAAa;YAC/B,8BAAiB,CAAC,cAAc;YAChC,8BAAiB,CAAC,cAAc;YAChC,8BAAiB,CAAC,YAAY;SAC/B;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAbW,QAAA,mBAAmB,uBAa9B;AAEF;;;GAGG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAQ,EAAE;IACxD,gDAAgD;IAChD,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;;QACxB,OAAO,CAAC,GAAG,CAAC,4BAA4B,MAAA,MAAM,CAAC,IAAI,0CAAE,GAAG,EAAE,CAAC,CAAC;QAC5D,MAAA,MAAM,CAAC,IAAI,0CAAE,WAAW,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,yBAAY,CAAC,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B;AAEF;;;;GAIG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAAE,KAAa,EAAmB,EAAE;IAC9E,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;KAC1D;IAED,MAAM,MAAM,GAAG,IAAA,2BAAmB,GAAE,CAAC;IACrC,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IAE1B,mBAAmB;IACnB,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE1B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,uBAAuB,2BAYlC"}
@@ -0,0 +1,18 @@
1
+ import { Client, Message, PartialMessage } from 'discord.js';
2
+ import { ITriggerFunctions } from 'n8n-workflow';
3
+ import { IMessageData, ITriggerOptions } from './types';
4
+ /**
5
+ * Creates a message data object for emitting to n8n workflow
6
+ * @param message Discord message that triggered the workflow
7
+ * @param triggerType Type of trigger (messageContent or botInteraction)
8
+ * @param matchPattern The pattern that was matched
9
+ * @returns Formatted message data for n8n workflow
10
+ */
11
+ export declare const createMessageData: (message: Message | PartialMessage, triggerType: string, matchPattern: string) => IMessageData;
12
+ /**
13
+ * Sets up event handlers for the Discord client
14
+ * @param client Discord client
15
+ * @param triggerFunctions n8n trigger functions
16
+ * @param options Trigger configuration options
17
+ */
18
+ export declare const setupMessageEventHandler: (client: Client, triggerFunctions: ITriggerFunctions, options: ITriggerOptions) => void;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupMessageEventHandler = exports.createMessageData = void 0;
4
+ const discord_js_1 = require("discord.js");
5
+ const trigger_logic_1 = require("./trigger-logic");
6
+ const utils_1 = require("./utils");
7
+ /**
8
+ * Creates a message data object for emitting to n8n workflow
9
+ * @param message Discord message that triggered the workflow
10
+ * @param triggerType Type of trigger (messageContent or botInteraction)
11
+ * @param matchPattern The pattern that was matched
12
+ * @returns Formatted message data for n8n workflow
13
+ */
14
+ const createMessageData = (message, triggerType, matchPattern) => {
15
+ var _a, _b, _c, _d, _e;
16
+ return {
17
+ messageId: message.id,
18
+ content: message.content,
19
+ authorId: (_a = message.author) === null || _a === void 0 ? void 0 : _a.id,
20
+ authorUsername: (_b = message.author) === null || _b === void 0 ? void 0 : _b.username,
21
+ channelId: message.channelId,
22
+ channelName: (0, utils_1.getChannelName)(message.channel),
23
+ channelType: (_c = message.channel) === null || _c === void 0 ? void 0 : _c.type,
24
+ guildId: message.guildId,
25
+ guildName: (_d = message.guild) === null || _d === void 0 ? void 0 : _d.name,
26
+ isBot: ((_e = message.author) === null || _e === void 0 ? void 0 : _e.bot) || false,
27
+ createdTimestamp: message.createdTimestamp,
28
+ attachments: [...message.attachments.values()],
29
+ embeds: message.embeds,
30
+ mentions: {
31
+ users: [...message.mentions.users.values()].map(user => ({
32
+ id: user.id,
33
+ username: user.username,
34
+ })),
35
+ roles: [...message.mentions.roles.values()].map(role => ({
36
+ id: role.id,
37
+ name: role.name,
38
+ })),
39
+ channels: [...message.mentions.channels.values()].map(channel => ({
40
+ id: channel.id,
41
+ name: (0, utils_1.getChannelName)(channel),
42
+ })),
43
+ },
44
+ // For replies, include the reference
45
+ reference: message.reference ? {
46
+ messageId: message.reference.messageId,
47
+ channelId: message.reference.channelId,
48
+ guildId: message.reference.guildId,
49
+ } : null,
50
+ triggerType: triggerType,
51
+ matchPattern: matchPattern,
52
+ rawData: message,
53
+ };
54
+ };
55
+ exports.createMessageData = createMessageData;
56
+ /**
57
+ * Sets up event handlers for the Discord client
58
+ * @param client Discord client
59
+ * @param triggerFunctions n8n trigger functions
60
+ * @param options Trigger configuration options
61
+ */
62
+ const setupMessageEventHandler = (client, triggerFunctions, options) => {
63
+ client.on(discord_js_1.Events.MessageCreate, async (message) => {
64
+ try {
65
+ if ((0, trigger_logic_1.shouldTrigger)(message, client, options)) {
66
+ // Determine the match pattern to include in the data
67
+ let matchPattern = '';
68
+ if (options.triggerType === 'messageContent') {
69
+ matchPattern = options.matchPattern || '';
70
+ }
71
+ else if (options.triggerType === 'botInteraction') {
72
+ matchPattern = options.interactionType || '';
73
+ }
74
+ // Create message data and emit to n8n workflow
75
+ const messageData = (0, exports.createMessageData)(message, options.triggerType, matchPattern);
76
+ // Convert messageData to a plain object that satisfies IDataObject
77
+ const dataObject = {
78
+ ...messageData,
79
+ // Convert the rawData to prevent circular references
80
+ rawData: undefined,
81
+ };
82
+ await triggerFunctions.emit([triggerFunctions.helpers.returnJsonArray([dataObject])]);
83
+ }
84
+ }
85
+ catch (error) {
86
+ console.error('Error handling Discord message:', error);
87
+ }
88
+ });
89
+ };
90
+ exports.setupMessageEventHandler = setupMessageEventHandler;
91
+ //# sourceMappingURL=event-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-handlers.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/event-handlers.ts"],"names":[],"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ED,+CAA+C;gBAC/C,MAAM,WAAW,GAAG,IAAA,yBAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;gBAElF,mEAAmE;gBACnE,MAAM,UAAU,GAAgB;oBAC9B,GAAG,WAAW;oBACd,qDAAqD;oBACrD,OAAO,EAAE,SAAS;iBACnB,CAAC;gBAEF,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;aACvF;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;SACzD;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAhCW,QAAA,wBAAwB,4BAgCnC"}
@@ -0,0 +1,23 @@
1
+ import { Message, PartialMessage } from 'discord.js';
2
+ import { IFilterOptions } from './types';
3
+ /**
4
+ * Check if the message should be filtered based on server
5
+ * @param message Discord message
6
+ * @param options Filter options
7
+ * @returns Boolean indicating if message passes server filter
8
+ */
9
+ export declare const isServerAllowed: (message: Message | PartialMessage, options: IFilterOptions) => boolean;
10
+ /**
11
+ * Check if the message should be filtered based on channel
12
+ * @param message Discord message
13
+ * @param options Filter options
14
+ * @returns Boolean indicating if message passes channel filter
15
+ */
16
+ export declare const isChannelAllowed: (message: Message | PartialMessage, options: IFilterOptions) => boolean;
17
+ /**
18
+ * Check if the message should be filtered based on user roles
19
+ * @param message Discord message
20
+ * @param options Filter options
21
+ * @returns Boolean indicating if message passes role filter
22
+ */
23
+ export declare const isRoleAllowed: (message: Message | PartialMessage, options: IFilterOptions) => boolean;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRoleAllowed = exports.isChannelAllowed = exports.isServerAllowed = void 0;
4
+ const utils_1 = require("./utils");
5
+ /**
6
+ * Check if the message should be filtered based on server
7
+ * @param message Discord message
8
+ * @param options Filter options
9
+ * @returns Boolean indicating if message passes server filter
10
+ */
11
+ const isServerAllowed = (message, options) => {
12
+ if (!options.filterByServers || options.serverIds.length === 0)
13
+ return true;
14
+ // Allow if guildId is in the serverIds list or guild name matches
15
+ if (message.guild && options.serverIds.some(id => {
16
+ var _a, _b;
17
+ return id === ((_a = message.guild) === null || _a === void 0 ? void 0 : _a.id) ||
18
+ ((_b = message.guild) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()) === id.toLowerCase();
19
+ })) {
20
+ return true;
21
+ }
22
+ return false;
23
+ };
24
+ exports.isServerAllowed = isServerAllowed;
25
+ /**
26
+ * Check if the message should be filtered based on channel
27
+ * @param message Discord message
28
+ * @param options Filter options
29
+ * @returns Boolean indicating if message passes channel filter
30
+ */
31
+ const isChannelAllowed = (message, options) => {
32
+ if (!options.filterByChannels || options.channelIds.length === 0)
33
+ return true;
34
+ const channelName = (0, utils_1.getChannelName)(message.channel);
35
+ // Allow if channelId is in the channelIds list or channel name matches
36
+ if (options.channelIds.some(id => id === message.channelId ||
37
+ (channelName && channelName.toLowerCase() === id.toLowerCase()))) {
38
+ return true;
39
+ }
40
+ return false;
41
+ };
42
+ exports.isChannelAllowed = isChannelAllowed;
43
+ /**
44
+ * Check if the message should be filtered based on user roles
45
+ * @param message Discord message
46
+ * @param options Filter options
47
+ * @returns Boolean indicating if message passes role filter
48
+ */
49
+ const isRoleAllowed = (message, options) => {
50
+ var _a;
51
+ if (!options.filterByRoles || options.roleIds.length === 0)
52
+ return true;
53
+ // If not in a guild, can't filter by role
54
+ if (!message.guild || !message.member)
55
+ return false;
56
+ // Allow if user has any of the specified roles
57
+ const memberRoles = (_a = message.member.roles) === null || _a === void 0 ? void 0 : _a.cache;
58
+ if (memberRoles) {
59
+ return options.roleIds.some(id => memberRoles.some(role => role.id === id ||
60
+ role.name.toLowerCase() === id.toLowerCase()));
61
+ }
62
+ return false;
63
+ };
64
+ exports.isRoleAllowed = isRoleAllowed;
65
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/filters.ts"],"names":[],"mappings":";;;AAEA,mCAAyC;AAEzC;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,OAAiC,EAAE,OAAuB,EAAW,EAAE;IACrG,IAAI,CAAC,OAAO,CAAC,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE5E,kEAAkE;IAClE,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;;QAC/C,OAAA,EAAE,MAAK,MAAA,OAAO,CAAC,KAAK,0CAAE,EAAE,CAAA;YACxB,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,IAAI,CAAC,WAAW,EAAE,MAAK,EAAE,CAAC,WAAW,EAAE,CAAA;KAAA,CAAC,EAAE;QACzD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAXW,QAAA,eAAe,mBAW1B;AAEF;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,OAAiC,EAAE,OAAuB,EAAW,EAAE;IACtG,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE9E,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpD,uEAAuE;IACvE,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAC/B,EAAE,KAAK,OAAO,CAAC,SAAS;QACxB,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE;QAClE,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B;AAEF;;;;;GAKG;AACI,MAAM,aAAa,GAAG,CAAC,OAAiC,EAAE,OAAuB,EAAW,EAAE;;IACnG,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAExE,0CAA0C;IAC1C,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAEpD,+CAA+C;IAC/C,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,MAAM,CAAC,KAAK,0CAAE,KAAK,CAAC;IAChD,IAAI,WAAW,EAAE;QACf,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAC/B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACtB,IAAI,CAAC,EAAE,KAAK,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,CAC7C,CACF,CAAC;KACH;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAlBW,QAAA,aAAa,iBAkBxB"}
@@ -0,0 +1,9 @@
1
+ import { INodeType, ITriggerFunctions, ITriggerResponse } from 'n8n-workflow';
2
+ /**
3
+ * Discord Trigger node for n8n
4
+ * This is the main entry point for the node
5
+ */
6
+ export declare class DiscordTrigger implements INodeType {
7
+ description: import("n8n-workflow").INodeTypeDescription;
8
+ trigger(this: ITriggerFunctions): Promise<ITriggerResponse>;
9
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscordTrigger = void 0;
4
+ const client_1 = require("./client");
5
+ const event_handlers_1 = require("./event-handlers");
6
+ const node_description_1 = require("./node-description");
7
+ /**
8
+ * Discord Trigger node for n8n
9
+ * This is the main entry point for the node
10
+ */
11
+ class DiscordTrigger {
12
+ constructor() {
13
+ this.description = node_description_1.nodeDescription;
14
+ }
15
+ async trigger() {
16
+ const credentials = await this.getCredentials('discordApi');
17
+ // Extract parameters from node configuration
18
+ const parameters = {
19
+ // Get core parameters
20
+ triggerType: this.getNodeParameter('triggerType', 'messageContent'),
21
+ includeBotMessages: this.getNodeParameter('includeBotMessages', false),
22
+ // Get filter parameters
23
+ filterByServers: this.getNodeParameter('filterByServers', false),
24
+ serverIds: [],
25
+ filterByChannels: this.getNodeParameter('filterByChannels', false),
26
+ channelIds: [],
27
+ filterByRoles: this.getNodeParameter('filterByRoles', false),
28
+ roleIds: [],
29
+ };
30
+ // Process array parameters
31
+ if (parameters.filterByServers) {
32
+ parameters.serverIds = this.getNodeParameter('serverIds', '')
33
+ .split(',')
34
+ .map(id => id.trim());
35
+ }
36
+ if (parameters.filterByChannels) {
37
+ parameters.channelIds = this.getNodeParameter('channelIds', '')
38
+ .split(',')
39
+ .map(id => id.trim());
40
+ }
41
+ if (parameters.filterByRoles) {
42
+ parameters.roleIds = this.getNodeParameter('roleIds', '')
43
+ .split(',')
44
+ .map(id => id.trim());
45
+ }
46
+ // Get trigger-specific parameters
47
+ if (parameters.triggerType === 'messageContent') {
48
+ parameters.matchPattern = this.getNodeParameter('matchPattern', '');
49
+ if (['contains', 'endsWith', 'equals', 'startsWith'].includes(parameters.matchPattern)) {
50
+ parameters.matchValue = this.getNodeParameter('matchValue', '');
51
+ parameters.caseSensitive = this.getNodeParameter('caseSensitive', false);
52
+ }
53
+ else if (parameters.matchPattern === 'regex') {
54
+ parameters.regexPattern = this.getNodeParameter('regexPattern', '');
55
+ }
56
+ }
57
+ else if (parameters.triggerType === 'botInteraction') {
58
+ parameters.interactionType = this.getNodeParameter('interactionType', 'botMentioned');
59
+ }
60
+ // Initialize Discord client and set up event handlers
61
+ const client = await (0, client_1.initializeDiscordClient)(credentials.botToken);
62
+ // Set up response data with manual trigger function
63
+ const responseData = {
64
+ manualTriggerFunction: async () => {
65
+ // This function will be executed when the workflow is manually triggered
66
+ // Don't need to do anything here as we only want the workflow to be triggered by Discord events
67
+ return;
68
+ },
69
+ };
70
+ // Set up message event handler
71
+ (0, event_handlers_1.setupMessageEventHandler)(client, this, parameters);
72
+ // Function to clean up when node is deactivated
73
+ const closeFunction = async () => {
74
+ console.log('Disconnecting from Discord...');
75
+ client.destroy();
76
+ };
77
+ return {
78
+ ...responseData,
79
+ closeFunction,
80
+ };
81
+ }
82
+ }
83
+ exports.DiscordTrigger = DiscordTrigger;
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/index.ts"],"names":[],"mappings":";;;AAMA,qCAAmD;AACnD,qDAA4D;AAC5D,yDAAqD;AAGrD;;;GAGG;AACH,MAAa,cAAc;IAA3B;QACE,gBAAW,GAAG,kCAAe,CAAC;IA+EhC,CAAC;IA7EC,KAAK,CAAC,OAAO;QACX,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAmC,CAAC;QAE9F,6CAA6C;QAC7C,MAAM,UAAU,GAAuB;YACrC,sBAAsB;YACtB,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,gBAAgB,CAAW;YAC7E,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,KAAK,CAAY;YAEjF,wBAAwB;YACxB,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,KAAK,CAAY;YAC3E,SAAS,EAAE,EAAE;YACb,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,KAAK,CAAY;YAC7E,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,KAAK,CAAY;YACvE,OAAO,EAAE,EAAE;SACZ,CAAC;QAEF,2BA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Y,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,EAAE,CAAW,CAAC;aAC/E;SACF;aAAM,IAAI,UAAU,CAAC,WAAW,KAAK,gBAAgB,EAAE;YACtD,UAAU,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,cAAc,CAAW,CAAC;SACjG;QAED,sDAAsD;QACtD,MAAM,MAAM,GAAG,MAAM,IAAA,gCAAuB,EAAC,WAAW,CAAC,QAAkB,CAAC,CAAC;QAE7E,oDAAoD;QACpD,MAAM,YAAY,GAAqB;YACrC,qBAAqB,EAAE,KAAK,IAAI,EAAE;gBAChC,yEAAyE;gBACzE,gGAAgG;gBAChG,OAAO;YACT,CAAC;SACF,CAAC;QAEF,+BAA+B;QAC/B,IAAA,yCAAwB,EAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QAEnD,gDAAgD;QAChD,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;YAC/B,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;YAC7C,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC;QAEF,OAAO;YACL,GAAG,YAAY;YACf,aAAa;SACd,CAAC;IACJ,CAAC;CACF;AAhFD,wCAgFC"}
@@ -0,0 +1,2 @@
1
+ import { INodeTypeDescription } from 'n8n-workflow';
2
+ export declare const nodeDescription: INodeTypeDescription;
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeDescription = void 0;
4
+ exports.nodeDescription = {
5
+ displayName: 'Discord Trigger',
6
+ name: 'discordTrigger',
7
+ icon: 'file:discord.svg',
8
+ group: ['trigger'],
9
+ version: 1,
10
+ description: 'Starts the workflow when Discord events occur',
11
+ defaults: {
12
+ name: 'Discord Trigger',
13
+ },
14
+ inputs: [],
15
+ outputs: ['main'],
16
+ credentials: [
17
+ {
18
+ name: 'discordApi',
19
+ required: true,
20
+ },
21
+ ],
22
+ properties: [
23
+ {
24
+ displayName: 'Trigger Type',
25
+ name: 'triggerType',
26
+ type: 'options',
27
+ options: [
28
+ {
29
+ name: 'Message Content',
30
+ value: 'messageContent',
31
+ description: 'Triggered based on message content patterns',
32
+ },
33
+ {
34
+ name: 'Bot Interaction',
35
+ value: 'botInteraction',
36
+ description: 'Triggered when users interact with the bot',
37
+ },
38
+ ],
39
+ default: 'messageContent',
40
+ required: true,
41
+ },
42
+ // Bot Interaction Options
43
+ {
44
+ displayName: 'Interaction Type',
45
+ name: 'interactionType',
46
+ type: 'options',
47
+ displayOptions: {
48
+ show: {
49
+ triggerType: ['botInteraction'],
50
+ },
51
+ },
52
+ options: [
53
+ {
54
+ name: 'Bot Mentioned',
55
+ value: 'botMentioned',
56
+ description: 'Triggered when someone mentions the bot in a message',
57
+ },
58
+ {
59
+ name: 'Message Replied To',
60
+ value: 'messageReplied',
61
+ description: 'Triggered when someone replies to a message from the bot',
62
+ },
63
+ ],
64
+ default: 'botMentioned',
65
+ required: true,
66
+ },
67
+ // Message Content Options
68
+ {
69
+ displayName: 'Match Pattern',
70
+ name: 'matchPattern',
71
+ type: 'options',
72
+ displayOptions: {
73
+ show: {
74
+ triggerType: ['messageContent'],
75
+ },
76
+ },
77
+ options: [
78
+ {
79
+ name: 'Bot Mention',
80
+ value: 'botMention',
81
+ description: 'The bot has to be mentioned somewhere in the message',
82
+ },
83
+ {
84
+ name: 'Contains',
85
+ value: 'contains',
86
+ description: 'Match the value in any position in the message',
87
+ },
88
+ {
89
+ name: 'Contains Image',
90
+ value: 'containsImage',
91
+ description: 'Triggers when a message contains an image attachment',
92
+ },
93
+ {
94
+ name: 'Ends With',
95
+ value: 'endsWith',
96
+ description: 'Match the message ending with the specified value',
97
+ },
98
+ {
99
+ name: 'Equals',
100
+ value: 'equals',
101
+ description: 'Match the exact same value',
102
+ },
103
+ {
104
+ name: 'Every',
105
+ value: 'every',
106
+ description: 'Triggers on every discord message',
107
+ },
108
+ {
109
+ name: 'Regex',
110
+ value: 'regex',
111
+ description: 'Match the custom ECMAScript regex provided',
112
+ },
113
+ {
114
+ name: 'Starts With',
115
+ value: 'startsWith',
116
+ description: 'Match the message beginning with the specified value',
117
+ },
118
+ ],
119
+ default: 'contains',
120
+ required: true,
121
+ },
122
+ {
123
+ displayName: 'Value to Match',
124
+ name: 'matchValue',
125
+ type: 'string',
126
+ default: '',
127
+ description: 'The text value to match in the message',
128
+ required: true,
129
+ displayOptions: {
130
+ show: {
131
+ triggerType: ['messageContent'],
132
+ matchPattern: ['contains', 'endsWith', 'equals', 'startsWith'],
133
+ },
134
+ },
135
+ },
136
+ {
137
+ displayName: 'Regex Pattern',
138
+ name: 'regexPattern',
139
+ type: 'string',
140
+ default: '',
141
+ placeholder: '^\\w+$',
142
+ description: 'The regular expression to match against the message content',
143
+ required: true,
144
+ displayOptions: {
145
+ show: {
146
+ triggerType: ['messageContent'],
147
+ matchPattern: ['regex'],
148
+ },
149
+ },
150
+ },
151
+ {
152
+ displayName: 'Case Sensitive',
153
+ name: 'caseSensitive',
154
+ type: 'boolean',
155
+ default: false,
156
+ description: 'Whether the matching should be case sensitive',
157
+ displayOptions: {
158
+ show: {
159
+ triggerType: ['messageContent'],
160
+ matchPattern: ['contains', 'endsWith', 'equals', 'startsWith'],
161
+ },
162
+ },
163
+ },
164
+ // Common Options
165
+ {
166
+ displayName: 'Include Bot Messages',
167
+ name: 'includeBotMessages',
168
+ type: 'boolean',
169
+ default: false,
170
+ description: 'Whether to include messages from other bots or only from users',
171
+ },
172
+ {
173
+ displayName: 'Filter by Servers',
174
+ name: 'filterByServers',
175
+ type: 'boolean',
176
+ default: false,
177
+ description: 'Whether to filter messages by specific servers',
178
+ },
179
+ {
180
+ displayName: 'Server Names or IDs',
181
+ name: 'serverIds',
182
+ type: 'string',
183
+ default: '',
184
+ description: 'Comma-separated list of server names or IDs to listen to (empty for all servers)',
185
+ displayOptions: {
186
+ show: {
187
+ filterByServers: [true],
188
+ },
189
+ },
190
+ placeholder: 'server1Name, 1234567890123456',
191
+ },
192
+ {
193
+ displayName: 'Filter by Channels',
194
+ name: 'filterByChannels',
195
+ type: 'boolean',
196
+ default: false,
197
+ description: 'Whether to filter messages by specific channels',
198
+ },
199
+ {
200
+ displayName: 'Listen to Channels',
201
+ name: 'channelIds',
202
+ type: 'string',
203
+ default: '',
204
+ description: 'Comma-separated list of channel names or IDs to listen to (empty for all channels)',
205
+ displayOptions: {
206
+ show: {
207
+ filterByChannels: [true],
208
+ },
209
+ },
210
+ placeholder: 'general, 1234567890123456',
211
+ },
212
+ {
213
+ displayName: 'Filter by Roles',
214
+ name: 'filterByRoles',
215
+ type: 'boolean',
216
+ default: false,
217
+ description: 'Whether to filter messages by user roles',
218
+ },
219
+ {
220
+ displayName: 'Listen to Roles',
221
+ name: 'roleIds',
222
+ type: 'string',
223
+ default: '',
224
+ description: 'Comma-separated list of role names or IDs to listen to (empty for all roles)',
225
+ displayOptions: {
226
+ show: {
227
+ filterByRoles: [true],
228
+ },
229
+ },
230
+ placeholder: 'admin, 1234567890123456',
231
+ },
232
+ ],
233
+ };
234
+ //# sourceMappingURL=node-description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-description.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/node-description.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAyB;IACnD,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,CAAC,SAAS,CAAC;IAClB,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,+CAA+C;IAC5D,QAAQ,EAAE;QACR,IAAI,EAAE,iBAAiB;KACxB;IACD,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,WAAW,EAAE;QACX;YACE,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,IAAI;SACf;KACF;IACD,UAAU,EAAE;QACV;YACE,WAAW,EA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K;YACd,WAAW,EAAE,0CAA0C;SACxD;QACD;YACE,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,8EAA8E;YAC3F,cAAc,EAAE;gBACd,IAAI,EAAE;oBACJ,aAAa,EAAE,CAAC,IAAI,CAAC;iBACtB;aACF;YACD,WAAW,EAAE,yBAAyB;SACvC;KACF;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Message, PartialMessage } from 'discord.js';
2
+ import { ITriggerOptions } from './types';
3
+ /**
4
+ * Determines if a message should trigger the workflow based on provided options
5
+ * @param message Discord message
6
+ * @param client Discord client
7
+ * @param options Configuration options for triggering
8
+ * @returns Boolean indicating if the workflow should be triggered
9
+ */
10
+ export declare const shouldTrigger: (message: Message | PartialMessage, client: any, options: ITriggerOptions) => boolean;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldTrigger = void 0;
4
+ const filters_1 = require("./filters");
5
+ /**
6
+ * Determines if a message should trigger the workflow based on provided options
7
+ * @param message Discord message
8
+ * @param client Discord client
9
+ * @param options Configuration options for triggering
10
+ * @returns Boolean indicating if the workflow should be triggered
11
+ */
12
+ const shouldTrigger = (message, client, options) => {
13
+ var _a, _b, _c, _d, _e, _f, _g;
14
+ // Ignore messages from bots if not explicitly included
15
+ if (((_a = message.author) === null || _a === void 0 ? void 0 : _a.bot) && !options.includeBotMessages) {
16
+ return false;
17
+ }
18
+ // Check if message passes server, channel, and role filters
19
+ if (!(0, filters_1.isServerAllowed)(message, options) ||
20
+ !(0, filters_1.isChannelAllowed)(message, options) ||
21
+ !(0, filters_1.isRoleAllowed)(message, options)) {
22
+ return false;
23
+ }
24
+ // Check for the appropriate trigger condition
25
+ if (options.triggerType === 'botInteraction') {
26
+ if (options.interactionType === 'botMentioned') {
27
+ // Check if the bot was mentioned in the message
28
+ return !!((_c = (_b = message.mentions) === null || _b === void 0 ? void 0 : _b.users) === null || _c === void 0 ? void 0 : _c.has(client.user.id));
29
+ }
30
+ else if (options.interactionType === 'messageReplied') {
31
+ // Check if the message is a reply to a message from the bot
32
+ return !!(message.reference &&
33
+ message.reference.messageId &&
34
+ ((_e = (_d = message.mentions) === null || _d === void 0 ? void 0 : _d.repliedUser) === null || _e === void 0 ? void 0 : _e.id) === client.user.id);
35
+ }
36
+ }
37
+ else if (options.triggerType === 'messageContent') {
38
+ // Skip message content checks if content is not available
39
+ if (!message.content) {
40
+ // Special case: if we're looking for image attachments, we can continue
41
+ if (options.matchPattern === 'containsImage') {
42
+ return message.attachments && message.attachments.some(attachment => { var _a; return (_a = attachment.contentType) === null || _a === void 0 ? void 0 : _a.startsWith('image/'); });
43
+ }
44
+ return false;
45
+ }
46
+ // Get message content and apply case sensitivity
47
+ let content = message.content;
48
+ let valueToMatch = options.matchValue || '';
49
+ if (!options.caseSensitive && options.matchValue) {
50
+ content = content.toLowerCase();
51
+ valueToMatch = valueToMatch.toLowerCase();
52
+ }
53
+ // Perform pattern matching
54
+ switch (options.matchPattern) {
55
+ case 'botMention':
56
+ return !!((_g = (_f = message.mentions) === null || _f === void 0 ? void 0 : _f.users) === null || _g === void 0 ? void 0 : _g.has(client.user.id));
57
+ case 'contains':
58
+ return content.includes(valueToMatch);
59
+ case 'containsImage':
60
+ return message.attachments && message.attachments.some(attachment => { var _a; return (_a = attachment.contentType) === null || _a === void 0 ? void 0 : _a.startsWith('image/'); });
61
+ case 'endsWith':
62
+ return content.endsWith(valueToMatch);
63
+ case 'equals':
64
+ return content === valueToMatch;
65
+ case 'every':
66
+ return true;
67
+ case 'regex':
68
+ try {
69
+ const regex = new RegExp(options.regexPattern || '');
70
+ return regex.test(content);
71
+ }
72
+ catch (error) {
73
+ console.error('Invalid regex pattern:', error);
74
+ return false;
75
+ }
76
+ case 'startsWith':
77
+ return content.startsWith(valueToMatch);
78
+ default:
79
+ return false;
80
+ }
81
+ }
82
+ return false;
83
+ };
84
+ exports.shouldTrigger = shouldTrigger;
85
+ //# sourceMappingURL=trigger-logic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-logic.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/trigger-logic.ts"],"names":[],"mappings":";;;AACA,uCAA6E;AAG7E;;;;;;GAMG;AACI,MAAM,aAAa,GAAG,CAC3B,OAAiC,EACjC,MAAW,EACX,OAAwB,EACf,EAAE;;IACX,uDAAuD;IACvD,IAAI,CAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,GAAG,KAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE;QACtD,OAAO,KAAK,CAAC;KACd;IAED,4DAA4D;IAC5D,IACE,CAAC,IAAA,yBAAe,EAAC,OAAO,EAAE,OAAO,CAAC;QAClC,CAAC,IAAA,0BAAgB,EAAC,OAAO,EAAE,OAAO,CAAC;QACnC,CAAC,IAAA,uBAAa,EAAC,OAAO,EAAE,OAAO,CAAC,EAChC;QACA,OAAO,KAAK,CAAC;KACd;IAED,8CAA8C;IAC9C,IAAI,OAAO,CAAC,WAAW,KAAK,gBAAgB,EAAE;QAC5C,IAAI,OAAO,CAAC,eAAe,KAAK,cAAc,EAAE;YAC9C,gDAAgD;YAChD,OAAO,CAAC,CAAC,CAAA,MAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,KAAK,0CAAE,GAAG,CAAC,MAAM,CAAC,IAAK,CAAC,EAAE,CAAC,CAAA,CAAC;SACxD;aAAM,IAAI,OAAO,CAAC,eAAe,KAAK,gBAAgB,EAAE;YACvD,4DAA4D;YAC5D,OAAO,CAAC,CAAC,CACP,OAAO,CAAC,SAAS;gBACjB,OAAO,CAAC,SAAS,CAAC,SAAS;gBAC3B,CAAA,MAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,WAAW,0CAAE,EAAE,MAAK,MAAM,CAAC,IAAK,CAAC,EAAE,CACtD,CAAC;SACH;KACF;SAAM,IAAI,OAAO,CAAC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K,QAAQ;gBACX,OAAO,OAAO,KAAK,YAAY,CAAC;YAClC,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC;YACd,KAAK,OAAO;gBACV,IAAI;oBACF,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;oBACrD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;iBAC5B;gBAAC,OAAO,KAAK,EAAE;oBACd,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;oBAC/C,OAAO,KAAK,CAAC;iBACd;YACH,KAAK,YAAY;gBACf,OAAO,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAC1C;gBACE,OAAO,KAAK,CAAC;SAChB;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAnFW,QAAA,aAAa,iBAmFxB"}
@@ -0,0 +1,82 @@
1
+ import { Client, Message, PartialMessage } from 'discord.js';
2
+ import { ICredentialDataDecryptedObject, ITriggerFunctions } from 'n8n-workflow';
3
+ export interface ITriggerParameters {
4
+ triggerType: string;
5
+ includeBotMessages: boolean;
6
+ filterByServers: boolean;
7
+ serverIds: string[];
8
+ filterByChannels: boolean;
9
+ channelIds: string[];
10
+ filterByRoles: boolean;
11
+ roleIds: string[];
12
+ matchPattern?: string;
13
+ matchValue?: string;
14
+ regexPattern?: string;
15
+ caseSensitive?: boolean;
16
+ interactionType?: string;
17
+ }
18
+ export interface IDiscordClient {
19
+ client: Client;
20
+ login: (token: string) => Promise<string>;
21
+ destroy: () => void;
22
+ }
23
+ export interface IFilterOptions {
24
+ serverIds: string[];
25
+ channelIds: string[];
26
+ roleIds: string[];
27
+ filterByServers: boolean;
28
+ filterByChannels: boolean;
29
+ filterByRoles: boolean;
30
+ }
31
+ export interface ITriggerOptions extends IFilterOptions {
32
+ triggerType: string;
33
+ matchPattern?: string;
34
+ matchValue?: string;
35
+ regexPattern?: string;
36
+ caseSensitive?: boolean;
37
+ interactionType?: string;
38
+ includeBotMessages: boolean;
39
+ }
40
+ export interface IDiscordContext {
41
+ client: Client;
42
+ triggerFunctions: ITriggerFunctions;
43
+ credentials: ICredentialDataDecryptedObject;
44
+ parameters: ITriggerParameters;
45
+ }
46
+ export interface IMessageData {
47
+ messageId: string;
48
+ content: string | null;
49
+ authorId?: string;
50
+ authorUsername?: string;
51
+ channelId: string;
52
+ channelName: string | null;
53
+ channelType: any;
54
+ guildId: string | null;
55
+ guildName?: string;
56
+ isBot: boolean;
57
+ createdTimestamp: number;
58
+ attachments: any[];
59
+ embeds: any[];
60
+ mentions: {
61
+ users: Array<{
62
+ id: string;
63
+ username: string;
64
+ }>;
65
+ roles: Array<{
66
+ id: string;
67
+ name: string;
68
+ }>;
69
+ channels: Array<{
70
+ id: string;
71
+ name: string | null;
72
+ }>;
73
+ };
74
+ reference: {
75
+ messageId?: string;
76
+ channelId?: string;
77
+ guildId?: string;
78
+ } | null;
79
+ triggerType: string;
80
+ matchPattern: string;
81
+ rawData: Message | PartialMessage;
82
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get channel name safely handling different channel types
3
+ * @param channel The Discord channel to get name from
4
+ * @returns The channel name or null if not available
5
+ */
6
+ export declare const getChannelName: (channel: any) => string | null;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getChannelName = void 0;
4
+ const discord_js_1 = require("discord.js");
5
+ /**
6
+ * Get channel name safely handling different channel types
7
+ * @param channel The Discord channel to get name from
8
+ * @returns The channel name or null if not available
9
+ */
10
+ const getChannelName = (channel) => {
11
+ if (!channel)
12
+ return null;
13
+ // Handle different channel types explicitly
14
+ if (channel instanceof discord_js_1.TextChannel || channel instanceof discord_js_1.ThreadChannel) {
15
+ return channel.name;
16
+ }
17
+ // For DM channels
18
+ if (channel.type === discord_js_1.ChannelType.DM) {
19
+ return 'Direct Message';
20
+ }
21
+ // Fallback for other channel types that might have a name property
22
+ if ('name' in channel && typeof channel.name === 'string') {
23
+ return channel.name;
24
+ }
25
+ return 'Unknown Channel';
26
+ };
27
+ exports.getChannelName = getChannelName;
28
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/utils.ts"],"names":[],"mappings":";;;AAAA,2CAAqE;AAErE;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,OAAY,EAAiB,EAAE;IAC5D,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,4CAA4C;IAC5C,IAAI,OAAO,YAAY,wBAAW,IAAI,OAAO,YAAY,0BAAa,EAAE;QACtE,OAAO,OAAO,CAAC,IAAI,CAAC;KACrB;IAED,kBAAkB;IAClB,IAAI,OAAO,CAAC,IAAI,KAAK,wBAAW,CAAC,EAAE,EAAE;QACnC,OAAO,gBAAgB,CAAC;KACzB;IAED,mEAAmE;IACnE,IAAI,MAAM,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzD,OAAO,OAAO,CAAC,IAAI,CAAC;KACrB;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAnBW,QAAA,cAAc,kBAmBzB"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "n8n-nodes-discord-dnd",
3
+ "version": "0.1.1",
4
+ "description": "n8n node to create triggers for Discord events",
5
+ "keywords": [
6
+ "n8n",
7
+ "n8n-node",
8
+ "n8n-node-discord",
9
+ "discord",
10
+ "trigger",
11
+ "webhook"
12
+ ],
13
+ "author": {
14
+ "name": "NguyenDanhDa"
15
+ },
16
+ "license": "MIT",
17
+ "main": "index.js",
18
+ "scripts": {
19
+ "dev": "npm run watch",
20
+ "build": "tsc && gulp build:icons",
21
+ "lint": "tslint -p tsconfig.json -c tslint.json",
22
+ "watch": "tsc --watch",
23
+ "test": "jest"
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "n8n": {
29
+ "n8nNodesApiVersion": 1,
30
+ "credentials": [
31
+ "dist/credentials/DiscordApi.credentials.js"
32
+ ],
33
+ "nodes": [
34
+ "dist/nodes/DiscordTrigger/DiscordTrigger.node.js"
35
+ ]
36
+ },
37
+ "devDependencies": {
38
+ "@types/express": "^4.17.17",
39
+ "@types/jest": "^29.5.0",
40
+ "@types/node": "^18.16.0",
41
+ "gulp": "^4.0.2",
42
+ "jest": "^29.5.0",
43
+ "n8n-workflow": "~1.5.0",
44
+ "ts-jest": "^29.1.0",
45
+ "tslint": "^6.1.3",
46
+ "typescript": "~5.0.4"
47
+ },
48
+ "dependencies": {
49
+ "discord.js": "^14.9.0",
50
+ "n8n-core": "~1.5.0"
51
+ }
52
+ }