@scopieflows/app-discord 0.4.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 (75) hide show
  1. package/README.md +7 -0
  2. package/package.json +29 -0
  3. package/src/i18n/ca.json +101 -0
  4. package/src/i18n/de.json +108 -0
  5. package/src/i18n/es.json +108 -0
  6. package/src/i18n/fr.json +108 -0
  7. package/src/i18n/hi.json +101 -0
  8. package/src/i18n/id.json +101 -0
  9. package/src/i18n/ja.json +108 -0
  10. package/src/i18n/nl.json +108 -0
  11. package/src/i18n/pt.json +108 -0
  12. package/src/i18n/ru.json +101 -0
  13. package/src/i18n/translation.json +108 -0
  14. package/src/i18n/vi.json +101 -0
  15. package/src/i18n/zh.json +108 -0
  16. package/src/index.d.ts +2 -0
  17. package/src/index.js +87 -0
  18. package/src/index.js.map +1 -0
  19. package/src/lib/actions/add-role-to-member.d.ts +5 -0
  20. package/src/lib/actions/add-role-to-member.js +40 -0
  21. package/src/lib/actions/add-role-to-member.js.map +1 -0
  22. package/src/lib/actions/ban-a-guild-member.d.ts +5 -0
  23. package/src/lib/actions/ban-a-guild-member.js +48 -0
  24. package/src/lib/actions/ban-a-guild-member.js.map +1 -0
  25. package/src/lib/actions/create-channel.d.ts +4 -0
  26. package/src/lib/actions/create-channel.js +46 -0
  27. package/src/lib/actions/create-channel.js.map +1 -0
  28. package/src/lib/actions/create-guild-role.d.ts +8 -0
  29. package/src/lib/actions/create-guild-role.js +70 -0
  30. package/src/lib/actions/create-guild-role.js.map +1 -0
  31. package/src/lib/actions/delete-channel.d.ts +3 -0
  32. package/src/lib/actions/delete-channel.js +32 -0
  33. package/src/lib/actions/delete-channel.js.map +1 -0
  34. package/src/lib/actions/delete-guild-role.d.ts +5 -0
  35. package/src/lib/actions/delete-guild-role.js +41 -0
  36. package/src/lib/actions/delete-guild-role.js.map +1 -0
  37. package/src/lib/actions/find-channel.d.ts +4 -0
  38. package/src/lib/actions/find-channel.js +41 -0
  39. package/src/lib/actions/find-channel.js.map +1 -0
  40. package/src/lib/actions/find-guild-member.d.ts +4 -0
  41. package/src/lib/actions/find-guild-member.js +52 -0
  42. package/src/lib/actions/find-guild-member.js.map +1 -0
  43. package/src/lib/actions/remove-ban-from-user.d.ts +5 -0
  44. package/src/lib/actions/remove-ban-from-user.js +48 -0
  45. package/src/lib/actions/remove-ban-from-user.js.map +1 -0
  46. package/src/lib/actions/remove-member-from-guild.d.ts +4 -0
  47. package/src/lib/actions/remove-member-from-guild.js +39 -0
  48. package/src/lib/actions/remove-member-from-guild.js.map +1 -0
  49. package/src/lib/actions/remove-role-from-member.d.ts +5 -0
  50. package/src/lib/actions/remove-role-from-member.js +40 -0
  51. package/src/lib/actions/remove-role-from-member.js.map +1 -0
  52. package/src/lib/actions/rename-channel.d.ts +4 -0
  53. package/src/lib/actions/rename-channel.js +42 -0
  54. package/src/lib/actions/rename-channel.js.map +1 -0
  55. package/src/lib/actions/send-approval-message.d.ts +4 -0
  56. package/src/lib/actions/send-approval-message.js +79 -0
  57. package/src/lib/actions/send-approval-message.js.map +1 -0
  58. package/src/lib/actions/send-message-webhook.d.ts +8 -0
  59. package/src/lib/actions/send-message-webhook.js +59 -0
  60. package/src/lib/actions/send-message-webhook.js.map +1 -0
  61. package/src/lib/actions/send-message-with-bot.d.ts +5 -0
  62. package/src/lib/actions/send-message-with-bot.js +63 -0
  63. package/src/lib/actions/send-message-with-bot.js.map +1 -0
  64. package/src/lib/common/index.d.ts +11 -0
  65. package/src/lib/common/index.js +147 -0
  66. package/src/lib/common/index.js.map +1 -0
  67. package/src/lib/common/models.d.ts +39 -0
  68. package/src/lib/common/models.js +3 -0
  69. package/src/lib/common/models.js.map +1 -0
  70. package/src/lib/triggers/new-member.d.ts +14 -0
  71. package/src/lib/triggers/new-member.js +96 -0
  72. package/src/lib/triggers/new-member.js.map +1 -0
  73. package/src/lib/triggers/new-message.d.ts +14 -0
  74. package/src/lib/triggers/new-message.js +96 -0
  75. package/src/lib/triggers/new-message.js.map +1 -0
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.discordSendMessageWebhook = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ exports.discordSendMessageWebhook = (0, pieces_framework_1.createAction)({
8
+ name: 'send_message_webhook',
9
+ description: 'Send a discord message via webhook',
10
+ displayName: 'Send Message Webhook',
11
+ requireAuth: false,
12
+ props: {
13
+ webhook_url: pieces_framework_1.Property.ShortText({
14
+ displayName: 'Webhook URL',
15
+ required: true,
16
+ }),
17
+ username: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Name',
19
+ required: false,
20
+ }),
21
+ content: pieces_framework_1.Property.LongText({
22
+ displayName: 'Message',
23
+ required: true,
24
+ }),
25
+ avatar_url: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Avatar URL',
27
+ description: 'The avatar url for webhook',
28
+ required: false,
29
+ }),
30
+ embeds: pieces_framework_1.Property.Json({
31
+ displayName: 'embeds',
32
+ description: 'Embeds to send along with the message',
33
+ required: false,
34
+ defaultValue: [],
35
+ }),
36
+ tts: pieces_framework_1.Property.Checkbox({
37
+ displayName: 'Text to speech',
38
+ description: 'Robot reads the message',
39
+ required: false,
40
+ }),
41
+ },
42
+ run(configValue) {
43
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
44
+ const request = {
45
+ method: pieces_common_1.HttpMethod.POST,
46
+ url: configValue.propsValue['webhook_url'],
47
+ body: {
48
+ username: configValue.propsValue['username'],
49
+ content: configValue.propsValue['content'],
50
+ avatar_url: configValue.propsValue['avatar_url'],
51
+ tts: configValue.propsValue['tts'],
52
+ embeds: configValue.propsValue['embeds'],
53
+ },
54
+ };
55
+ return yield pieces_common_1.httpClient.sendRequest(request);
56
+ });
57
+ },
58
+ });
59
+ //# sourceMappingURL=send-message-webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-message-webhook.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/send-message-webhook.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAIoC;AAEvB,QAAA,yBAAyB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,KAAK;IAClB,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACpB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACrB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAMR;gBACH,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC;gBAC1C,IAAI,EAAE;oBACJ,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC;oBAC5C,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC;oBAC1C,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC;oBAChD,GAAG,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC;oBAClC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;iBACzC;aACF,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;QACtD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const sendMessageWithBot: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
2
+ channel_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
3
+ message: import("@scopieflows/pieces-framework").LongTextProperty<false>;
4
+ files: import("@scopieflows/pieces-framework").ArrayProperty<false>;
5
+ }>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendMessageWithBot = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const index_1 = require("../../index");
8
+ const common_1 = require("../common");
9
+ const form_data_1 = tslib_1.__importDefault(require("form-data"));
10
+ exports.sendMessageWithBot = (0, pieces_framework_1.createAction)({
11
+ name: 'sendMessageWithBot',
12
+ auth: index_1.discordAuth,
13
+ displayName: 'Send Message with Bot',
14
+ description: 'Send messages via bot to any channel or thread you want, with an optional file attachment.',
15
+ props: {
16
+ channel_id: common_1.discordCommon.channel,
17
+ message: pieces_framework_1.Property.LongText({
18
+ displayName: 'Message',
19
+ description: 'Message content to send.',
20
+ required: false,
21
+ }),
22
+ files: pieces_framework_1.Property.Array({
23
+ displayName: 'Attachments',
24
+ properties: {
25
+ file: pieces_framework_1.Property.File({
26
+ displayName: 'File',
27
+ description: 'Optional file to send with the message.',
28
+ required: false,
29
+ }),
30
+ },
31
+ required: false,
32
+ defaultValue: [],
33
+ }),
34
+ },
35
+ run(configValue) {
36
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
+ var _a;
38
+ const channelId = configValue.propsValue.channel_id;
39
+ const message = configValue.propsValue.message;
40
+ const files = (_a = configValue.propsValue.files) !== null && _a !== void 0 ? _a : [];
41
+ const formData = new form_data_1.default();
42
+ formData.append('content', message);
43
+ if (files && files.length > 0) {
44
+ files.forEach((fileObj, index) => {
45
+ const file = fileObj.file;
46
+ formData.append(`files[${index}]`, file.data, file.filename);
47
+ });
48
+ }
49
+ const request = {
50
+ method: pieces_common_1.HttpMethod.POST,
51
+ url: `https://discord.com/api/v10/channels/${channelId}/messages`,
52
+ headers: {
53
+ authorization: `Bot ${configValue.auth.secret_text}`,
54
+ 'Content-Type': 'multipart/form-data',
55
+ },
56
+ body: formData,
57
+ };
58
+ const res = yield pieces_common_1.httpClient.sendRequest(request);
59
+ return res.body;
60
+ });
61
+ }
62
+ });
63
+ //# sourceMappingURL=send-message-with-bot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-message-with-bot.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/send-message-with-bot.ts"],"names":[],"mappings":";;;;AAAA,oEAA+E;AAC/E,8DAIoC;AACpC,uCAA0C;AAC1C,sCAA0C;AAC1C,kEAAiC;AAMpB,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAC,mBAAW;IAChB,WAAW,EAAE,uBAAuB;IACpC,WAAW,EACT,4FAA4F;IAC9F,KAAK,EAAE;QACL,UAAU,EAAE,sBAAa,CAAC,OAAO;QACjC,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,E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pD,cAAc,EAAE,qBAAqB;iBACtC;gBACD,IAAI,EAAE,QAAQ;aACf,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;YAEzD,OAAO,GAAG,CAAC,IAAI,CAAC;QAClB,CAAC;KAAA;CAEF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface Member {
2
+ user: {
3
+ id: string;
4
+ username: string;
5
+ };
6
+ }
7
+ export declare const discordCommon: {
8
+ channel: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
9
+ roles: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
10
+ guilds: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
11
+ };
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.discordCommon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@scopieflows/pieces-common");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const __1 = require("../..");
8
+ exports.discordCommon = {
9
+ channel: pieces_framework_1.Property.Dropdown({
10
+ auth: __1.discordAuth,
11
+ displayName: 'Channel',
12
+ description: 'List of channels',
13
+ required: true,
14
+ refreshers: [],
15
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
16
+ if (!auth) {
17
+ return {
18
+ disabled: true,
19
+ options: [],
20
+ placeholder: 'Please connect your bot first',
21
+ };
22
+ }
23
+ const request = {
24
+ method: pieces_common_1.HttpMethod.GET,
25
+ url: 'https://discord.com/api/v9/users/@me/guilds',
26
+ headers: {
27
+ Authorization: 'Bot ' + auth.secret_text,
28
+ },
29
+ };
30
+ const res = yield pieces_common_1.httpClient.sendRequest(request);
31
+ const options = {
32
+ options: [],
33
+ };
34
+ if (res.body.length === 0)
35
+ return {
36
+ disabled: true,
37
+ options: [],
38
+ placeholder: 'No guilds found, please add the bot to a guild first',
39
+ };
40
+ yield Promise.all(res.body.map((guild) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
41
+ const requestChannels = {
42
+ method: pieces_common_1.HttpMethod.GET,
43
+ url: 'https://discord.com/api/v9/guilds/' + guild.id + '/channels',
44
+ headers: {
45
+ Authorization: 'Bot ' + auth.secret_text,
46
+ },
47
+ };
48
+ const resChannels = yield pieces_common_1.httpClient.sendRequest(requestChannels);
49
+ resChannels.body.forEach((channel) => {
50
+ options.options.push({
51
+ value: channel.id,
52
+ label: channel.name,
53
+ });
54
+ });
55
+ })));
56
+ return options;
57
+ }),
58
+ }),
59
+ roles: pieces_framework_1.Property.Dropdown({
60
+ auth: __1.discordAuth,
61
+ displayName: 'Roles',
62
+ description: 'List of roles',
63
+ required: true,
64
+ refreshers: ['guild_id'],
65
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, guild_id }) {
66
+ if (!auth) {
67
+ return {
68
+ disabled: true,
69
+ options: [],
70
+ placeholder: 'Please connect your bot first',
71
+ };
72
+ }
73
+ if (!guild_id) {
74
+ return {
75
+ disabled: true,
76
+ options: [],
77
+ placeholder: 'Please select a guild first',
78
+ };
79
+ }
80
+ const request = {
81
+ method: pieces_common_1.HttpMethod.GET,
82
+ url: `https://discord.com/api/v9/guilds/${guild_id}/roles`,
83
+ headers: {
84
+ Authorization: 'Bot ' + auth.secret_text,
85
+ },
86
+ };
87
+ const res = yield pieces_common_1.httpClient.sendRequest(request);
88
+ const options = {
89
+ options: [],
90
+ };
91
+ if (res.body.length === 0)
92
+ return {
93
+ disabled: true,
94
+ options: [],
95
+ placeholder: 'No roles found, please add the bot to a guild first',
96
+ };
97
+ yield Promise.all(res.body.map((role) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
98
+ options.options.push({
99
+ value: role.id,
100
+ label: role.name,
101
+ });
102
+ })));
103
+ return options;
104
+ }),
105
+ }),
106
+ guilds: pieces_framework_1.Property.Dropdown({
107
+ auth: __1.discordAuth,
108
+ displayName: 'Guilds',
109
+ description: 'List of guilds',
110
+ required: true,
111
+ refreshers: [],
112
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
113
+ if (!auth) {
114
+ return {
115
+ disabled: true,
116
+ options: [],
117
+ placeholder: 'Please connect your bot first',
118
+ };
119
+ }
120
+ const request = {
121
+ method: pieces_common_1.HttpMethod.GET,
122
+ url: 'https://discord.com/api/v9/users/@me/guilds',
123
+ headers: {
124
+ Authorization: 'Bot ' + auth.secret_text,
125
+ },
126
+ };
127
+ const res = yield pieces_common_1.httpClient.sendRequest(request);
128
+ const options = {
129
+ options: [],
130
+ };
131
+ if (res.body.length === 0)
132
+ return {
133
+ disabled: true,
134
+ options: [],
135
+ placeholder: 'No guilds found, please add the bot to a guild first',
136
+ };
137
+ yield Promise.all(res.body.map((guild) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
138
+ options.options.push({
139
+ value: guild.id,
140
+ label: guild.name,
141
+ });
142
+ })));
143
+ return options;
144
+ }),
145
+ }),
146
+ };
147
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,8DAAoE;AAEpE,oEAAyD;AACzD,6BAAoC;AASvB,QAAA,aAAa,GAAG;IAC3B,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;QACzB,IAAI,EAAE,eAAW;QACjB,WAAW,EAAE,SAAS;QACtB,WAAW,EAAE,kBAAkB;QAC/B,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;YACtB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO;oBACL,QAAQ,EAAE,I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C,CAAA,CAAC,CACH,CAAC;YAEF,OAAO,OAAO,CAAC;QACjB,CAAC,CAAA;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,39 @@
1
+ export interface Guild {
2
+ id: string;
3
+ name: string;
4
+ icon: string | null;
5
+ owner: boolean;
6
+ permissions: string;
7
+ features: string[];
8
+ }
9
+ export interface Channel {
10
+ id: string;
11
+ name: string;
12
+ }
13
+ export interface Member {
14
+ user: {
15
+ id: string;
16
+ username: string;
17
+ };
18
+ }
19
+ export interface Message {
20
+ id: string;
21
+ type: number;
22
+ content: string;
23
+ channel_id: string;
24
+ author: {
25
+ id: string;
26
+ username: string;
27
+ };
28
+ attachments: any;
29
+ embeds: any;
30
+ mentions: any;
31
+ mention_roles: any;
32
+ pinned: boolean;
33
+ mention_everyone: boolean;
34
+ tts: boolean;
35
+ timestamp: string;
36
+ edited_timestamp: string | null;
37
+ flags: number;
38
+ components: any;
39
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/common/models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const newMember: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
3
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
4
+ guildId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
6
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
7
+ guildId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
8
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
9
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
10
+ guildId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
11
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
12
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
13
+ guildId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
14
+ }>;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newMember = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@scopieflows/pieces-common");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
8
+ const __1 = require("../..");
9
+ const polling = {
10
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
11
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue: { guildId, limit } }) {
12
+ if (!guildId)
13
+ return [];
14
+ const request = {
15
+ method: pieces_common_1.HttpMethod.GET,
16
+ url: `https://discord.com/api/v9/guilds/${guildId}/members?limit=${limit}`,
17
+ headers: {
18
+ Authorization: 'Bot ' + auth.secret_text,
19
+ },
20
+ };
21
+ const res = yield pieces_common_1.httpClient.sendRequest(request);
22
+ const items = res.body;
23
+ return items.map((item) => ({
24
+ epochMilliSeconds: (0, dayjs_1.default)(item.joined_at).valueOf(),
25
+ data: item,
26
+ }));
27
+ }),
28
+ };
29
+ exports.newMember = (0, pieces_framework_1.createTrigger)({
30
+ auth: __1.discordAuth,
31
+ name: 'new_member',
32
+ displayName: 'New Member',
33
+ description: 'Triggers when a new member joins a guild',
34
+ type: pieces_framework_1.TriggerStrategy.POLLING,
35
+ props: {
36
+ limit: pieces_framework_1.Property.Number({
37
+ displayName: 'Limit',
38
+ description: 'The number of members to fetch (max 1000)',
39
+ required: false,
40
+ defaultValue: 50,
41
+ }),
42
+ guildId: pieces_framework_1.Property.ShortText({
43
+ displayName: 'Guild ID',
44
+ description: 'The ID of the Discord guild (server)',
45
+ required: true,
46
+ }),
47
+ },
48
+ sampleData: {},
49
+ onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
50
+ var _a;
51
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
52
+ auth: context.auth,
53
+ store: context.store,
54
+ propsValue: {
55
+ guildId: context.propsValue.guildId,
56
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
57
+ },
58
+ });
59
+ }),
60
+ onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
61
+ var _a;
62
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
63
+ auth: context.auth,
64
+ store: context.store,
65
+ propsValue: {
66
+ guildId: context.propsValue.guildId,
67
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
68
+ },
69
+ });
70
+ }),
71
+ run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
72
+ var _a;
73
+ return yield pieces_common_1.pollingHelper.poll(polling, {
74
+ auth: context.auth,
75
+ store: context.store,
76
+ propsValue: {
77
+ guildId: context.propsValue.guildId,
78
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
79
+ },
80
+ files: context.files,
81
+ });
82
+ }),
83
+ test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
84
+ var _a;
85
+ return yield pieces_common_1.pollingHelper.test(polling, {
86
+ auth: context.auth,
87
+ store: context.store,
88
+ propsValue: {
89
+ guildId: context.propsValue.guildId,
90
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
91
+ },
92
+ files: context.files,
93
+ });
94
+ }),
95
+ });
96
+ //# sourceMappingURL=new-member.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-member.js","sourceRoot":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A;IACD,IAAI,EAAE,CAAO,OAAO,EAAE,EAAE;;QACtB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE;YACvC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE;gBACV,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;gBACnC,KAAK,EAAE,MAAA,OAAO,CAAC,UAAU,CAAC,KAAK,mCAAI,EAAE;aACtC;YACD,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;IACL,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const newMessage: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
3
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
4
+ channel: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
5
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
6
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
7
+ channel: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
8
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
9
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
10
+ channel: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
11
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
12
+ limit: import("@scopieflows/pieces-framework").NumberProperty<false>;
13
+ channel: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
14
+ }>;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newMessage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@scopieflows/pieces-common");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
8
+ const __1 = require("../..");
9
+ const common_1 = require("../common");
10
+ const polling = {
11
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
12
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue: { channel, limit } }) {
13
+ if (channel === undefined)
14
+ return [];
15
+ const request = {
16
+ method: pieces_common_1.HttpMethod.GET,
17
+ url: 'https://discord.com/api/v9/channels/' +
18
+ channel +
19
+ '/messages?limit=' +
20
+ limit,
21
+ headers: {
22
+ Authorization: 'Bot ' + auth.secret_text,
23
+ },
24
+ };
25
+ const res = yield pieces_common_1.httpClient.sendRequest(request);
26
+ const items = res.body;
27
+ return items.map((item) => ({
28
+ epochMilliSeconds: (0, dayjs_1.default)(item.timestamp).valueOf(),
29
+ data: item,
30
+ }));
31
+ }),
32
+ };
33
+ exports.newMessage = (0, pieces_framework_1.createTrigger)({
34
+ auth: __1.discordAuth,
35
+ name: 'new_message',
36
+ displayName: 'New message',
37
+ description: 'Triggers when a message is sent in a channel',
38
+ type: pieces_framework_1.TriggerStrategy.POLLING,
39
+ props: {
40
+ limit: pieces_framework_1.Property.Number({
41
+ displayName: 'Limit',
42
+ description: 'The number of messages to fetch',
43
+ required: false,
44
+ defaultValue: 50,
45
+ }),
46
+ channel: common_1.discordCommon.channel,
47
+ },
48
+ sampleData: {},
49
+ onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
50
+ var _a;
51
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
52
+ auth: context.auth,
53
+ store: context.store,
54
+ propsValue: {
55
+ channel: context.propsValue.channel,
56
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
57
+ },
58
+ });
59
+ }),
60
+ onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
61
+ var _a;
62
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
63
+ auth: context.auth,
64
+ store: context.store,
65
+ propsValue: {
66
+ channel: context.propsValue.channel,
67
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
68
+ },
69
+ });
70
+ }),
71
+ run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
72
+ var _a;
73
+ return yield pieces_common_1.pollingHelper.poll(polling, {
74
+ auth: context.auth,
75
+ store: context.store,
76
+ propsValue: {
77
+ channel: context.propsValue.channel,
78
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
79
+ },
80
+ files: context.files,
81
+ });
82
+ }),
83
+ test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
84
+ var _a;
85
+ return yield pieces_common_1.pollingHelper.test(polling, {
86
+ auth: context.auth,
87
+ store: context.store,
88
+ propsValue: {
89
+ channel: context.propsValue.channel,
90
+ limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 50,
91
+ },
92
+ files: context.files,
93
+ });
94
+ }),
95
+ });
96
+ //# sourceMappingURL=new-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/triggers/new-message.ts"],"names":[],"mappings":";;;;AAAA,8DAOoC;AACpC,oEAKuC;AACvC,0DAA0B;AAC1B,6BAAoC;AACpC,sCAA0C;AAI1C,MAAM,OAAO,GACX;IACE,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAAiD,EAAE,oDAA5C,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EA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