Files
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

104 lines
3.3 KiB
TypeScript

import type { DiscordSendMessageParams, DiscordSendMessageResponse } from '@/tools/discord/types'
import type { ToolConfig } from '@/tools/types'
export const discordSendMessageTool: ToolConfig<
DiscordSendMessageParams,
DiscordSendMessageResponse
> = {
id: 'discord_send_message',
name: 'Discord Send Message',
description: 'Send a message to a Discord channel',
version: '1.0.0',
params: {
botToken: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'The bot token for authentication',
},
channelId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The Discord channel ID to send the message to, e.g., 123456789012345678',
},
content: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'The text content of the message',
},
serverId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
},
files: {
type: 'file[]',
required: false,
visibility: 'user-only',
description: 'Files to attach to the message',
},
},
request: {
url: '/api/tools/discord/send-message',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params: DiscordSendMessageParams) => {
return {
botToken: params.botToken.trim(),
channelId: params.channelId.trim(),
content: params.content || 'Message sent from Sim',
files: params.files || null,
}
},
},
transformResponse: async (response) => {
const data = await response.json()
if (!data.success) {
throw new Error(data.error || 'Failed to send Discord message')
}
return {
success: true,
output: data.output,
}
},
outputs: {
message: { type: 'string', description: 'Success or error message' },
files: { type: 'file[]', description: 'Files attached to the message' },
data: {
type: 'object',
description: 'Discord message data',
properties: {
id: { type: 'string', description: 'Message ID' },
content: { type: 'string', description: 'Message content' },
channel_id: { type: 'string', description: 'Channel ID where message was sent' },
author: {
type: 'object',
description: 'Message author information',
properties: {
id: { type: 'string', description: 'Author user ID' },
username: { type: 'string', description: 'Author username' },
avatar: { type: 'string', description: 'Author avatar hash' },
bot: { type: 'boolean', description: 'Whether author is a bot' },
},
},
timestamp: { type: 'string', description: 'Message timestamp' },
edited_timestamp: { type: 'string', description: 'Message edited timestamp' },
embeds: { type: 'array', description: 'Message embeds' },
attachments: { type: 'array', description: 'Message attachments' },
mentions: { type: 'array', description: 'User mentions in message' },
mention_roles: { type: 'array', description: 'Role mentions in message' },
mention_everyone: { type: 'boolean', description: 'Whether message mentions everyone' },
},
},
},
}