n8n-nodes-discord-dnd 1.0.20 → 1.0.22

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.
@@ -0,0 +1,7 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class DiscordWebhook implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscordWebhook = void 0;
4
+ class DiscordWebhook {
5
+ constructor() {
6
+ this.name = 'discordWebhookDnd';
7
+ this.displayName = 'Discord Webhook DND';
8
+ this.documentationUrl = 'https://discord.com/developers/docs/resources/webhook';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Webhook URL',
12
+ name: 'webhookUrl',
13
+ type: 'string',
14
+ default: '',
15
+ required: true,
16
+ placeholder: 'https://discord.com/api/webhooks/...',
17
+ description: 'The webhook URL from Discord',
18
+ },
19
+ ];
20
+ }
21
+ }
22
+ exports.DiscordWebhook = DiscordWebhook;
23
+ //# sourceMappingURL=DiscordWebhook.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscordWebhook.credentials.js","sourceRoot":"","sources":["../../src/credentials/DiscordWebhook.credentials.ts"],"names":[],"mappings":";;;AAKA,MAAa,cAAc;IAA3B;QACC,SAAI,GAAG,mBAAmB,CAAC;QAC3B,gBAAW,GAAG,qBAAqB,CAAC;QACpC,qBAAgB,GAAG,uDAAuD,CAAC;QAC3E,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,sCAAsC;gBACnD,WAAW,EAAE,8BAA8B;aAC3C;SACD,CAAC;IACH,CAAC;CAAA;AAfD,wCAeC"}
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DiscordActionDescription = void 0;
4
4
  const types_1 = require("../../Interfaces/types");
