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
96 lines
2.8 KiB
TypeScript
96 lines
2.8 KiB
TypeScript
import type { DiscordCreateInviteParams, DiscordCreateInviteResponse } from '@/tools/discord/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const discordCreateInviteTool: ToolConfig<
|
|
DiscordCreateInviteParams,
|
|
DiscordCreateInviteResponse
|
|
> = {
|
|
id: 'discord_create_invite',
|
|
name: 'Discord Create Invite',
|
|
description: 'Create an invite link for 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 create an invite for, e.g., 123456789012345678',
|
|
},
|
|
maxAge: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Duration of invite in seconds (0 = never expires, default 86400)',
|
|
},
|
|
maxUses: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Max number of uses (0 = unlimited, default 0)',
|
|
},
|
|
temporary: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Whether invite grants temporary membership',
|
|
},
|
|
serverId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params: DiscordCreateInviteParams) => {
|
|
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/invites`
|
|
},
|
|
method: 'POST',
|
|
headers: (params) => ({
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Bot ${params.botToken.trim()}`,
|
|
}),
|
|
body: (params: DiscordCreateInviteParams) => {
|
|
const body: any = {}
|
|
if (params.maxAge !== undefined) body.max_age = Number(params.maxAge)
|
|
if (params.maxUses !== undefined) body.max_uses = Number(params.maxUses)
|
|
if (params.temporary !== undefined) body.temporary = params.temporary
|
|
return body
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response) => {
|
|
const data = await response.json()
|
|
return {
|
|
success: true,
|
|
output: {
|
|
message: 'Invite created successfully',
|
|
data,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
message: { type: 'string', description: 'Success or error message' },
|
|
data: {
|
|
type: 'object',
|
|
description: 'Created invite data',
|
|
properties: {
|
|
code: { type: 'string', description: 'Invite code' },
|
|
url: { type: 'string', description: 'Full invite URL' },
|
|
max_age: { type: 'number', description: 'Max age in seconds' },
|
|
max_uses: { type: 'number', description: 'Max uses' },
|
|
temporary: { type: 'boolean', description: 'Whether temporary' },
|
|
},
|
|
},
|
|
},
|
|
}
|