Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(discord): ui improvement (#16453)

Talal Jaberbac8cfbdece6
diff --git a/bun.lock b/bun.lock
index e9da91e344b..7effab774d1 100644
--- a/bun.lock
+++ b/bun.lock
@@ -2683,7 +2683,7 @@
},
"packages/pieces/community/discord": {
"name": "@activepieces/piece-discord",
- "version": "0.7.2",
+ "version": "0.8.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/discord/package.json b/packages/pieces/community/discord/package.json
index e92474d6d58..1f3451396f2 100644
--- a/packages/pieces/community/discord/package.json
+++ b/packages/pieces/community/discord/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-discord",
- "version": "0.7.2",
+ "version": "0.8.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/discord/src/index.ts b/packages/pieces/community/discord/src/index.ts
index fb286d9e6eb..9157bccde55 100644
--- a/packages/pieces/community/discord/src/index.ts
+++ b/packages/pieces/community/discord/src/index.ts
@@ -19,6 +19,7 @@ import { discordBanGuildMember } from './lib/actions/ban-a-guild-member';
import { newMember } from './lib/triggers/new-member';
import { sendMessageWithBot } from './lib/actions/send-message-with-bot'
import { discordAuth } from './lib/auth';
+import { discordCommon } from './lib/common';
// audience:'ai' agent atomics
import { discordSendMessage } from './lib/actions/ai-send-message';
import { discordCreateChannelAi } from './lib/actions/ai-create-channel';
@@ -138,13 +139,19 @@ export const discord = createPiece({
createCustomApiCallAction({
auth:discordAuth,
baseUrl: () => {
- return 'https://discord.com/api/v9';
+ return discordCommon.baseUrl;
},
authMapping: async (auth) => {
return {
Authorization: `Bot ${auth.secret_text}`,
};
},
+ props: {
+ url: {
+ description: `Full URL, or a path relative to ${discordCommon.baseUrl}`,
+ placeholder: '/users/@me/guilds',
+ },
+ },
}),
],
authors: [
diff --git a/packages/pieces/community/discord/src/lib/actions/add-role-to-member.ts b/packages/pieces/community/discord/src/lib/actions/add-role-to-member.ts
index 286403ab5a7..940efad0ccc 100644
--- a/packages/pieces/community/discord/src/lib/actions/add-role-to-member.ts
+++ b/packages/pieces/community/discord/src/lib/actions/add-role-to-member.ts
@@ -17,6 +17,29 @@ export const discordAddRoleToMember = createAction({
aiMetadata: { description: 'Assigns a role to a guild member, identified by guild ID, user ID, and role ID. Use to grant permissions or tag a user. Requires the bot to have Manage Roles and a higher role than the target; idempotent, since re-adding an already-assigned role leaves the member unchanged.', idempotent: true },
displayName: 'Add Role to Member',
outputSchema: discordSuccessActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'user',
+ display: 'section',
+ label: 'User',
+ icon: 'user',
+ props: ['user_id'],
+ },
+ {
+ key: 'role',
+ display: 'section',
+ label: 'Role',
+ icon: 'tag',
+ props: ['role_id'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
user_id: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/ban-a-guild-member.ts b/packages/pieces/community/discord/src/lib/actions/ban-a-guild-member.ts
index 5f08ddc23bf..376d2accb94 100644
--- a/packages/pieces/community/discord/src/lib/actions/ban-a-guild-member.ts
+++ b/packages/pieces/community/discord/src/lib/actions/ban-a-guild-member.ts
@@ -17,6 +17,22 @@ export const discordBanGuildMember = createAction({
aiMetadata: { description: 'Bans a user from a guild, identified by guild ID and user ID, with an optional audit-log reason; this removes them and blocks rejoining until unbanned. Use to permanently remove a disruptive user. Requires the bot to have Ban Members permission; idempotent, since re-banning an already-banned user yields the same end state.', idempotent: true },
outputSchema: discordSuccessActionOutputSchema,
displayName: 'Ban Member',
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'user',
+ display: 'section',
+ label: 'User',
+ icon: 'user',
+ props: ['user_id'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
user_id: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/create-channel.ts b/packages/pieces/community/discord/src/lib/actions/create-channel.ts
index b796457618a..da8a7904ddb 100644
--- a/packages/pieces/community/discord/src/lib/actions/create-channel.ts
+++ b/packages/pieces/community/discord/src/lib/actions/create-channel.ts
@@ -17,6 +17,22 @@ export const discordCreateChannel = createAction({
aiMetadata: { description: 'Creates a new channel in a guild with the given name and optional topic, identified by guild ID. Use to provision a channel before posting to it. Requires the bot to have Manage Channels permission; not idempotent, since each call creates a separate channel even with the same name.', idempotent: false },
displayName: 'Create Channel',
outputSchema: discordCreateChannelActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'channel',
+ display: 'section',
+ label: 'Channel',
+ icon: 'markdown',
+ props: ['name'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
name: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/create-guild-role.ts b/packages/pieces/community/discord/src/lib/actions/create-guild-role.ts
index 910a5e1d150..a52766a78b9 100644
--- a/packages/pieces/community/discord/src/lib/actions/create-guild-role.ts
+++ b/packages/pieces/community/discord/src/lib/actions/create-guild-role.ts
@@ -17,6 +17,22 @@ export const discordCreateGuildRole = createAction({
audience: 'human',
aiMetadata: { description: 'Creates a new role in a guild with the given name and optional color, hoist, and mentionable settings, identified by guild ID. Use to provision a role before assigning it to members. Requires the bot to have Manage Roles permission; not idempotent, since each call creates a separate role even with the same name.', idempotent: false },
outputSchema: discordRoleActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'role',
+ display: 'section',
+ label: 'Role',
+ icon: 'tag',
+ props: ['role_name'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
role_name: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/delete-guild-role.ts b/packages/pieces/community/discord/src/lib/actions/delete-guild-role.ts
index 0a6c248f817..cd0f878862d 100644
--- a/packages/pieces/community/discord/src/lib/actions/delete-guild-role.ts
+++ b/packages/pieces/community/discord/src/lib/actions/delete-guild-role.ts
@@ -17,6 +17,22 @@ export const discordDeleteGuildRole = createAction({
audience: 'human',
aiMetadata: { description: 'Permanently deletes a role from a guild, identified by guild ID and role ID, with an optional audit-log reason; the role is removed from all members. Use to remove an unwanted role. Requires the bot to have Manage Roles permission; idempotent in end state, since deleting an already-removed role leaves it gone.', idempotent: true },
outputSchema: discordSuccessWithAlreadyAbsentActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'role',
+ display: 'section',
+ label: 'Role',
+ icon: 'tag',
+ props: ['role_id'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
role_id: discordCommon.roles,
diff --git a/packages/pieces/community/discord/src/lib/actions/find-channel.ts b/packages/pieces/community/discord/src/lib/actions/find-channel.ts
index f179b305b17..9ea52ae169b 100644
--- a/packages/pieces/community/discord/src/lib/actions/find-channel.ts
+++ b/packages/pieces/community/discord/src/lib/actions/find-channel.ts
@@ -18,6 +18,22 @@ export const discordFindChannel = createAction({
aiMetadata: { description: 'Looks up a channel in a guild by its exact name and returns its channel ID, given the guild ID. Use to resolve a channel name into the ID required by message, rename, or delete actions. Read-only and idempotent; matching is exact and returns the first match.', idempotent: true },
displayName: 'Find Channel',
outputSchema: discordSuccessWithChannelIdActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'channel',
+ display: 'section',
+ label: 'Channel',
+ icon: 'markdown',
+ props: ['name'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
name: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/find-guild-member.ts b/packages/pieces/community/discord/src/lib/actions/find-guild-member.ts
index 9753b18f309..dcae8e9ffcd 100644
--- a/packages/pieces/community/discord/src/lib/actions/find-guild-member.ts
+++ b/packages/pieces/community/discord/src/lib/actions/find-guild-member.ts
@@ -17,6 +17,22 @@ export const discordFindGuildMemberByUsername = createAction({
aiMetadata: { description: 'Lists members of a guild, returning their user IDs and usernames for the given guild ID. Use to look up a member ID before role, kick, or ban actions, or to enumerate who is in a server. Read-only and idempotent; requires the Server Members privileged intent to be enabled for the bot.', idempotent: true },
displayName: 'List Members',
outputSchema: discordListGuildMembersActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'filters',
+ display: 'section',
+ label: 'Filters',
+ icon: 'filter',
+ props: ['shortText'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
shortText: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/remove-ban-from-user.ts b/packages/pieces/community/discord/src/lib/actions/remove-ban-from-user.ts
index fcd2c8ae6e6..16d2049aa85 100644
--- a/packages/pieces/community/discord/src/lib/actions/remove-ban-from-user.ts
+++ b/packages/pieces/community/discord/src/lib/actions/remove-ban-from-user.ts
@@ -17,6 +17,22 @@ export const discordRemoveBanFromUser = createAction({
audience: 'both',
aiMetadata: { description: 'Lifts a guild ban for a user, identified by guild ID and user ID, with an optional audit-log reason; the user may rejoin afterward. Use to reverse a previous ban. Requires the bot to have Ban Members permission; idempotent, since unbanning a user who is not banned yields the same end state.', idempotent: true },
outputSchema: discordSuccessActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'user',
+ display: 'section',
+ label: 'User',
+ icon: 'user',
+ props: ['user_id'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
user_id: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/remove-member-from-guild.ts b/packages/pieces/community/discord/src/lib/actions/remove-member-from-guild.ts
index 585619ec607..4cf4920153f 100644
--- a/packages/pieces/community/discord/src/lib/actions/remove-member-from-guild.ts
+++ b/packages/pieces/community/discord/src/lib/actions/remove-member-from-guild.ts
@@ -17,6 +17,22 @@ export const discordRemoveMemberFromGuild = createAction({
aiMetadata: { description: 'Kicks a member from a guild, identified by guild ID and user ID; the user may rejoin later via an invite. Use to remove someone without a permanent ban. Requires the bot to have Kick Members permission; idempotent, since removing an absent member yields the same end state.', idempotent: true },
outputSchema: discordSuccessActionOutputSchema,
displayName: 'Remove Member from Server',
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'user',
+ display: 'section',
+ label: 'User',
+ icon: 'user',
+ props: ['user_id'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
user_id: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/remove-role-from-member.ts b/packages/pieces/community/discord/src/lib/actions/remove-role-from-member.ts
index b339f9f6945..2e41f208a11 100644
--- a/packages/pieces/community/discord/src/lib/actions/remove-role-from-member.ts
+++ b/packages/pieces/community/discord/src/lib/actions/remove-role-from-member.ts
@@ -17,6 +17,29 @@ export const discordRemoveRoleFromMember = createAction({
aiMetadata: { description: 'Removes a role from a guild member, identified by guild ID, user ID, and role ID. Use to revoke permissions or untag a user. Requires the bot to have Manage Roles and a higher role than the target; idempotent, since removing a role the member does not have leaves them unchanged.', idempotent: true },
displayName: 'Remove Role from Member',
outputSchema: discordSuccessActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'server',
+ display: 'section',
+ label: 'Server',
+ icon: 'users',
+ props: ['guild_id'],
+ },
+ {
+ key: 'user',
+ display: 'section',
+ label: 'User',
+ icon: 'user',
+ props: ['user_id'],
+ },
+ {
+ key: 'role',
+ display: 'section',
+ label: 'Role',
+ icon: 'tag',
+ props: ['role_id'],
+ },
+ ],
props: {
guild_id: discordCommon.guilds,
user_id: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/rename-channel.ts b/packages/pieces/community/discord/src/lib/actions/rename-channel.ts
index 6f9da63536d..b085c5fbf0d 100644
--- a/packages/pieces/community/discord/src/lib/actions/rename-channel.ts
+++ b/packages/pieces/community/discord/src/lib/actions/rename-channel.ts
@@ -17,6 +17,22 @@ export const discordRenameChannel = createAction({
aiMetadata: { description: 'Renames an existing channel, identified by channel ID, to a new name. Use to update a channel title. Requires the bot to have Manage Channels permission; idempotent, since setting the same name repeatedly yields the same result.', idempotent: true },
displayName: 'Rename Channel',
outputSchema: discordSuccessActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'channel',
+ display: 'section',
+ label: 'Channel',
+ icon: 'markdown',
+ props: ['channel_id'],
+ },
+ {
+ key: 'newName',
+ display: 'section',
+ label: 'New Name',
+ icon: 'type',
+ props: ['name'],
+ },
+ ],
props: {
channel_id: discordCommon.channel,
name: Property.ShortText({
diff --git a/packages/pieces/community/discord/src/lib/actions/send-approval-message.ts b/packages/pieces/community/discord/src/lib/actions/send-approval-message.ts
index 780bf949b55..67b97b8f3e9 100644
--- a/packages/pieces/community/discord/src/lib/actions/send-approval-message.ts
+++ b/packages/pieces/community/discord/src/lib/actions/send-approval-message.ts
@@ -19,6 +19,22 @@ export const discordSendApprovalMessage = createAction({
aiMetadata: { description: 'Posts a message with a single button linking to a confirmation page where a human chooses Approve or Disapprove to a Discord channel, then pauses the flow until they respond and resumes with the decision. Use as a human-in-the-loop approval gate before an agent proceeds with a consequential step. Blocks until a response arrives; each call posts a new approval message, so it is not idempotent.', idempotent: false },
displayName: 'Request Approval in a Channel',
outputSchema: discordSendApprovalMessageActionOutputSchema,
+ propertyGroups: [
+ {
+ key: 'destination',
+ display: 'section',
+ label: 'Send to',
+ icon: 'send',
+ props: ['channel'],
+ },
+ {
+ key: 'message',
+ display: 'section',
+ label: 'Message',
+ icon: 'text',
+ props: ['content'],
+ },
+ ],
props: {
channel: discordCommon.channel,
content: Property.LongText({
diff --git a/packages/pieces/community/discord/src/lib/actions/send-message-webhook.ts b/packages/pieces/community/discord/src/lib/actions/send-message-webhook.ts
index 029e2cac7a9..0933eb010b8 100644
--- a/packages/pieces/community/discord/src/lib/actions/send-message-webhook.ts
+++ b/packages/pieces/community/discord/src/lib/actions/send-message-webhook.ts
@@ -13,6 +13,22 @@ export const discordSendMessageWebhook = createAction({
aiMetadata: { description: 'Posts a message to a Discord channel through an incoming webhook URL, with optional custom username, avatar, and rich embeds. Use when you have a webhook URL rather than a bot connection; no Discord auth is needed. Each call posts a new message, so it is not idempotent.', idempotent: false },
displayName: 'Send Message via Webhook',
requireAuth: false,
+ propertyGroups: [
+ {
+ key: 'destination',
+ display: 'section',
+ label: 'Send to',
+ icon: 'send',
+ props: ['webhook_url'],
+ },
+ {
+ key: 'message',
+ display: 'section',
+ label: 'Message',
+ icon: 'text',
+ props: ['content'],
+ },
+ ],
props: {
webhook_url: Property.ShortText({
displayName: 'Webhook URL',
diff --git a/packages/pieces/community/discord/src/lib/actions/send-message-with-bot.ts b/packages/pieces/community/discord/src/lib/actions/send-message-with-bot.ts
index 768718527cf..94a5e3a9348 100644
--- a/packages/pieces/community/discord/src/lib/actions/send-message-with-bot.ts
+++ b/packages/pieces/community/discord/src/lib/actions/send-message-with-bot.ts
@@ -23,6 +23,22 @@ export const sendMessageWithBot = createAction({
audience: 'human',
aiMetadata: { description: 'Posts a new message (optionally with file attachments) to a Discord channel or thread using a bot token. Use when an agent needs to send bot-authored content to a known channel ID. Requires the bot to have access to that channel; each call posts a separate message, so it is not idempotent.', idempotent: false },
outputSchema: discordMessageOutputSchema,
+ propertyGroups: [
+ {
+ key: 'destination',
+ display: 'section',
+ label: 'Send to',
+ icon: 'send',
+ props: ['channel_id'],
+ },
+ {
+ key: 'message',
+ display: 'section',
+ label: 'Message',
+ icon: 'text',
+ props: ['message', 'files'],
+ },
+ ],
props: {
channel_id: discordCommon.channel,
message: Property.LongText({
diff --git a/packages/pieces/community/discord/src/lib/common/index.ts b/packages/pieces/community/discord/src/lib/common/index.ts
index 3375116c2c3..80c5adbcaae 100644
--- a/packages/pieces/community/discord/src/lib/common/index.ts
+++ b/packages/pieces/community/discord/src/lib/common/index.ts
@@ -4,6 +4,7 @@ import { Property } from '@activepieces/pieces-framework';
import { discordAuth } from '../auth';
export const discordCommon = {
+ baseUrl: 'https://discord.com/api/v9',
channel: Property.Dropdown({
auth: discordAuth,
displayName: 'Channel',