Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问clear审计提醒

discord-bot-architectDiscord 机器人架构师

Agent Skill

用于处理 Discord 服务器、频道、消息、成员和机器人交互。它适合让 Agent 辅助查询社区对话、整理频道内容、发布通知或管理基础协作流程。使用时需要确认 bot 权限、频道可见范围和服务器规则;涉及删除消息、管理成员、批量通知或读取私密频道时,应先获得明确授权并控制操作范围。

总安装

6,178

周安装

260

GitHub Stars

26,408

下载量

2,163
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:discord-bot-architect(Discord 机器人架构师)
来源仓库:https://github.com/davila7/claude-code-templates
仓库路径:skills/discord-bot-architect
安装命令:
npx skills add https://github.com/davila7/claude-code-templates --skill discord-bot-architect
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/davila7/claude-code-templates --skill discord-bot-architect

简介

discord-bot-architect 构建基于 Discord.js v14 的现代机器人,支持斜杠命令与事件驱动交互。

  • 提供最小权限意图配置、命令注册与错误处理基础架构,便于扩展功能模块。
  • 适用于社区管理、通知推送与自动化问答等服务器协作增强场景。
  • 需申请 Bot Token 并配置 OAuth2 权限,遵守 Discord 开发者政策与使用条款。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Discord Bot Architect

Patterns

Discord.js v14 Foundation

Modern Discord bot setup with Discord.js v14 and slash commands

When to use: ['Building Discord bots with JavaScript/TypeScript', 'Need full gateway connection with events', 'Building bots with complex interactions']

// src/index.js const { Client, Collection, GatewayIntentBits, Events } = require('discord.js'); const fs = require('node:fs'); const path = require('node:path'); require('dotenv').config();

// Create client with minimal required intents const client = new Client({ intents: [ GatewayIntentBits.Guilds, // Add only what you need: // GatewayIntentBits.GuildMessages, // GatewayIntentBits.MessageContent, // PRIVILEGED - avoid if possible ] });

// Load commands client.commands = new Collection(); const commandsPath = path.join(__dirname, 'commands'); const commandFiles = fs.readdirSync(commandsPath).filter(f => f.endsWith('.js'));

for (const file of commandFiles) { const filePath = path.join(commandsPath, file); const command = require(filePath); if ('data' in command && 'execute' in command) { client.commands.set(command.data.name, command); } }

// Load events const eventsPath = path.join(__dirname, 'events'); const eventFiles = fs.readdirSync(eventsPath).filter(f => f.endsWith('.js'));

for (const file of eventFiles) { const filePath = path.join(eventsPath, file); const event = require(filePath); if (event.once) { client.once(event.name, (...args) => event.execute(...args)); } else { client.on(event.name, (...args) => event.execute(...args)); } }

client.login(process.env.DISCORD_TOKEN);

// src/commands/ping.js const { SlashCommandBuilder } = require('discord.js');

module.exports = { data: new SlashCommandBuilder() .setName('ping') .setDescription('Replies with Pong!'),

async execute(interaction) { const sent = await interaction.reply({ content: 'Pinging...', fetchReply: true });

const latency = sent.createdTimestamp - interaction.createdTimestamp; await interaction.editReply(Pong! Latency: ${latency}ms); } };

// src/events/interactionCreate.js const { Events } = require('discord.js');

