Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

discord

БесплатноБез исполняемых скриптовНе проверен

Discord is a chat platform whose bot API lets programs read events, answer slash commands and post messages in servers. Use this skill to create a Discord…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Discord — bots, slash commands and webhooks with discord.js 14

Overview

A Discord bot is an application with a bot user. It connects to the Gateway (a WebSocket that streams events such as interactions) and calls the REST API (https://discord.com/api/v10) to act. Most bots today are driven by interactions: users run slash commands or press buttons, Discord sends the bot an event, and the bot must respond within 3 seconds.

This skill targets discord.js 14 (14.27 at the time of writing), the main Node.js library. Sources: the Discord developer docs (discord.com/developers/docs), the discord.js guide (discordjs.guide) and the library reference (discord.js.org). The code below type-checks under tsc --strict against discord.js 14.27.

Two lighter options need no gateway connection: a webhook (post-only, one URL per channel) and plain REST calls with the bot token.

Instructions

1. Create the application and bot (done by a human)

An agent cannot do this step; the owner must:

  1. Open the Developer Portal (discord.com/developers/applications), choose New Application.
  2. On the General Information page copy the Application ID into DISCORD_APP_ID.
  3. On the Bot page choose Reset Token and store it in DISCORD_TOKEN. The token is shown once; anyone holding it controls the bot.
  4. Under Installation / OAuth2 URL Generator select the scopes bot and applications.commands, pick the minimum bot permissions, open the generated URL and add the bot to a server you manage.
  5. For testing, enable Developer Mode (User Settings, Advanced), right-click the server and copy its ID into DISCORD_GUILD_ID.

2. Install

mkdir release-bot && cd release-bot
npm init -y
npm install discord.js
npm install -D typescript @types/node tsx

Never commit the token. Keep DISCORD_TOKEN, DISCORD_APP_ID and DISCORD_GUILD_ID in the environment or a gitignored .env (run with node --env-file=.env).

3. Gateway intents

Intents select which events the Gateway sends. Request only what you use.

Intent Privileged Needed for
Guilds no slash commands, guild and channel cache (enough for most bots)
GuildMembers yes member join/leave events, full member lists
GuildPresences yes online status, activities
MessageContent yes reading the text of messages that do not mention the bot
GuildMessages, GuildMessageReactions no message and reaction events (content is empty without MessageContent)

Privileged intents must be switched on in the Bot page of the Developer Portal. Once the people who can see your app across all its servers exceed 10,000, you must also apply for Discord's approval to use them (the older "100 servers" threshold no longer applies). A slash-command bot needs none of them; do not enable them "just in case".

4. Register slash commands

Registration is a separate step from running the bot. Run it when command definitions change, not on every start.

import { REST, Routes, SlashCommandBuilder, PermissionFlagsBits } from "discord.js";

const commands = [
  new SlashCommandBuilder()
    .setName("ping")
    .setDescription("Check that the bot is alive"),
  new SlashCommandBuilder()
    .setName("ticket")
    .setDescription("Open a support ticket")
    .addStringOption((o) =>
      o.setName("topic").setDescription("What do you need help with?").setRequired(true).setMaxLength(100),
    ),
  new SlashCommandBuilder()
    .setName("purge-notes")
    .setDescription("Delete the bot's saved notes")
    .setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
    .setContexts(0), // 0 = guild only
].map((c) => c.toJSON());

const rest = new REST({ version: "10" }).setToken(process.env.DISCORD_TOKEN!);
const appId = process.env.DISCORD_APP_ID!;
const guildId = process.env.DISCORD_GUILD_ID;

async function main() {
  // Guild commands appear instantly; global commands can take up to an hour to propagate.
  const route = guildId
    ? Routes.applicationGuildCommands(appId, guildId)
    : Routes.applicationCommands(appId);
  const registered = (await rest.put(route, { body: commands })) as unknown[];
  console.log(`Registered ${registered.length} commands`);
}
main();
  • PUT replaces the whole command set for that scope, so omitted commands are deleted.
  • Develop against guild commands (instant). Ship global commands once stable, by leaving DISCORD_GUILD_ID unset.
  • setDefaultMemberPermissions only sets the default; server admins can override it in Server Settings, so still check permissions in code for dangerous actions.
  • Limits: 100 global chat-input commands, 25 options per command, 25 choices per option.

5. Handle interactions and reply

import {
  ActionRowBuilder, ButtonBuilder, ButtonStyle, Client, EmbedBuilder,
  Events, GatewayIntentBits, MessageFlags,
} from "discord.js";

const client = new Client({ intents: [GatewayIntentBits.
Полный SKILL.md на GitHub

Установить discord в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл discord?

Discord is a chat platform whose bot API lets programs read events, answer slash commands and post messages in servers. Use this skill to create a Discord application and bot, choose gateway intents, register slash commands, reply to interactions, send embeds and buttons, check permissions, handle rate limits, and post through webhooks or the plain REST API with discord.js 14. Triggers: "make a Discord bot", "register slash commands", "ephemeral reply", "Discord webhook", "MessageContent intent".

Как установить скилл discord?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл discord запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить discord с