@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.
- package/README.md +7 -0
- package/package.json +29 -0
- package/src/i18n/ca.json +101 -0
- package/src/i18n/de.json +108 -0
- package/src/i18n/es.json +108 -0
- package/src/i18n/fr.json +108 -0
- package/src/i18n/hi.json +101 -0
- package/src/i18n/id.json +101 -0
- package/src/i18n/ja.json +108 -0
- package/src/i18n/nl.json +108 -0
- package/src/i18n/pt.json +108 -0
- package/src/i18n/ru.json +101 -0
- package/src/i18n/translation.json +108 -0
- package/src/i18n/vi.json +101 -0
- package/src/i18n/zh.json +108 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +87 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-role-to-member.d.ts +5 -0
- package/src/lib/actions/add-role-to-member.js +40 -0
- package/src/lib/actions/add-role-to-member.js.map +1 -0
- package/src/lib/actions/ban-a-guild-member.d.ts +5 -0
- package/src/lib/actions/ban-a-guild-member.js +48 -0
- package/src/lib/actions/ban-a-guild-member.js.map +1 -0
- package/src/lib/actions/create-channel.d.ts +4 -0
- package/src/lib/actions/create-channel.js +46 -0
- package/src/lib/actions/create-channel.js.map +1 -0
- package/src/lib/actions/create-guild-role.d.ts +8 -0
- package/src/lib/actions/create-guild-role.js +70 -0
- package/src/lib/actions/create-guild-role.js.map +1 -0
- package/src/lib/actions/delete-channel.d.ts +3 -0
- package/src/lib/actions/delete-channel.js +32 -0
- package/src/lib/actions/delete-channel.js.map +1 -0
- package/src/lib/actions/delete-guild-role.d.ts +5 -0
- package/src/lib/actions/delete-guild-role.js +41 -0
- package/src/lib/actions/delete-guild-role.js.map +1 -0
- package/src/lib/actions/find-channel.d.ts +4 -0
- package/src/lib/actions/find-channel.js +41 -0
- package/src/lib/actions/find-channel.js.map +1 -0
- package/src/lib/actions/find-guild-member.d.ts +4 -0
- package/src/lib/actions/find-guild-member.js +52 -0
- package/src/lib/actions/find-guild-member.js.map +1 -0
- package/src/lib/actions/remove-ban-from-user.d.ts +5 -0
- package/src/lib/actions/remove-ban-from-user.js +48 -0
- package/src/lib/actions/remove-ban-from-user.js.map +1 -0
- package/src/lib/actions/remove-member-from-guild.d.ts +4 -0
- package/src/lib/actions/remove-member-from-guild.js +39 -0
- package/src/lib/actions/remove-member-from-guild.js.map +1 -0
- package/src/lib/actions/remove-role-from-member.d.ts +5 -0
- package/src/lib/actions/remove-role-from-member.js +40 -0
- package/src/lib/actions/remove-role-from-member.js.map +1 -0
- package/src/lib/actions/rename-channel.d.ts +4 -0
- package/src/lib/actions/rename-channel.js +42 -0
- package/src/lib/actions/rename-channel.js.map +1 -0
- package/src/lib/actions/send-approval-message.d.ts +4 -0
- package/src/lib/actions/send-approval-message.js +79 -0
- package/src/lib/actions/send-approval-message.js.map +1 -0
- package/src/lib/actions/send-message-webhook.d.ts +8 -0
- package/src/lib/actions/send-message-webhook.js +59 -0
- package/src/lib/actions/send-message-webhook.js.map +1 -0
- package/src/lib/actions/send-message-with-bot.d.ts +5 -0
- package/src/lib/actions/send-message-with-bot.js +63 -0
- package/src/lib/actions/send-message-with-bot.js.map +1 -0
- package/src/lib/common/index.d.ts +11 -0
- package/src/lib/common/index.js +147 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/common/models.d.ts +39 -0
- package/src/lib/common/models.js +3 -0
- package/src/lib/common/models.js.map +1 -0
- package/src/lib/triggers/new-member.d.ts +14 -0
- package/src/lib/triggers/new-member.js +96 -0
- package/src/lib/triggers/new-member.js.map +1 -0
- package/src/lib/triggers/new-message.d.ts +14 -0
- package/src/lib/triggers/new-message.js +96 -0
- package/src/lib/triggers/new-message.js.map +1 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordCreateGuildRole = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
6
|
+
const index_1 = require("../../index");
|
|
7
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.discordCreateGuildRole = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'createGuildRole',
|
|
12
|
+
displayName: 'Create guild role',
|
|
13
|
+
description: 'Creates a new role on the specified guild',
|
|
14
|
+
props: {
|
|
15
|
+
guild_id: common_1.discordCommon.guilds,
|
|
16
|
+
role_name: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Role Name',
|
|
18
|
+
description: 'The name of the role',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
role_color: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Role Color',
|
|
23
|
+
description: `The RGB color of the role (may be better to set manually on the server)`,
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
display_separated: pieces_framework_1.Property.Checkbox({
|
|
27
|
+
displayName: 'Display Separated',
|
|
28
|
+
description: 'Whether the role should be displayed separately in the sidebar',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
role_mentionable: pieces_framework_1.Property.Checkbox({
|
|
32
|
+
displayName: 'Mentionable',
|
|
33
|
+
description: 'Whether the role can be mentioned by other users',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
creation_reason: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Creation Reason',
|
|
38
|
+
description: 'The reason for creating the role',
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
run(configValue) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const request = {
|
|
45
|
+
url: `https://discord.com/api/v9/guilds/${configValue.propsValue.guild_id}/roles`,
|
|
46
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
47
|
+
headers: {
|
|
48
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
'X-Audit-Log-Reason': `${configValue.propsValue.creation_reason}`,
|
|
51
|
+
},
|
|
52
|
+
body: {
|
|
53
|
+
name: configValue.propsValue.role_name,
|
|
54
|
+
color: configValue.propsValue.role_color,
|
|
55
|
+
hoist: configValue.propsValue.display_separated,
|
|
56
|
+
mentionable: configValue.propsValue.role_mentionable,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
60
|
+
return {
|
|
61
|
+
success: res.status === 201,
|
|
62
|
+
role: {
|
|
63
|
+
id: res.body.id,
|
|
64
|
+
name: res.body.name,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=create-guild-role.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-guild-role.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/create-guild-role.ts"],"names":[],"mappings":";;;;AAAA,8DAIoC;AACpC,uCAA0C;AAC1C,oEAAuE;AACvE,sCAA0C;AAE7B,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAa,CAAC,MAAM;QAC9B,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,yEAAyE;YACtF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,iBAAiB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACnC,WAAW,EAAE,mBAAmB;YAChC,WAAW,EACT,gEAAgE;YAClE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,gBAAgB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAClC,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAClC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAgB;gBAC3B,GAAG,EAAE,qCAAqC,WAAW,CAAC,UAAU,CAAC,QAAQ,QAAQ;gBACjF,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;oBAClC,oBAAoB,EAAE,GAAG,WAAW,CAAC,UAAU,CAAC,eAAe,EAAE;iBAClE;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,SAAS;oBACtC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,UAAU;oBACxC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,iBAAiB;oBAC/C,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,gBAAgB;iBACrD;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAElD,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG;gBAC3B,IAAI,EAAE;oBACJ,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;oBACf,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;iBACpB;aACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const discordDeleteChannel: 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
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordDeleteChannel = 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 index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.discordDeleteChannel = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'delete_channel',
|
|
12
|
+
description: 'delete a channel',
|
|
13
|
+
displayName: 'Delete channel',
|
|
14
|
+
props: {
|
|
15
|
+
channel_id: common_1.discordCommon.channel,
|
|
16
|
+
},
|
|
17
|
+
run(configValue) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const request = {
|
|
20
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
21
|
+
url: `https://discord.com/api/v9/channels/${configValue.propsValue.channel_id}`,
|
|
22
|
+
headers: {
|
|
23
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
28
|
+
return res.body;
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=delete-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-channel.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/delete-channel.ts"],"names":[],"mappings":";;;;AAAA,8DAIoC;AACpC,oEAA6D;AAC7D,uCAA0C;AAC1C,sCAA0C;AAE7B,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE;QACL,UAAU,EAAE,sBAAa,CAAC,OAAO;KAClC;IAEK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,GAAG,EAAE,uCAAuC,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE;gBAC/E,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;YAEzD,OAAO,GAAG,CAAC,IAAI,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const discordDeleteGuildRole: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
guild_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
role_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
deletion_reason: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordDeleteGuildRole = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
9
|
+
exports.discordDeleteGuildRole = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'deleteGuildRole',
|
|
12
|
+
displayName: 'Delete guild role',
|
|
13
|
+
description: 'Deletes the specified role from the specified guild',
|
|
14
|
+
props: {
|
|
15
|
+
guild_id: common_1.discordCommon.guilds,
|
|
16
|
+
role_id: common_1.discordCommon.roles,
|
|
17
|
+
deletion_reason: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Deletion reason',
|
|
19
|
+
description: 'The reason for deleting the role',
|
|
20
|
+
required: false,
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
run(configValue) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const request = {
|
|
26
|
+
url: `https://discord.com/api/v9/guilds/${configValue.propsValue.guild_id}/roles/${configValue.propsValue.role_id}`,
|
|
27
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bot ${configValue.auth.secret_text}`,
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
'X-Audit-Log-Reason': `${configValue.propsValue.deletion_reason}`,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
35
|
+
return {
|
|
36
|
+
success: res.status === 204,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=delete-guild-role.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-guild-role.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/delete-guild-role.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,sCAA0C;AAC1C,uCAA0C;AAC1C,8DAIoC;AAEvB,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,qDAAqD;IAClE,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAa,CAAC,MAAM;QAC9B,OAAO,EAAE,sBAAa,CAAC,KAAK;QAC5B,eAAe,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAClC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAgB;gBAC3B,GAAG,EAAE,qCAAqC,WAAW,CAAC,UAAU,CAAC,QAAQ,UAAU,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE;gBACnH,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;oBAClC,oBAAoB,EAAE,GAAG,WAAW,CAAC,UAAU,CAAC,eAAe,EAAE;iBAClE;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAElD,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const discordFindChannel: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
guild_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
name: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordFindChannel = 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
|
+
exports.discordFindChannel = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'find_channel',
|
|
12
|
+
description: 'find a channel by name',
|
|
13
|
+
displayName: 'Find channel',
|
|
14
|
+
props: {
|
|
15
|
+
guild_id: common_1.discordCommon.guilds,
|
|
16
|
+
name: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Name',
|
|
18
|
+
description: 'The name of the channel',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
run(configValue) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const request = {
|
|
25
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
26
|
+
url: `https://discord.com/api/v9/guilds/${configValue.propsValue.guild_id}/channels`,
|
|
27
|
+
headers: {
|
|
28
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
33
|
+
const channel = res.body.find((channel) => channel.name === configValue.propsValue.name);
|
|
34
|
+
return {
|
|
35
|
+
success: res.status === 200 && !!channel,
|
|
36
|
+
channel_id: channel === null || channel === void 0 ? void 0 : channel.id,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=find-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-channel.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/find-channel.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAIoC;AACpC,uCAA0C;AAC1C,sCAA0C;AAG7B,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,cAAc;IAC3B,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAa,CAAC,MAAM;QAC9B,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAqB;gBAChC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,qCAAqC,WAAW,CAAC,UAAU,CAAC,QAAQ,WAAW;gBACpF,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAY,OAAO,CAAC,CAAC;YAE7D,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAC3B,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,UAAU,CAAC,IAAI,CAC1D,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO;gBACxC,UAAU,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,EAAE;aACxB,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const discordFindGuildMemberByUsername: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
guild_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
shortText: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordFindGuildMemberByUsername = 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
|
+
exports.discordFindGuildMemberByUsername = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'list_guild_members',
|
|
12
|
+
description: 'List Guild Members',
|
|
13
|
+
displayName: 'List guild members',
|
|
14
|
+
props: {
|
|
15
|
+
guild_id: common_1.discordCommon.guilds,
|
|
16
|
+
shortText: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Search',
|
|
18
|
+
description: 'Search for a member',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
run(configValue) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const request = {
|
|
25
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
26
|
+
url: `https://discord.com/api/v9/guilds/${configValue.propsValue.guild_id}/members`,
|
|
27
|
+
headers: {
|
|
28
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
33
|
+
const options = {
|
|
34
|
+
options: [],
|
|
35
|
+
};
|
|
36
|
+
if (res.body.length === 0)
|
|
37
|
+
return {
|
|
38
|
+
disabled: true,
|
|
39
|
+
options: [],
|
|
40
|
+
placeholder: 'No members found, please add the bot to a guild first',
|
|
41
|
+
};
|
|
42
|
+
yield Promise.all(res.body.map((member) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
options.options.push({
|
|
44
|
+
value: member.user.id,
|
|
45
|
+
label: member.user.username,
|
|
46
|
+
});
|
|
47
|
+
})));
|
|
48
|
+
return options;
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=find-guild-member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-guild-member.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/find-guild-member.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAIoC;AACpC,uCAA0C;AAC1C,sCAA0C;AAG7B,QAAA,gCAAgC,GAAG,IAAA,+BAAY,EAAC;IAC3D,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAa,CAAC,MAAM;QAC9B,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAqB;gBAChC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,qCAAqC,WAAW,CAAC,UAAU,CAAC,QAAQ,UAAU;gBACnF,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAW,OAAO,CAAC,CAAC;YAE5D,MAAM,OAAO,GAAoD;gBAC/D,OAAO,EAAE,EAAE;aACZ,CAAC;YAEF,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;gBACvB,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,uDAAuD;iBACrE,CAAC;YAEJ,MAAM,OAAO,CAAC,GAAG,CACf,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAO,MAAM,EAAE,EAAE;gBAC5B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;oBACnB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;oBACrB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ;iBAC5B,CAAC,CAAC;YACL,CAAC,CAAA,CAAC,CACH,CAAC;YAEF,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const discordRemoveBanFromUser: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
guild_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
user_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
unban_reason: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordRemoveBanFromUser = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
9
|
+
exports.discordRemoveBanFromUser = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'remove_ban_from_user',
|
|
12
|
+
displayName: 'Remove ban from user',
|
|
13
|
+
description: 'Removes the guild ban from a user',
|
|
14
|
+
props: {
|
|
15
|
+
guild_id: common_1.discordCommon.guilds,
|
|
16
|
+
user_id: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'User ID',
|
|
18
|
+
description: 'The ID of the user',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
unban_reason: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Unban Reason',
|
|
23
|
+
description: 'The reason for unbanning the user',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
run(configValue) {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const request = {
|
|
30
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
31
|
+
url: `https://discord.com/api/v9/guilds/${configValue.propsValue.guild_id}/bans/${configValue.propsValue.user_id}`,
|
|
32
|
+
headers: {
|
|
33
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
'X-Audit-Log-Reason': `${configValue.propsValue.unban_reason}`,
|
|
36
|
+
},
|
|
37
|
+
body: {
|
|
38
|
+
reason: `${configValue.propsValue.unban_reason}`,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
42
|
+
return {
|
|
43
|
+
success: res.status === 204,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=remove-ban-from-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-ban-from-user.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/remove-ban-from-user.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,sCAA0C;AAC1C,uCAA0C;AAC1C,8DAIoC;AAEvB,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAa,CAAC,MAAM;QAC9B,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAqB;gBAChC,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,GAAG,EAAE,qCAAqC,WAAW,CAAC,UAAU,CAAC,QAAQ,SAAS,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE;gBAClH,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;oBAClC,oBAAoB,EAAE,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE;iBAC/D;gBACD,IAAI,EAAE;oBACJ,MAAM,EAAE,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE;iBACjD;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;YAEzD,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const discordRemoveMemberFromGuild: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
guild_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
user_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordRemoveMemberFromGuild = 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
|
+
exports.discordRemoveMemberFromGuild = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'remove_member_from_guild',
|
|
12
|
+
description: 'Remove Guild Member',
|
|
13
|
+
displayName: 'Remove member from guild',
|
|
14
|
+
props: {
|
|
15
|
+
guild_id: common_1.discordCommon.guilds,
|
|
16
|
+
user_id: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'User ID',
|
|
18
|
+
description: 'The user id of the member',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
run(configValue) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const request = {
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://discord.com/api/v9/guilds/${configValue.propsValue.guild_id}/members/${configValue.propsValue.user_id}`,
|
|
27
|
+
headers: {
|
|
28
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
33
|
+
return {
|
|
34
|
+
success: res.status === 204,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=remove-member-from-guild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-member-from-guild.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/remove-member-from-guild.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAIoC;AACpC,uCAA0C;AAC1C,sCAA0C;AAE7B,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,0BAA0B;IACvC,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAa,CAAC,MAAM;QAC9B,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAqB;gBAChC,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,GAAG,EAAE,qCAAqC,WAAW,CAAC,UAAU,CAAC,QAAQ,YAAY,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE;gBACrH,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;YAEzD,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const discordRemoveRoleFromMember: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
guild_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
user_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
role_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordRemoveRoleFromMember = 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
|
+
exports.discordRemoveRoleFromMember = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'remove_role_from_member',
|
|
12
|
+
description: 'Remove Guild Member Role',
|
|
13
|
+
displayName: 'Remove role from member',
|
|
14
|
+
props: {
|
|
15
|
+
guild_id: common_1.discordCommon.guilds,
|
|
16
|
+
user_id: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'User ID',
|
|
18
|
+
description: 'The user id of the member',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
role_id: common_1.discordCommon.roles,
|
|
22
|
+
},
|
|
23
|
+
run(configValue) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const request = {
|
|
26
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
27
|
+
url: `https://discord.com/api/v9/guilds/${configValue.propsValue.guild_id}/members/${configValue.propsValue.user_id}/roles/${configValue.propsValue.role_id}`,
|
|
28
|
+
headers: {
|
|
29
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
34
|
+
return {
|
|
35
|
+
success: res.status === 204,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=remove-role-from-member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-role-from-member.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/remove-role-from-member.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAIoC;AACpC,uCAA0C;AAC1C,sCAA0C;AAE7B,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,yBAAyB;IACtC,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAa,CAAC,MAAM;QAC9B,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,sBAAa,CAAC,KAAK;KAC7B;IAEK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAqB;gBAChC,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,GAAG,EAAE,qCAAqC,WAAW,CAAC,UAAU,CAAC,QAAQ,YAAY,WAAW,CAAC,UAAU,CAAC,OAAO,UAAU,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE;gBAC7J,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;YAEzD,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const discordRenameChannel: 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
|
+
name: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordRenameChannel = 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
|
+
exports.discordRenameChannel = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.discordAuth,
|
|
11
|
+
name: 'rename_channel',
|
|
12
|
+
description: 'rename a channel',
|
|
13
|
+
displayName: 'Rename channel',
|
|
14
|
+
props: {
|
|
15
|
+
channel_id: common_1.discordCommon.channel,
|
|
16
|
+
name: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Name',
|
|
18
|
+
description: 'The new name of the channel',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
run(configValue) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const request = {
|
|
25
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
26
|
+
url: `https://discord.com/api/v9/channels/${configValue.propsValue.channel_id}`,
|
|
27
|
+
body: {
|
|
28
|
+
name: configValue.propsValue.name,
|
|
29
|
+
},
|
|
30
|
+
headers: {
|
|
31
|
+
authorization: `Bot ${configValue.auth.secret_text}`,
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
36
|
+
return {
|
|
37
|
+
success: res.status === 204,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=rename-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename-channel.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/rename-channel.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAIoC;AACpC,uCAA0C;AAC1C,sCAA0C;AAE7B,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE;QACL,UAAU,EAAE,sBAAa,CAAC,OAAO;QACjC,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG,CAAC,WAAW;;YACnB,MAAM,OAAO,GAAqB;gBAChC,MAAM,EAAE,0BAAU,CAAC,KAAK;gBACxB,GAAG,EAAE,uCAAuC,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE;gBAC/E,IAAI,EAAE;oBACJ,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI;iBAClC;gBACD,OAAO,EAAE;oBACP,aAAa,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE;oBACpD,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;YAEzD,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const discordSendApprovalMessage: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
content: import("@scopieflows/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
channel: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discordSendApprovalMessage = 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 shared_1 = require("@scopieflows/shared");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
exports.discordSendApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: index_1.discordAuth,
|
|
12
|
+
name: 'request_approval_message',
|
|
13
|
+
description: 'send a message to a channel asking for approval and wait for a response',
|
|
14
|
+
displayName: 'Request Approval in a Channel',
|
|
15
|
+
props: {
|
|
16
|
+
content: pieces_framework_1.Property.LongText({
|
|
17
|
+
displayName: 'Message',
|
|
18
|
+
description: 'The message you want to send',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
channel: common_1.discordCommon.channel,
|
|
22
|
+
},
|
|
23
|
+
run(ctx) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (ctx.executionType === shared_1.ExecutionType.BEGIN) {
|
|
26
|
+
ctx.run.pause({
|
|
27
|
+
pauseMetadata: {
|
|
28
|
+
type: shared_1.PauseType.WEBHOOK,
|
|
29
|
+
response: {},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
const approvalLink = ctx.generateResumeUrl({
|
|
33
|
+
queryParams: { action: 'approve' },
|
|
34
|
+
});
|
|
35
|
+
const disapprovalLink = ctx.generateResumeUrl({
|
|
36
|
+
queryParams: { action: 'disapprove' },
|
|
37
|
+
});
|
|
38
|
+
const request = {
|
|
39
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
40
|
+
url: `https://discord.com/api/v9/channels/${ctx.propsValue.channel}/messages`,
|
|
41
|
+
body: {
|
|
42
|
+
content: ctx.propsValue.content,
|
|
43
|
+
components: [
|
|
44
|
+
{
|
|
45
|
+
type: 1,
|
|
46
|
+
components: [
|
|
47
|
+
{
|
|
48
|
+
type: 2,
|
|
49
|
+
label: 'Approve',
|
|
50
|
+
style: 5,
|
|
51
|
+
url: approvalLink,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 2,
|
|
55
|
+
label: 'Disapprove',
|
|
56
|
+
style: 5,
|
|
57
|
+
url: disapprovalLink,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
headers: {
|
|
64
|
+
authorization: `Bot ${ctx.auth.secret_text}`,
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
yield pieces_common_1.httpClient.sendRequest(request);
|
|
69
|
+
return {};
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return {
|
|
73
|
+
approved: ctx.resumePayload.queryParams['action'] === 'approve',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=send-approval-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-approval-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/discord/src/lib/actions/send-approval-message.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAIoC;AACpC,uCAA0C;AAC1C,gDAA+D;AAC/D,sCAA0C;AAE7B,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACrD,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EACT,yEAAyE;IAC3E,WAAW,EAAE,+BAA+B;IAC5C,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,sBAAa,CAAC,OAAO;KAC/B;IACK,GAAG,CAAC,GAAG;;YACX,IAAI,GAAG,CAAC,aAAa,KAAK,sBAAa,CAAC,KAAK,EAAE,CAAC;gBAC9C,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;oBACZ,aAAa,EAAE;wBACb,IAAI,EAAE,kBAAS,CAAC,OAAO;wBACvB,QAAQ,EAAE,EAAE;qBACb;iBACF,CAAC,CAAC;gBAEH,MAAM,YAAY,GAAG,GAAG,CAAC,iBAAiB,CAAC;oBACzC,WAAW,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;iBACnC,CAAC,CAAA;gBACF,MAAM,eAAe,GAAG,GAAG,CAAC,iBAAiB,CAAC;oBAC5C,WAAW,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;iBACtC,CAAC,CAAA;gBAGF,MAAM,OAAO,GAAqB;oBAChC,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,GAAG,EAAE,uCAAuC,GAAG,CAAC,UAAU,CAAC,OAAO,WAAW;oBAC7E,IAAI,EAAE;wBACJ,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;wBAC/B,UAAU,EAAE;4BACV;gCACE,IAAI,EAAE,CAAC;gCACP,UAAU,EAAE;oCACV;wCACE,IAAI,EAAE,CAAC;wCACP,KAAK,EAAE,SAAS;wCAChB,KAAK,EAAE,CAAC;wCACR,GAAG,EAAE,YAAY;qCAClB;oCACD;wCACE,IAAI,EAAE,CAAC;wCACP,KAAK,EAAE,YAAY;wCACnB,KAAK,EAAE,CAAC;wCACR,GAAG,EAAE,eAAe;qCACrB;iCACF;6BACF;yBACF;qBACF;oBACD,OAAO,EAAE;wBACP,aAAa,EAAE,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE;wBAC5C,cAAc,EAAE,kBAAkB;qBACnC;iBACF,CAAC;gBAEF,MAAM,0BAAU,CAAC,WAAW,CAAQ,OAAO,CAAC,CAAC;gBAC7C,OAAO,EAAE,CAAC;YACZ,CAAC;iBAAM,CAAC;gBAEN,OAAO;oBACL,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,SAAS;iBAChE,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const discordSendMessageWebhook: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
webhook_url: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
username: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
content: import("@scopieflows/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
avatar_url: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
embeds: import("@scopieflows/pieces-framework").JsonProperty<false>;
|
|
7
|
+
tts: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
|
|
8
|
+
}>;
|