图像安装
- 作者仓库星标 0
- 作者更新于 实时读取
- 作者仓库 nano-core
- 领域
- 写作
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @0-CYBERDYNE-SYSTEMS-0 · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- Python
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- 读取环境变量
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: discord-server
description: Complete Discord server interaction via Discord bot API for posting messages, uploading/download…
category: 写作
runtime: Python
---
# discord-server 输出预览
## PART A: 任务判断
- 适用问题:文章、文案、发言稿、润色或结构化表达。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“When to use this skill / When not to use this skill / Overview”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于文章、文案、发言稿、润色或结构化表达,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“When to use this skill / When not to use this skill / Overview”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、读取环境变量、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、读取环境变量;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/path` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、读取环境变量。
先用一个小任务确认它会围绕“When to use this skill / When not to use this skill / Overview”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: discord-server
description: Complete Discord server interaction via Discord bot API for posting messages, uploading/download…
category: 写作
source: 0-CYBERDYNE-SYSTEMS-0/nano-core
---
# discord-server
## 什么时候使用
- discord-server 是写作方向的技能,帮你打磨文章、稿子、内容表达 适合处理文章、文案、润色、翻译、总结和结构化表达,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查…
- 面向文章、文案、发言稿、润色或结构化表达,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「When to use this skill / When not to use this skill / Overview」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、读取环境变量;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "discord-server" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> When to use this skill / When not to use this skill / Overview
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Python | 读取文件、写入/修改文件、读取环境变量 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Discord Server Integration
When to use this skill
- Use when the user request matches this skill's domain and capabilities.
- Use when this workflow or toolchain is explicitly requested.
When not to use this skill
- Do not use when another skill is a better direct match for the task.
- Do not use when the request is outside this skill's scope.
Complete Discord bot integration for posting, downloading, and managing content on Discord servers.
Overview
This skill provides Python scripts for comprehensive Discord server interaction through the Discord bot API. All operations use a bot token for authentication and support common Discord operations including message posting, image uploads/downloads, message management, and channel navigation.
Prerequisites
Before using this skill, complete the setup process:
- Bot Token Required: See references/setup_guide.md for exact click-by-click instructions to create a Discord bot and obtain your token
- Environment Configuration: Copy
assets/.env.templateto.envand add your bot token - Python Dependencies: Install
discord.py,python-dotenv, andaiohttp
pip install discord.py python-dotenv aiohttp
Quick Start
1. Set Up Environment
# Copy template
cp assets/.env.template .env
# Edit .env and add your token
DISCORD_BOT_TOKEN=your_token_here
2. Test Connection
python scripts/discord_client.py
Expected output:
✅ Bot connected as YourBotName (ID: 123456789)
3. Get Channel IDs
Enable Developer Mode in Discord (User Settings > Advanced > Developer Mode), then right-click any channel and select "Copy Channel ID".
Or use the list_channels script:
python scripts/list_channels.py
4. Post Your First Message
python scripts/post_message.py CHANNEL_ID "Hello, Discord!"
Core Operations
Posting Messages
Use scripts/post_message.py to send text messages:
# Simple message
python scripts/post_message.py 123456789 "Hello, World!"
# Message with embed
python scripts/post_message.py 123456789 "Important update" \
--embed-title "Status Report" \
--embed-description "All systems operational" \
--embed-color 0x00FF00
When to use: Sending notifications, status updates, or text announcements to Discord channels.
Uploading Images
Use scripts/upload_image.py to upload images and files:
# Upload single image
python scripts/upload_image.py 123456789 /path/to/image.png
# Upload with caption
python scripts/upload_image.py 123456789 /path/to/image.png \
--caption "Check out this AI-generated artwork!"
# Upload multiple images (up to 10)
python scripts/upload_image.py 123456789 image1.png image2.png image3.png \
--caption "Gallery of variations"
Supported formats: PNG, JPEG, WEBP, GIF
When to use: Sharing AI-generated images, posting visual content, creating image galleries.
Downloading Images
Use scripts/download_images.py to download images from Discord:
# Download from specific message
python scripts/download_images.py 123456789 --message-id 987654321 \
--output-dir ./downloads
# Download from last 20 messages
python scripts/download_images.py 123456789 --limit 20 \
--output-dir ./input_images
When to use: Fetching reference images, downloading user-uploaded images for processing, collecting image datasets.
Editing Messages
Use scripts/edit_message.py to edit bot messages:
# Edit message content
python scripts/edit_message.py 123456789 987654321 "Updated content"
Note: Can only edit messages posted by the bot itself.
When to use: Updating status messages, correcting posted content, showing progress updates.
Deleting Messages
Use scripts/delete_message.py to delete bot messages:
python scripts/delete_message.py 123456789 987654321
Note: Can only delete messages posted by the bot itself.
When to use: Removing outdated messages, cleaning up test posts.
Reading Messages
Use scripts/read_messages.py to read channel content:
# Read last 10 messages
python scripts/read_messages.py 123456789
# Read last 50 messages
python scripts/read_messages.py 123456789 --limit 50
# Read messages before specific message
python scripts/read_messages.py 123456789 --before 987654321 --limit 20
# Output as JSON for parsing
python scripts/read_messages.py 123456789 --format json
When to use: Monitoring channel activity, analyzing message content, checking for specific messages.
Listing Channels
Use scripts/list_channels.py to discover available channels:
# List all channels from all servers
python scripts/list_channels.py
# List channels from specific server
python scripts/list_channels.py --guild-id 123456789
# JSON output
python scripts/list_channels.py --format json
When to use: Finding channel IDs, discovering server structure, verifying bot access.
Responding to Mentions
Use scripts/get_mentions.py to find where the bot is mentioned:
# Get mentions from all channels
python scripts/get_mentions.py
# Get mentions from specific channel
python scripts/get_mentions.py --channel-id 123456789
# Check more messages per channel
python scripts/get_mentions.py --limit 50
When to use: Building interactive bots, responding to user requests, monitoring bot tags.
Common Workflows
Workflow 1: AI Image Generation → Discord
Generate image with AI and post to Discord:
# After generating image with your app
python scripts/upload_image.py 123456789 ./output.png \
--caption "Fresh AI creation!"
Workflow 2: Discord → AI Processing → Discord
Download, process, and re-upload:
# Download image
python scripts/download_images.py 123456789 \
--message-id 987654321 --output-dir ./temp
# Process with your app (creates ./processed.png)
# Upload result
python scripts/upload_image.py 123456789 ./processed.png \
--caption "Processed version ready!"
Workflow 3: Progress Updates
Update a message to show progress:
from post_message import post_message
from edit_message import edit_message
from discord_client import run_async
async def show_progress():
# Post initial message
result = await post_message(123456789, "Processing: 0%")
msg_id = result['message_id']
# Update progress
await edit_message(123456789, msg_id, "Processing: 50%")
# ... do work ...
await edit_message(123456789, msg_id, "Complete! ✅")
run_async(show_progress())
Workflow 4: Batch Image Processing
Process multiple images from a channel:
# Download recent images
python scripts/download_images.py 123456789 --limit 20 \
--output-dir ./batch_input
# Process images with your app (saves to ./batch_output/)
# Upload all results
python scripts/upload_image.py 123456789 \
./batch_output/*.png --caption "Batch processing complete!"
Integration with Python Code
All scripts can be imported and used programmatically:
import sys
sys.path.append('./scripts')
from upload_image import upload_image
from download_images import download_recent_images
from discord_client import run_async
async def my_workflow():
# Download images
result = await download_recent_images(
channel_id=123456789,
limit=10,
output_dir='./input'
)
# Upload images
await upload_image(
channel_id=123456789,
image_path='./output.png',
caption='Done!'
)
run_async(my_workflow())
Advanced Usage
Custom Embed Messages
python scripts/post_message.py 123456789 "Status Update" \
--embed-title "System Status" \
--embed-description "All systems operational" \
--embed-color 0x00FF00
Batch Operations
# Upload multiple images efficiently
from upload_image import upload_multiple_images
from discord_client import run_async
async def batch_upload():
await upload_multiple_images(
channel_id=123456789,
image_paths=['img1.png', 'img2.png', 'img3.png'],
caption='Triple feature!'
)
run_async(batch_upload())
Error Handling
import discord
from upload_image import upload_image
from discord_client import run_async
async def safe_upload():
try:
await upload_image(123456789, './image.png')
except discord.Forbidden:
print("Missing permissions")
except discord.NotFound:
print("Channel not found")
except FileNotFoundError:
print("Image not found")
run_async(safe_upload())
Troubleshooting
"Invalid Token" Error
- Token may be incorrect or expired
- Reset token in Discord Developer Portal
- Update
.envfile with new token
"Missing Access" Error
- Bot lacks permission to access channel
- Right-click channel > Edit Channel > Permissions
- Add bot role with appropriate permissions
"Message Content Intent" Error
- Enable Message Content Intent in Discord Developer Portal
- Application > Bot > Privileged Gateway Intents
- Toggle ON "Message Content Intent"
Bot Not Responding
- Verify bot is online (green status in server)
- Check you're using correct channel ID
- Verify bot has Send Messages permission
Reference Documentation
For detailed information, see:
- references/setup_guide.md - Complete step-by-step setup instructions with exact clicks to obtain bot token
- references/api_reference.md - Discord API patterns, embed formatting, permissions, and error handling
- references/examples.md - Comprehensive workflows, integration patterns, and advanced usage examples
Script Reference
| Script | Purpose | Key Arguments |
|---|---|---|
discord_client.py |
Test bot connection | None (run directly) |
post_message.py |
Send text messages | channel_id, content, optional embeds |
upload_image.py |
Upload images/files | channel_id, image_path(s), optional caption |
download_images.py |
Download images | channel_id, optional message_id or limit |
edit_message.py |
Edit bot messages | channel_id, message_id, new_content |
delete_message.py |
Delete bot messages | channel_id, message_id |
read_messages.py |
Read channel messages | channel_id, optional limit, before, after |
list_channels.py |
List available channels | Optional guild_id |
get_mentions.py |
Find bot mentions | Optional channel_id, limit |
Security Best Practices
- Never commit
.envfile to version control - Add
.envto.gitignore - Never share bot token publicly
- Regenerate token if exposed
- Use minimal required permissions
- Keep bot code private
Assets
.env.template- Environment variable template for bot configuration
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核