5
- const discord_js_1 = require("discord.js");
6
5
  exports.DiscordActionDescription = {
7
6
  displayName: "Discord Action DND",
8
7
  name: "discordActionDnd",
@@ -18,7 +17,21 @@ exports.DiscordActionDescription = {
18
17
  credentials: [
19
18
  {
20
19
  name: "discordApiDnd",
21
- required: true,
20
+ required: false,
21
+ displayOptions: {
22
+ show: {
23
+ connectionType: ["botToken"],
24
+ },
25
+ },
26
+ },
27
+ {
28
+ name: "discordWebhookDnd",
29
+ required: false,
30
+ displayOptions: {
31
+ show: {
32
+ connectionType: ["webhook"],
33
+ },
34
+ },
22
35
  },
23
36
  ],
24
37
  properties: [
@@ -47,62 +60,96 @@ exports.DiscordActionDescription = {
47
60
  loadOptionsDependsOn: ["actionType"],
48
61
  },
49
62
  },
63
+ // Send Message Fields - Connection Type
50
64
  {
51
- displayName: "Send as Direct Message",
52
- name: "sendAsDM",
53
- type: "boolean",
54
- default: false,
55
- description: "Whether to send the message as a direct message to a user instead of to a channel",
65
+ displayName: "Connection Type",
66
+ name: "connectionType",
67
+ type: "options",
68
+ required: true,
69
+ default: "botToken",
70
+ description: "The type of connection to use for sending messages",
71
+ options: [
72
+ { name: "Bot Token", value: "botToken" },
73
+ { name: "Webhook", value: "webhook" },
74
+ ],
75
+ displayOptions: {
76
+ show: {
77
+ action: [types_1.ActionEventType.SEND_MESSAGE],
78
+ },
79
+ },
80
+ },
81
+ // Bot Token - Send To
82
+ {
83
+ displayName: "Send To",
84
+ name: "sendTo",
85
+ type: "options",
86
+ required: true,
87
+ default: "channel",
88
+ description: "Where to send the message",
89
+ options: [
90
+ { name: "Channel", value: "channel" },
91
+ { name: "User", value: "user" },
92
+ ],
93
+ displayOptions: {
94
+ show: {
95
+ action: [types_1.ActionEventType.SEND_MESSAGE],
96
+ connectionType: ["botToken"],
97
+ },
98
+ },
99
+ },
100
+ // Bot Token - Server ID (for channel)
101
+ {
102
+ displayName: "Server ID",
103
+ name: "serverId",
104
+ type: "string",
105
+ default: "",
106
+ placeholder: "123456789012345678",
107
+ description: "The ID of the Discord server (guild)",
56
108
  displayOptions: {
57
109
  show: {
58
110
  action: [types_1.ActionEventType.SEND_MESSAGE],
111
+ connectionType: ["botToken"],
112
+ sendTo: ["channel"],
59
113
  },
60
114
  },
61
115
  },
116
+ // Bot Token - Channel ID (for channel)
62
117
  {
63
- displayName: "Channel Id",
118
+ displayName: "Channel ID",
64
119
  name: "channelId",
65
120
  type: "string",
66
121
  default: "",
67
122
  placeholder: "123456789012345678",
68
- description: "The ID of the channel to send the action to",
123
+ description: "The ID of the channel to send the message to",
69
124
  displayOptions: {
70
125
  show: {
71
- action: [
72
- types_1.ActionEventType.SEND_TYPING,
73
- types_1.ActionEventType.SEND_MESSAGE,
74
- types_1.ActionEventType.DELETE_MESSAGE,
75
- types_1.ActionEventType.EDIT_MESSAGE,
76
- types_1.ActionEventType.REACT_TO_MESSAGE,
77
- types_1.ActionEventType.REMOVE_REACTION,
78
- types_1.ActionEventType.PIN_MESSAGE,
79
- types_1.ActionEventType.UNPIN_MESSAGE,
80
- ],
126
+ action: [types_1.ActionEventType.SEND_MESSAGE],
127
+ connectionType: ["botToken"],
128
+ sendTo: ["channel"],
81
129
  },
82
130
  },
83
131
  },
132
+ // Bot Token - User ID (for user)
84
133
  {
85
134
  displayName: "User ID",
86
135
  name: "userId",
87
136
  type: "string",
88
137
  default: "",
89
138
  placeholder: "123456789012345678",
90
- description: "The ID of the user",
139
+ description: "The ID of the user to send a direct message to",
91
140
  displayOptions: {
92
141
  show: {
93
- action: [
94
- types_1.ActionEventType.SEND_MESSAGE,
95
- types_1.ActionEventType.SEND_TYPING,
96
- types_1.ActionEventType.REMOVE_REACTION,
97
- ],
142
+ action: [types_1.ActionEventType.SEND_MESSAGE],
143
+ connectionType: ["botToken"],
144
+ sendTo: ["user"],
98
145
  },
99
146
  },
100
147
  },
148
+ // Message Content
101
149
  {
102
- displayName: "Message Content",
150
+ displayName: "Message",
103
151
  name: "messageContent",
104
152
  type: "string",
105
- required: true,
106
153
  default: "",
107
154
  placeholder: "Hello, world!",
108
155
  description: "The content of the message to send",
@@ -112,6 +159,7 @@ exports.DiscordActionDescription = {
112
159
  },
113
160
  },
114
161
  },
162
+ // Options
115
163
  {
116
164
  displayName: "Options",
117
165
  name: "options",
@@ -119,6 +167,25 @@ exports.DiscordActionDescription = {
119
167
  placeholder: "Add Option",
120
168
  default: {},
121
169
  options: [
170
+ {
171
+ displayName: "Flags",
172
+ name: "flags",
173
+ type: "multiOptions",
174
+ default: [],
175
+ description: "Message flags to apply",
176
+ options: [
177
+ {
178
+ name: "Suppress Embeds",
179
+ value: "suppressEmbeds",
180
+ description: "Do not include any embeds when serializing this message",
181
+ },
182
+ {
183
+ name: "Suppress Notifications",
184
+ value: "suppressNotifications",
185
+ description: "Send a notification without pinging users",
186
+ },
187
+ ],
188
+ },
122
189
  {
123
190
  displayName: "Message to Reply to",
124
191
  name: "messageId",
@@ -134,6 +201,7 @@ exports.DiscordActionDescription = {
134
201
  },
135
202
  },
136
203
  },
204
+ // Embeds
137
205
  {
138
206
  displayName: "Embeds",
139
207
  name: "embeds",
@@ -163,61 +231,19 @@ exports.DiscordActionDescription = {
163
231
  },
164
232
  ],
165
233
  default: "fields",
166
- description: "Select how you want to input the message content and embeds.",
234
+ description: "Select how you want to input the embed data",
167
235
  },
168
236
  {
169
- displayName: "Title",
170
- name: "title",
171
- type: "string",
237
+ displayName: "Value",
238
+ name: "jsonPayload",
239
+ type: "json",
172
240
  default: "",
173
241
  displayOptions: {
174
242
  show: {
175
- inputMethod: ["fields"],
243
+ inputMethod: ["json"],
176
244
  },
177
245
  },
178
- description: "The title of the embed",
179
- },
180
- {
181
- displayName: "type",
182
- name: "type",
183
- type: "options",
184
- displayOptions: {
185
- show: {
186
- inputMethod: ["fields"],
187
- },
188
- },
189
- default: discord_js_1.EmbedType.Rich,
190
- description: "The type of embed to send",
191
- options: [
192
- {
193
- name: "Rich",
194
- value: discord_js_1.EmbedType.Rich,
195
- },
196
- {
197
- name: "Image",
198
- value: discord_js_1.EmbedType.Image,
199
- },
200
- {
201
- name: "Video",
202
- value: discord_js_1.EmbedType.Video,
203
- },
204
- {
205
- name: "Gifv",
206
- value: discord_js_1.EmbedType.GIFV,
207
- },
208
- {
209
- name: "Article",
210
- value: discord_js_1.EmbedType.Article,
211
- },
212
- {
213
- name: "Link",
214
- value: discord_js_1.EmbedType.Link,
215
- },
216
- {
217
- name: "Poll Result",
218
- value: discord_js_1.EmbedType.PollResult,
219
- },
220
- ],
246
+ description: "The JSON payload for the embed",
221
247
  },
222
248
  {
223
249
  displayName: "Description",
@@ -232,8 +258,8 @@ exports.DiscordActionDescription = {
232
258
  description: "The description of the embed",
233
259
  },
234
260
  {
235
- displayName: "URL",
236
- name: "url",
261
+ displayName: "Author",
262
+ name: "authorName",
237
263
  type: "string",
238
264
  default: "",
239
265
  displayOptions: {
@@ -241,95 +267,35 @@ exports.DiscordActionDescription = {
241
267
  inputMethod: ["fields"],
242
268
  },
243
269
  },
244
- description: "The URL of the embed",
245
- },
246
- {
247
- displayName: "Timestamp",
248
- name: "timestamp",
249
- type: "dateTime",
250
- default: "",
251
- description: "The timestamp to use for the embed. Leave blank for current time.",
252
- displayOptions: {
253
- show: {
254
- inputMethod: ["fields"],
255
- },
256
- },
270
+ description: "The name of the author of the embed",
257
271
  },
258
272
  {
259
273
  displayName: "Color",
260
274
  name: "color",
261
275
  type: "number",
262
276
  default: 0,
263
- description: "The color of the embed in RGB format. For example, 0xFF5733 for red.",
264
- displayOptions: {
265
- show: {
266
- inputMethod: ["fields"],
267
- },
268
- },
269
- },
270
- {
271
- displayName: "Footer Text",
272
- name: "footerText",
273
- type: "string",
274
- default: "",
277
+ description: "The color of the embed in decimal format. For example, 16711731 for red (#FF5733)",
275
278
  displayOptions: {
276
279
  show: {
277
280
  inputMethod: ["fields"],
278
281
  },
279
282
  },
280
- description: "The text to display in the footer of the embed",
281
283
  },
282
284
  {
283
- displayName: "Footer Icon URL",
284
- name: "footerIconUrl",
285
- type: "string",
286
- default: "",
287
- displayOptions: {
288
- show: {
289
- inputMethod: ["fields"],
290
- },
291
- },
292
- description: "The URL of the icon to display in the footer of the embed",
293
- },
294
- {
295
- displayName: "Image URL",
296
- name: "imageUrl",
297
- type: "string",
298
- default: "",
299
- displayOptions: {
300
- show: {
301
- inputMethod: ["fields"],
302
- },
303
- },
304
- description: "The URL of the image to include in the embed",
305
- },
306
- {
307
- displayName: "Thumbnail URL",
308
- name: "thumbnailUrl",
309
- type: "string",
310
- default: "",
311
- displayOptions: {
312
- show: {
313
- inputMethod: ["fields"],
314
- },
315
- },
316
- description: "The URL of the thumbnail to include in the embed",
317
- },
318
- {
319
- displayName: "Provider Name",
320
- name: "providerName",
321
- type: "string",
285
+ displayName: "Timestamp",
286
+ name: "timestamp",
287
+ type: "dateTime",
322
288
  default: "",
289
+ description: "The timestamp to use for the embed. Leave blank for current time.",
323
290
  displayOptions: {
324
291
  show: {
325
292
  inputMethod: ["fields"],
326
293
  },
327
294
  },
328
- description: "The name of the provider of the embed",
329
295
  },
330
296
  {
331
- displayName: "Provider URL",
332
- name: "providerUrl",
297
+ displayName: "Title",
298
+ name: "title",
333
299
  type: "string",
334
300
  default: "",
335
301
  displayOptions: {
@@ -337,11 +303,11 @@ exports.DiscordActionDescription = {
337
303
  inputMethod: ["fields"],
338
304
  },
339
305
  },
340
- description: "The URL of the provider of the embed",
306
+ description: "The title of the embed",
341
307
  },
342
308
  {
343
- displayName: "Author Name",
344
- name: "authorName",
309
+ displayName: "URL",
310
+ name: "url",
345
311
  type: "string",
346
312
  default: "",
347
313
  displayOptions: {
@@ -349,11 +315,11 @@ exports.DiscordActionDescription = {
349
315
  inputMethod: ["fields"],
350
316
  },
351
317
  },
352
- description: "The name of the author of the embed",
318
+ description: "The URL of the embed",
353
319
  },
354
320
  {
355
- displayName: "Author URL",
356
- name: "authorUrl",
321
+ displayName: "URL Image",
322
+ name: "imageUrl",
357
323
  type: "string",
358
324
  default: "",
359
325
  displayOptions: {
@@ -361,11 +327,11 @@ exports.DiscordActionDescription = {
361
327
  inputMethod: ["fields"],
362
328
  },
363
329
  },
364
- description: "The URL of the author of the embed",
330
+ description: "The URL of the image to include in the embed",
365
331
  },
366
332
  {
367
- displayName: "Author Icon URL",
368
- name: "authorIconUrl",
333
+ displayName: "URL Thumbnail",
334
+ name: "thumbnailUrl",
369
335
  type: "string",
370
336
  default: "",
371
337
  displayOptions: {
@@ -373,52 +339,10 @@ exports.DiscordActionDescription = {
373
339
  inputMethod: ["fields"],
374
340
  },
375
341
  },
376
- description: "The URL of the icon to display next to the author of the embed",
377
- },
378
- {
379
- displayName: "Fields",
380
- name: "fields",
381
- type: "fixedCollection",
382
- placeholder: "Add Field",
383
- displayOptions: {
384
- show: {
385
- inputMethod: ["fields"],
386
- },
387
- },
388
- default: {},
389
- description: "The fields to include in the embed. Each field can have a name, value, and inline option.",
390
- typeOptions: {
391
- multipleValues: true,
392
- },
393
- options: [
394
- {
395
- name: "field",
396
- displayName: "Field",
397
- values: [
398
- {
399
- displayName: "Name",
400
- name: "name",
401
- type: "string",
402
- default: "",
403
- },
404
- {
405
- displayName: "Value",
406
- name: "value",
407
- type: "string",
408
- default: "",
409
- },
410
- {
411
- displayName: "Inline",
412
- name: "inline",
413
- type: "boolean",
414
- default: false,
415
- },
416
- ],
417
- },
418
- ],
342
+ description: "The URL of the thumbnail to include in the embed",
419
343
  },
420
344
  {
421
- displayName: "video URL",
345
+ displayName: "URL Video",
422
346
  name: "videoUrl",
423
347
  displayOptions: {
424
348
  show: {
@@ -427,30 +351,89 @@ exports.DiscordActionDescription = {
427
351
  },
428
352
  type: "string",
429
353
  default: "",
430
- description: "The URL of the video to include in the embed. This will be ignored if the type is not video.",
354
+ description: "The URL of the video to include in the embed",
431
355
  },
356
+ ],
357
+ },
358
+ ],
359
+ description: "List of embeds to include in the message",
360
+ displayOptions: {
361
+ show: {
362
+ action: [types_1.ActionEventType.SEND_MESSAGE],
363
+ },
364
+ },
365
+ },
366
+ // Files
367
+ {
368
+ displayName: "Files",
369
+ name: "files",
370
+ type: "fixedCollection",
371
+ typeOptions: {
372
+ multipleValues: true,
373
+ },
374
+ placeholder: "Add File",
375
+ default: {},
376
+ options: [
377
+ {
378
+ name: "file",
379
+ displayName: "File",
380
+ values: [
432
381
  {
433
- displayName: "JSON Payload",
434
- name: "jsonPayload",
435
- type: "json",
436
- default: "",
437
- displayOptions: {
438
- show: {
439
- inputMethod: ["json"],
440
- },
441
- },
442
- description: "The JSON payload to send as the message. This will override all other fields.",
382
+ displayName: "Input Data Field Name",
383
+ name: "binaryProperty",
384
+ type: "string",
385
+ default: "data",
386
+ description: "The name of the input field containing the binary file data to be sent",
443
387
  },
444
388
  ],
445
389
  },
446
390
  ],
447
- description: " List of embeds to include in the message.",
391
+ description: "List of files to attach to the message",
448
392
  displayOptions: {
449
393
  show: {
450
394
  action: [types_1.ActionEventType.SEND_MESSAGE],
451
395
  },
452
396
  },
453
397
  },
398
+ // Other Actions - Channel ID
399
+ {
400
+ displayName: "Channel ID",
401
+ name: "channelId",
402
+ type: "string",
403
+ default: "",
404
+ placeholder: "123456789012345678",
405
+ description: "The ID of the channel",
406
+ displayOptions: {
407
+ show: {
408
+ action: [
409
+ types_1.ActionEventType.SEND_TYPING,
410
+ types_1.ActionEventType.DELETE_MESSAGE,
411
+ types_1.ActionEventType.EDIT_MESSAGE,
412
+ types_1.ActionEventType.REACT_TO_MESSAGE,
413
+ types_1.ActionEventType.REMOVE_REACTION,
414
+ types_1.ActionEventType.PIN_MESSAGE,
415
+ types_1.ActionEventType.UNPIN_MESSAGE,
416
+ ],
417
+ },
418
+ },
419
+ },
420
+ // Other Actions - User ID
421
+ {
422
+ displayName: "User ID",
423
+ name: "userId",
424
+ type: "string",
425
+ default: "",
426
+ placeholder: "123456789012345678",
427
+ description: "The ID of the user",
428
+ displayOptions: {
429
+ show: {
430
+ action: [
431
+ types_1.ActionEventType.SEND_TYPING,
432
+ types_1.ActionEventType.REMOVE_REACTION,
433
+ ],
434
+ },
435
+ },
436
+ },
454
437
  {
455
438
  displayName: "Message ID",
456
439
  name: "messageId",