module.exports = { name: Event


### Pycord Bot Foundation

Discord bot with Pycord (Python) and application commands

**When to use**: ['Building Discord bots with Python', 'Prefer async/await patterns', 'Need good slash command support']
# main.py
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()

# Configure intents - only enable what you need
intents = discord.Intents.default()
# intents.message_content = True  # PRIVILEGED - avoid if possible
# intents.members = True          # PRIVILEGED

bot = commands.Bot(
    command_prefix="!",  # Legacy, prefer slash commands
    intents=intents
)

@bot.event
async def on_ready():
    print(f"Logged in as {bot.user}")
    # Sync commands (do this carefully - see sharp edges)
    # await bot.sync_commands()

# Slash command
@bot.slash_command(name="ping", description="Check bot latency")
async def ping(ctx: discord.ApplicationContext):
    latency = round(bot.latency * 1000)
    await ctx.respond(f"Pong! Latency: {latency}ms")

# Slash command with options
@bot.slash_command(name="greet", description="Greet a user")
async def greet(
    ctx: discord.ApplicationContext,
    user: discord.Option(discord.Member, "User to greet"),
    message: discord.Option(str, "Custom message", required=False)
):
    msg = message or "Hello!"
    await ctx.respond(f"{user.mention}, {msg}")

# Load cogs
for filename in os.listdir("./cogs"):
    if filename.endswith(".py"):
        bot.load_extension(f"cogs.{filename[:-3]}")

bot.run(os.environ["DISCORD_TOKEN"])
# cogs/general.py
import discord
from discord.ext import commands

class General(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.slash_command(name="info", description="Bot information")
    async def info(self, ctx: discord.ApplicationContext):
        embed = discord.Embed(
            title="Bot Info",
            description="A helpful Discord bot",
            color=discord.Color.blue()
        )
        embed.add_field(name="Servers", value=len(self.bot.guilds))
        embed.add_field(name="Latency", value=f"{round(self.bot.latency * 1000)}ms")
        await ctx.respond(embed=embed)

    @commands.Cog.

Interactive Components Pattern

Using buttons, select menus, and modals for rich UX

When to use: ['Need interactive user interfaces', 'Collecting user input beyond slash command options', 'Building menus, confirmations, or forms']

// Discord.js - Buttons and Select Menus const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');

module.exports = { data: new SlashCommandBuilder() .setName('menu') .setDescription('Shows an interactive menu'),

async execute(interaction) { // Button row const buttonRow = new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId('confirm') .setLabel('Confirm') .setStyle(ButtonStyle.Primary), new ButtonBuilder() .setCustomId('cancel') .setLabel('Cancel') .setStyle(ButtonStyle.Danger), new ButtonBuilder() .setLabel('Documentation') .setURL('https://discord.js.org') .setStyle(ButtonStyle.Link) // Link buttons don't emit events );

// Select menu row (one per row, takes all 5 slots) const selectRow = new ActionRowBuilder() .addComponents( new StringSelectMenuBuilder() .setCustomId('select-role') .setPlaceholder('Select a role') .setMinValues(1) .setMaxValues(3) .addOptions([ { label: 'Developer', value: 'dev', emoji: '💻' }, { label: 'Designer', value: 'design', emoji: '🎨' }, { label: 'Community', value: 'community', emoji: '🎉' } ]) );

await interaction.reply({ content: 'Choose an option:', components: [buttonRow, selectRow] });

// Collect responses const collector = interaction.channel.createMessageComponentCollector({ filter: i => i.user.id === interaction.user.id, time: 60_000 // 60 seconds timeout });

collector.on('collect', async i => { if (i.customId === 'confirm') { await i.update({ content: 'Confirmed!', components: [] }); collector.stop(); } else if (i.custo


## Anti-Patterns

### ❌ Message Content for Commands

**Why bad**: Message Content Intent is privileged and deprecated for bot commands. Slash commands are the intended approach.

### ❌ Syncing Commands on Every Start

**Why bad**: Command registration is rate limited. Global commands take up to 1 hour to propagate. Syncing on every start wastes API calls and can hit limits.

### ❌ Blocking the Event Loop

**Why bad**: Discord gateway requires regular heartbeats. Blocking operations cause missed heartbeats and disconnections.

## ⚠️ Sharp Edges

| Issue | Severity | Solution |
| --- | --- | --- |
| Issue | critical | ## Acknowledge immediately, process later |
| Issue | critical | ## Step 1: Enable in Developer Portal |
| Issue | high | ## Use a separate deploy script (not on startup) |
| Issue | critical | ## Never hardcode tokens |
| Issue | high | ## Generate correct invite URL |
| Issue | medium | ## Development: Use guild commands |
| Issue | medium | ## Never block the event loop |
| Issue | medium | ## Show modal immediately |

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.3%
按下载量换算655

OpenCode

26.02%
按下载量换算563

Cursor

19.35%
按下载量换算419

Antigravity

11.54%
按下载量换算250

Gemini CLI

7.07%
按下载量换算153

Codex

3.2%
按下载量换算69

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills