n8n-nodes-discord-dnd 0.1.10 → 0.1.11
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/nodes/src/discord-trigger/index.d.ts +1 -2
- package/dist/nodes/src/discord-trigger/index.js +35 -84
- package/dist/nodes/src/discord-trigger/index.js.map +1 -1
- package/dist/nodes/src/discord-trigger/node-description.d.ts +1 -1
- package/dist/nodes/src/discord-trigger/node-description.js +86 -259
- package/dist/nodes/src/discord-trigger/node-description.js.map +1 -1
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { INodeType, ITriggerFunctions, ITriggerResponse, ILoadOptionsFunctions, INodePropertyOptions } from
|
1
|
+
import { INodeType, ITriggerFunctions, ITriggerResponse, ILoadOptionsFunctions, INodePropertyOptions } from "n8n-workflow";
|
2
2
|
/**
|
3
3
|
* Discord Trigger node for n8n
|
4
4
|
* This is the main entry point for the node
|
@@ -8,7 +8,6 @@ export declare class DiscordTrigger implements INodeType {
|
|
8
8
|
methods: {
|
9
9
|
loadOptions: {
|
10
10
|
getServers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
11
|
-
getEvents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
12
11
|
};
|
13
12
|
};
|
14
13
|
trigger(this: ITriggerFunctions): Promise<ITriggerResponse>;
|
@@ -14,16 +14,16 @@ class DiscordTrigger {
|
|
14
14
|
this.methods = {
|
15
15
|
loadOptions: {
|
16
16
|
async getServers() {
|
17
|
-
const credentials = await this.getCredentials(
|
17
|
+
const credentials = (await this.getCredentials("discordApi"));
|
18
18
|
const client = await (0, client_1.initializeDiscordClient)(credentials.botToken);
|
19
19
|
// Wait for client to be ready
|
20
20
|
await new Promise((resolve) => {
|
21
21
|
if (client.isReady())
|
22
22
|
resolve();
|
23
23
|
else
|
24
|
-
client.once(
|
24
|
+
client.once("ready", () => resolve());
|
25
25
|
});
|
26
|
-
const servers = client.guilds.cache.map(guild => ({
|
26
|
+
const servers = client.guilds.cache.map((guild) => ({
|
27
27
|
name: guild.name,
|
28
28
|
value: guild.id,
|
29
29
|
description: `Server ID: ${guild.id}`,
|
@@ -32,90 +32,41 @@ class DiscordTrigger {
|
|
32
32
|
client.destroy();
|
33
33
|
return servers;
|
34
34
|
},
|
35
|
-
async getEvents() {
|
36
|
-
const resource = this.getCurrentNodeParameter('resource');
|
37
|
-
// Map of Discord events by resource
|
38
|
-
const eventMap = {
|
39
|
-
guild: [
|
40
|
-
{ name: 'Guild Create', value: 'guildCreate', description: 'Bot joins a guild' },
|
41
|
-
{ name: 'Guild Update', value: 'guildUpdate', description: 'Guild is updated' },
|
42
|
-
{ name: 'Guild Delete', value: 'guildDelete', description: 'Bot removed from a guild' },
|
43
|
-
],
|
44
|
-
member: [
|
45
|
-
{ name: 'Guild Member Add', value: 'guildMemberAdd', description: 'User joins a guild' },
|
46
|
-
{ name: 'Guild Member Remove', value: 'guildMemberRemove', description: 'User leaves a guild' },
|
47
|
-
{ name: 'Guild Member Update', value: 'guildMemberUpdate', description: 'Member is updated' },
|
48
|
-
],
|
49
|
-
message: [
|
50
|
-
{ name: 'Message Create', value: 'messageCreate', description: 'Message is created' },
|
51
|
-
{ name: 'Message Update', value: 'messageUpdate', description: 'Message is updated' },
|
52
|
-
{ name: 'Message Delete', value: 'messageDelete', description: 'Message is deleted' },
|
53
|
-
],
|
54
|
-
channel: [
|
55
|
-
{ name: 'Channel Create', value: 'channelCreate', description: 'Channel is created' },
|
56
|
-
{ name: 'Channel Update', value: 'channelUpdate', description: 'Channel is updated' },
|
57
|
-
{ name: 'Channel Delete', value: 'channelDelete', description: 'Channel is deleted' },
|
58
|
-
],
|
59
|
-
reaction: [
|
60
|
-
{ name: 'Message Reaction Add', value: 'messageReactionAdd', description: 'Reaction is added to a message' },
|
61
|
-
{ name: 'Message Reaction Remove', value: 'messageReactionRemove', description: 'Reaction is removed from a message' },
|
62
|
-
],
|
63
|
-
role: [
|
64
|
-
{ name: 'Role Create', value: 'roleCreate', description: 'Role is created' },
|
65
|
-
{ name: 'Role Update', value: 'roleUpdate', description: 'Role is updated' },
|
66
|
-
{ name: 'Role Delete', value: 'roleDelete', description: 'Role is deleted' },
|
67
|
-
],
|
68
|
-
invite: [
|
69
|
-
{ name: 'Invite Create', value: 'inviteCreate', description: 'Invite is created' },
|
70
|
-
{ name: 'Invite Delete', value: 'inviteDelete', description: 'Invite is deleted' },
|
71
|
-
],
|
72
|
-
voice: [
|
73
|
-
{ name: 'Voice State Update', value: 'voiceStateUpdate', description: 'User voice state changes' },
|
74
|
-
],
|
75
|
-
presence: [
|
76
|
-
{ name: 'Presence Update', value: 'presenceUpdate', description: 'User presence is updated' },
|
77
|
-
],
|
78
|
-
other: [
|
79
|
-
{ name: 'Interaction Create', value: 'interactionCreate', description: 'Interaction is created (slash command, button, etc.)' },
|
80
|
-
],
|
81
|
-
};
|
82
|
-
return eventMap[resource] || [];
|
83
|
-
},
|
84
35
|
},
|
85
36
|
};
|
86
37
|
}
|
87
38
|
async trigger() {
|
88
|
-
const credentials = await this.getCredentials(
|
39
|
+
const credentials = (await this.getCredentials("discordApi"));
|
89
40
|
// Get resource and event from node parameters
|
90
|
-
const resource = this.getNodeParameter(
|
91
|
-
const event = this.getNodeParameter(
|
41
|
+
const resource = this.getNodeParameter("resource", "message");
|
42
|
+
const event = this.getNodeParameter("event", "messageCreate");
|
92
43
|
// Extract other parameters as before
|
93
44
|
const parameters = {
|
94
|
-
triggerType: this.getNodeParameter(
|
95
|
-
includeBotMessages: this.getNodeParameter(
|
96
|
-
filterByServers: this.getNodeParameter(
|
45
|
+
triggerType: this.getNodeParameter("triggerType", "messageContent"),
|
46
|
+
includeBotMessages: this.getNodeParameter("includeBotMessages", false),
|
47
|
+
filterByServers: this.getNodeParameter("filterByServers", false),
|
97
48
|
serverIds: [],
|
98
|
-
filterByChannels: this.getNodeParameter(
|
49
|
+
filterByChannels: this.getNodeParameter("filterByChannels", false),
|
99
50
|
channelIds: [],
|
100
|
-
filterByRoles: this.getNodeParameter(
|
51
|
+
filterByRoles: this.getNodeParameter("filterByRoles", false),
|
101
52
|
roleIds: [],
|
102
53
|
};
|
103
54
|
// Process server filter parameters
|
104
55
|
if (parameters.filterByServers) {
|
105
|
-
parameters.serverFilterMethod = this.getNodeParameter(
|
56
|
+
parameters.serverFilterMethod = this.getNodeParameter("serverFilterMethod", "fromList");
|
106
57
|
switch (parameters.serverFilterMethod) {
|
107
|
-
case
|
108
|
-
parameters.serverIds = this.getNodeParameter(
|
58
|
+
case "fromList":
|
59
|
+
parameters.serverIds = this.getNodeParameter("serverIds", []);
|
109
60
|
break;
|
110
|
-
case
|
111
|
-
const url = this.getNodeParameter(
|
112
|
-
const serverIdFromUrl = url.split(
|
61
|
+
case "byUrl":
|
62
|
+
const url = this.getNodeParameter("serverUrl", "");
|
63
|
+
const serverIdFromUrl = url.split("/").pop();
|
113
64
|
if (serverIdFromUrl) {
|
114
65
|
parameters.serverIds = [serverIdFromUrl];
|
115
66
|
}
|
116
67
|
break;
|
117
|
-
case
|
118
|
-
const serverId = this.getNodeParameter(
|
68
|
+
case "byId":
|
69
|
+
const serverId = this.getNodeParameter("serverId", "");
|
119
70
|
if (serverId) {
|
120
71
|
parameters.serverIds = [serverId];
|
121
72
|
}
|
@@ -123,28 +74,28 @@ class DiscordTrigger {
|
|
123
74
|
}
|
124
75
|
}
|
125
76
|
if (parameters.filterByChannels) {
|
126
|
-
parameters.channelIds = this.getNodeParameter(
|
127
|
-
.split(
|
128
|
-
.map(id => id.trim());
|
77
|
+
parameters.channelIds = this.getNodeParameter("channelIds", "")
|
78
|
+
.split(",")
|
79
|
+
.map((id) => id.trim());
|
129
80
|
}
|
130
81
|
if (parameters.filterByRoles) {
|
131
|
-
parameters.roleIds = this.getNodeParameter(
|
132
|
-
.split(
|
133
|
-
.map(id => id.trim());
|
82
|
+
parameters.roleIds = this.getNodeParameter("roleIds", "")
|
83
|
+
.split(",")
|
84
|
+
.map((id) => id.trim());
|
134
85
|
}
|
135
86
|
// Get trigger-specific parameters
|
136
|
-
if (parameters.triggerType ===
|
137
|
-
parameters.matchPattern = this.getNodeParameter(
|
138
|
-
if ([
|
139
|
-
parameters.matchValue = this.getNodeParameter(
|
140
|
-
parameters.caseSensitive = this.getNodeParameter(
|
87
|
+
if (parameters.triggerType === "messageContent") {
|
88
|
+
parameters.matchPattern = this.getNodeParameter("matchPattern", "");
|
89
|
+
if (["contains", "endsWith", "equals", "startsWith"].includes(parameters.matchPattern)) {
|
90
|
+
parameters.matchValue = this.getNodeParameter("matchValue", "");
|
91
|
+
parameters.caseSensitive = this.getNodeParameter("caseSensitive", false);
|
141
92
|
}
|
142
|
-
else if (parameters.matchPattern ===
|
143
|
-
parameters.regexPattern = this.getNodeParameter(
|
93
|
+
else if (parameters.matchPattern === "regex") {
|
94
|
+
parameters.regexPattern = this.getNodeParameter("regexPattern", "");
|
144
95
|
}
|
145
96
|
}
|
146
|
-
else if (parameters.triggerType ===
|
147
|
-
parameters.interactionType = this.getNodeParameter(
|
97
|
+
else if (parameters.triggerType === "botInteraction") {
|
98
|
+
parameters.interactionType = this.getNodeParameter("interactionType", "botMentioned");
|
148
99
|
}
|
149
100
|
// Initialize Discord client
|
150
101
|
const client = await (0, client_1.initializeDiscordClient)(credentials.botToken);
|
@@ -156,7 +107,7 @@ class DiscordTrigger {
|
|
156
107
|
// Listen only for the selected event
|
157
108
|
(0, event_handlers_1.setupSelectedEventHandler)(client, this, event);
|
158
109
|
const closeFunction = async () => {
|
159
|
-
console.log(
|
110
|
+
console.log("Disconnecting from Discord...");
|
160
111
|
client.destroy();
|
161
112
|
};
|
162
113
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/index.ts"],"names":[],"mappings":";;;AAQA,qCAAmD;AACnD,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/src/discord-trigger/index.ts"],"names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GAAG,IAAI,CAAC,gBAAgB,CAChD,iBAAiB,EACjB,cAAc,CACL,CAAC;SACb;QAED,4BAA4B;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAA,gCAAuB,EAC1C,WAAW,CAAC,QAAkB,CAC/B,CAAC;QAEF,MAAM,YAAY,GAAqB;YACrC,qBAAqB,EAAE,KAAK,IAAI,EAAE;gBAChC,OAAO;YACT,CAAC;SACF,CAAC;QAEF,qCAAqC;QACrC,IAAA,0CAAyB,EAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAE/C,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;AAzKD,wCAyKC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { INodeTypeDescription } from
|
1
|
+
import { INodeTypeDescription } from "n8n-workflow";
|
2
2
|
export declare const nodeDescription: INodeTypeDescription;
|
@@ -2,241 +2,108 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.nodeDescription = void 0;
|
4
4
|
exports.nodeDescription = {
|
5
|
-
displayName:
|
6
|
-
name:
|
7
|
-
icon:
|
8
|
-
group: [
|
5
|
+
displayName: "Discord Trigger",
|
6
|
+
name: "discordTrigger",
|
7
|
+
icon: "file:discord.svg",
|
8
|
+
group: ["trigger"],
|
9
9
|
version: 1,
|
10
|
-
description:
|
11
|
-
defaults: {
|
12
|
-
name: 'Discord Trigger',
|
13
|
-
},
|
10
|
+
description: "Starts the workflow when Discord events occur",
|
11
|
+
defaults: { name: "Discord Trigger", color: "#7289DA" },
|
14
12
|
inputs: [],
|
15
|
-
outputs: [
|
13
|
+
outputs: ["main"],
|
16
14
|
credentials: [
|
17
15
|
{
|
18
|
-
name:
|
16
|
+
name: "discordApi",
|
19
17
|
required: true,
|
20
18
|
},
|
21
19
|
],
|
22
20
|
properties: [
|
23
21
|
{
|
24
|
-
displayName:
|
25
|
-
name:
|
26
|
-
type:
|
22
|
+
displayName: "Resource",
|
23
|
+
name: "resource",
|
24
|
+
type: "options",
|
27
25
|
options: [
|
28
|
-
{ name:
|
29
|
-
{ name:
|
30
|
-
{ name:
|
31
|
-
{ name:
|
32
|
-
{ name:
|
33
|
-
{ name:
|
34
|
-
{ name:
|
35
|
-
{ name:
|
36
|
-
{ name:
|
37
|
-
{ name:
|
26
|
+
{ name: "Guild", value: "guild" },
|
27
|
+
{ name: "Member", value: "member" },
|
28
|
+
{ name: "Message", value: "message" },
|
29
|
+
{ name: "Moderation", value: "moderation" },
|
30
|
+
{ name: "Emoji & Sticker", value: "emojiSticker" },
|
31
|
+
{ name: "Integration & Webhook", value: "integrationWebhook" },
|
32
|
+
{ name: "Invite", value: "invite" },
|
33
|
+
{ name: "Voice", value: "voice" },
|
34
|
+
{ name: "Presence", value: "presence" },
|
35
|
+
{ name: "Scheduled Event", value: "scheduledEvent" },
|
36
|
+
{ name: "Interaction", value: "interaction" },
|
37
|
+
{ name: "Bot Status", value: "botStatus" },
|
38
|
+
{ name: "User", value: "user" },
|
39
|
+
{ name: "Auto Moderation", value: "autoModeration" },
|
40
|
+
{ name: "Poll", value: "poll" },
|
41
|
+
{ name: "Other", value: "other" },
|
38
42
|
],
|
39
|
-
default:
|
43
|
+
default: "message",
|
40
44
|
required: true,
|
41
|
-
description:
|
45
|
+
description: "The Discord resource to listen for events on",
|
42
46
|
},
|
43
47
|
{
|
44
|
-
displayName:
|
45
|
-
name:
|
46
|
-
type:
|
47
|
-
|
48
|
-
|
49
|
-
},
|
50
|
-
default: 'messageCreate',
|
48
|
+
displayName: "Event",
|
49
|
+
name: "event",
|
50
|
+
type: "options",
|
51
|
+
default: "",
|
52
|
+
description: "The Discord event to trigger on",
|
51
53
|
required: true,
|
52
|
-
description: 'The Discord event to trigger on',
|
53
|
-
displayOptions: {
|
54
|
-
show: {
|
55
|
-
resource: [
|
56
|
-
'guild', 'member', 'message', 'channel', 'reaction', 'role', 'invite', 'voice', 'presence', 'other',
|
57
|
-
],
|
58
|
-
},
|
59
|
-
},
|
60
|
-
},
|
61
|
-
{
|
62
|
-
displayName: 'Trigger Type',
|
63
|
-
name: 'triggerType',
|
64
|
-
type: 'options',
|
65
54
|
options: [
|
55
|
+
// Dynamically populated based on resource
|
56
|
+
// Example for 'guild' resource
|
66
57
|
{
|
67
|
-
name:
|
68
|
-
value:
|
69
|
-
|
70
|
-
},
|
71
|
-
{
|
72
|
-
name: 'Bot Interaction',
|
73
|
-
value: 'botInteraction',
|
74
|
-
description: 'Triggered when users interact with the bot',
|
75
|
-
},
|
76
|
-
],
|
77
|
-
default: 'messageContent',
|
78
|
-
required: true,
|
79
|
-
},
|
80
|
-
// Bot Interaction Options
|
81
|
-
{
|
82
|
-
displayName: 'Interaction Type',
|
83
|
-
name: 'interactionType',
|
84
|
-
type: 'options',
|
85
|
-
displayOptions: {
|
86
|
-
show: {
|
87
|
-
triggerType: ['botInteraction'],
|
58
|
+
name: "Channel Create",
|
59
|
+
value: "channelCreate",
|
60
|
+
displayOptions: { show: { resource: ["guild"] } },
|
88
61
|
},
|
89
|
-
},
|
90
|
-
options: [
|
91
62
|
{
|
92
|
-
name:
|
93
|
-
value:
|
94
|
-
|
63
|
+
name: "Channel Delete",
|
64
|
+
value: "channelDelete",
|
65
|
+
displayOptions: { show: { resource: ["guild"] } },
|
95
66
|
},
|
67
|
+
// ... Add all events for each resource
|
68
|
+
// Example for 'message' resource
|
96
69
|
{
|
97
|
-
name:
|
98
|
-
value:
|
99
|
-
|
70
|
+
name: "Message Create",
|
71
|
+
value: "messageCreate",
|
72
|
+
displayOptions: { show: { resource: ["message"] } },
|
100
73
|
},
|
74
|
+
// ... Continue for other resources
|
101
75
|
],
|
102
|
-
default: 'botMentioned',
|
103
|
-
required: true,
|
104
76
|
},
|
105
|
-
// Message Content Options
|
106
77
|
{
|
107
|
-
displayName:
|
108
|
-
name:
|
109
|
-
type:
|
110
|
-
displayOptions: {
|
111
|
-
show: {
|
112
|
-
triggerType: ['messageContent'],
|
113
|
-
},
|
114
|
-
},
|
115
|
-
options: [
|
116
|
-
{
|
117
|
-
name: 'Bot Mention',
|
118
|
-
value: 'botMention',
|
119
|
-
description: 'The bot has to be mentioned somewhere in the message',
|
120
|
-
},
|
121
|
-
{
|
122
|
-
name: 'Contains',
|
123
|
-
value: 'contains',
|
124
|
-
description: 'Match the value in any position in the message',
|
125
|
-
},
|
126
|
-
{
|
127
|
-
name: 'Contains Image',
|
128
|
-
value: 'containsImage',
|
129
|
-
description: 'Triggers when a message contains an image attachment',
|
130
|
-
},
|
131
|
-
{
|
132
|
-
name: 'Ends With',
|
133
|
-
value: 'endsWith',
|
134
|
-
description: 'Match the message ending with the specified value',
|
135
|
-
},
|
136
|
-
{
|
137
|
-
name: 'Equals',
|
138
|
-
value: 'equals',
|
139
|
-
description: 'Match the exact same value',
|
140
|
-
},
|
141
|
-
{
|
142
|
-
name: 'Every',
|
143
|
-
value: 'every',
|
144
|
-
description: 'Triggers on every discord message',
|
145
|
-
},
|
146
|
-
{
|
147
|
-
name: 'Regex',
|
148
|
-
value: 'regex',
|
149
|
-
description: 'Match the custom ECMAScript regex provided',
|
150
|
-
},
|
151
|
-
{
|
152
|
-
name: 'Starts With',
|
153
|
-
value: 'startsWith',
|
154
|
-
description: 'Match the message beginning with the specified value',
|
155
|
-
},
|
156
|
-
],
|
157
|
-
default: 'botMention',
|
158
|
-
required: true,
|
159
|
-
},
|
160
|
-
{
|
161
|
-
displayName: 'Value to Match',
|
162
|
-
name: 'matchValue',
|
163
|
-
type: 'string',
|
164
|
-
default: '',
|
165
|
-
description: 'The text value to match in the message',
|
166
|
-
required: true,
|
167
|
-
displayOptions: {
|
168
|
-
show: {
|
169
|
-
triggerType: ['messageContent'],
|
170
|
-
matchPattern: ['contains', 'endsWith', 'equals', 'startsWith'],
|
171
|
-
},
|
172
|
-
},
|
173
|
-
},
|
174
|
-
{
|
175
|
-
displayName: 'Regex Pattern',
|
176
|
-
name: 'regexPattern',
|
177
|
-
type: 'string',
|
178
|
-
default: '',
|
179
|
-
placeholder: '^\\w+$',
|
180
|
-
description: 'The regular expression to match against the message content',
|
181
|
-
required: true,
|
182
|
-
displayOptions: {
|
183
|
-
show: {
|
184
|
-
triggerType: ['messageContent'],
|
185
|
-
matchPattern: ['regex'],
|
186
|
-
},
|
187
|
-
},
|
188
|
-
},
|
189
|
-
{
|
190
|
-
displayName: 'Case Sensitive',
|
191
|
-
name: 'caseSensitive',
|
192
|
-
type: 'boolean',
|
193
|
-
default: false,
|
194
|
-
description: 'Whether the matching should be case sensitive',
|
195
|
-
displayOptions: {
|
196
|
-
show: {
|
197
|
-
triggerType: ['messageContent'],
|
198
|
-
matchPattern: ['contains', 'endsWith', 'equals', 'startsWith'],
|
199
|
-
},
|
200
|
-
},
|
201
|
-
},
|
202
|
-
// Common Options
|
203
|
-
{
|
204
|
-
displayName: 'Include Bot Messages',
|
205
|
-
name: 'includeBotMessages',
|
206
|
-
type: 'boolean',
|
78
|
+
displayName: "Filter by Servers",
|
79
|
+
name: "filterByServers",
|
80
|
+
type: "boolean",
|
207
81
|
default: false,
|
208
|
-
description:
|
82
|
+
description: "Whether to filter messages by specific servers",
|
209
83
|
},
|
210
84
|
{
|
211
|
-
displayName:
|
212
|
-
name:
|
213
|
-
type:
|
214
|
-
default: false,
|
215
|
-
description: 'Whether to filter messages by specific servers',
|
216
|
-
},
|
217
|
-
{
|
218
|
-
displayName: 'Server Filter Method',
|
219
|
-
name: 'serverFilterMethod',
|
220
|
-
type: 'options',
|
85
|
+
displayName: "Server Filter Method",
|
86
|
+
name: "serverFilterMethod",
|
87
|
+
type: "options",
|
221
88
|
options: [
|
222
89
|
{
|
223
|
-
name:
|
224
|
-
value:
|
225
|
-
description:
|
90
|
+
name: "From List",
|
91
|
+
value: "fromList",
|
92
|
+
description: "Select from servers the bot has joined",
|
226
93
|
},
|
227
94
|
{
|
228
|
-
name:
|
229
|
-
value:
|
230
|
-
description:
|
95
|
+
name: "By URL",
|
96
|
+
value: "byUrl",
|
97
|
+
description: "Filter by Discord server URL",
|
231
98
|
},
|
232
99
|
{
|
233
|
-
name:
|
234
|
-
value:
|
235
|
-
description:
|
100
|
+
name: "By ID",
|
101
|
+
value: "byId",
|
102
|
+
description: "Filter by server ID",
|
236
103
|
},
|
237
104
|
],
|
238
|
-
default:
|
239
|
-
description:
|
105
|
+
default: "fromList",
|
106
|
+
description: "Method to filter servers",
|
240
107
|
displayOptions: {
|
241
108
|
show: {
|
242
109
|
filterByServers: [true],
|
@@ -244,88 +111,48 @@ exports.nodeDescription = {
|
|
244
111
|
},
|
245
112
|
},
|
246
113
|
{
|
247
|
-
displayName:
|
248
|
-
name:
|
249
|
-
type:
|
250
|
-
default:
|
251
|
-
description:
|
114
|
+
displayName: "Server URL",
|
115
|
+
name: "serverUrl",
|
116
|
+
type: "string",
|
117
|
+
default: "",
|
118
|
+
description: "Discord server URL (e.g: https://discord.com/channels/820342303745900635)",
|
252
119
|
displayOptions: {
|
253
120
|
show: {
|
254
121
|
filterByServers: [true],
|
255
|
-
serverFilterMethod: [
|
122
|
+
serverFilterMethod: ["byUrl"],
|
256
123
|
},
|
257
124
|
},
|
258
|
-
placeholder:
|
125
|
+
placeholder: "https://discord.com/channels/820342303745900635",
|
259
126
|
},
|
260
127
|
{
|
261
|
-
displayName:
|
262
|
-
name:
|
263
|
-
type:
|
264
|
-
default:
|
265
|
-
description:
|
128
|
+
displayName: "Server ID",
|
129
|
+
name: "serverId",
|
130
|
+
type: "string",
|
131
|
+
default: "",
|
132
|
+
description: "Discord server ID",
|
266
133
|
displayOptions: {
|
267
134
|
show: {
|
268
135
|
filterByServers: [true],
|
269
|
-
serverFilterMethod: [
|
136
|
+
serverFilterMethod: ["byId"],
|
270
137
|
},
|
271
138
|
},
|
272
|
-
placeholder:
|
139
|
+
placeholder: "820342303745900635",
|
273
140
|
},
|
274
141
|
{
|
275
|
-
displayName:
|
276
|
-
name:
|
277
|
-
type:
|
142
|
+
displayName: "Server List",
|
143
|
+
name: "serverIds",
|
144
|
+
type: "multiOptions",
|
278
145
|
typeOptions: {
|
279
|
-
loadOptionsMethod:
|
146
|
+
loadOptionsMethod: "getServers",
|
280
147
|
},
|
281
148
|
default: [],
|
282
|
-
description:
|
149
|
+
description: "Select servers from the list",
|
283
150
|
displayOptions: {
|
284
151
|
show: {
|
285
152
|
filterByServers: [true],
|
286
|
-
serverFilterMethod: [
|
287
|
-
},
|
288
|
-
},
|
289
|
-
},
|
290
|
-
{
|
291
|
-
displayName: 'Filter by Channels',
|
292
|
-
name: 'filterByChannels',
|
293
|
-
type: 'boolean',
|
294
|
-
default: false,
|
295
|
-
description: 'Whether to filter messages by specific channels',
|
296
|
-
},
|
297
|
-
{
|
298
|
-
displayName: 'Listen to Channels',
|
299
|
-
name: 'channelIds',
|
300
|
-
type: 'string',
|
301
|
-
default: '',
|
302
|
-
description: 'Comma-separated list of channel names or IDs to listen to (empty for all channels)',
|
303
|
-
displayOptions: {
|
304
|
-
show: {
|
305
|
-
filterByChannels: [true],
|
306
|
-
},
|
307
|
-
},
|
308
|
-
placeholder: 'general, 1234567890123456',
|
309
|
-
},
|
310
|
-
{
|
311
|
-
displayName: 'Filter by Roles',
|
312
|
-
name: 'filterByRoles',
|
313
|
-
type: 'boolean',
|
314
|
-
default: false,
|
315
|
-
description: 'Whether to filter messages by user roles',
|
316
|
-
},
|
317
|
-
{
|
318
|
-
displayName: 'Listen to Roles',
|
319
|
-
name: 'roleIds',
|
320
|
-
type: 'string',
|
321
|
-
default: '',
|
322
|
-
description: 'Comma-separated list of role names or IDs to listen to (empty for all roles)',
|
323
|
-
displayOptions: {
|
324
|
-
show: {
|
325
|
-
filterByRoles: [true],
|
153
|
+
serverFilterMethod: ["fromList"],
|
326
154
|
},
|
327
155
|
},
|
328
|
-
placeholder: 'admin, 1234567890123456',
|
329
156
|
},
|
330
157
|
],
|
331
158
|
};
|
@@ -1 +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
|
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,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE;IACvD,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,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;gBACjC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACnC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;gBACrC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;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