discli gives you full Discord control from the command line. Every command works in two modes: human-readable output by default, and structured JSON with --json for scripting and piping.
Identifier Resolution
Before diving into commands, understand how discli resolves Discord entities:
| Prefix | Resolves to | Example |
|---|---|---|
# | Channel by name | #general |
@ | User by name | @alice |
| Raw number | Any entity by ID | 1234567890 |
| Plain string | Server by name | "My Server" |
Channel names with # and user names with @ are matched case-insensitively across all servers your bot can see. When names collide, use the numeric ID instead.
Sending Messages
The most common operation. Send a message to any channel your bot has access to:
discli message send "#general" "Hello from the terminal!"discli message send 1234567890 "Deploy complete. All systems green."discli message send "#logs" "Here's today's report" --file ./report.csvdiscli message send "#announcements" "New release!" \ --embed-title "v2.1.0" \ --embed-desc "Bug fixes and performance improvements"discli message send "#announcements" "Check this out" \ --embed-title "Status Update" \ --embed-color 5865F2 \ --embed-footer "Last updated today" \ --embed-field "Service::Operational::true"Reading Messages
Fetch recent messages, search by content, or grab a specific message by ID.
# Last 10 messages (default)discli message list "#general"
# Last 50 messagesdiscli message list "#general" --limit 50
# Messages before a specific datediscli message list "#general" --before 2025-01-15
# Messages after a specific datediscli message list "#general" --after 2025-01-01# Search by contentdiscli message search "#support" "payment failed"
# Search by content + authordiscli message search "#support" "refund" --author "alice#1234"
# Search with date rangediscli message search "#general" "deploy" --after 2025-03-01 --limit 200# Get a specific message by IDdiscli message get "#general" 1234567890123456# Last 7 days of messagesdiscli message history "#general" --days 7
# Last 2 hoursdiscli message history "#general" --hours 2
# Last 7 days, max 500 messagesdiscli message history "#general" --days 7 --limit 500JSON Output and jq Piping
Add --json to any command to get structured JSON output. This is where discli becomes a scripting powerhouse.
# Get JSON outputdiscli --json message list "#general" --limit 5[ { "id": "1234567890", "author": "alice#1234", "content": "Hello everyone!", "timestamp": "2025-03-15T10:30:00", "attachments": [], "embeds": [] }]Pipe to jq for filtering and transformation:
discli --json message list "#general" --limit 20 | jq '.[].content'discli --json message list "#general" --limit 100 \ | jq '[.[] | select(.attachments | length > 0)]'discli --json message list "#general" --limit 100 \ | jq '[.[].author] | unique'discli --json message list "#general" --limit 100 \ | jq 'group_by(.author) | map({author: .[0].author, count: length}) | sort_by(-.count)'discli --json message list "#general" --limit 100 \ | jq -r '.[] | [.timestamp, .author, .content] | @csv' > messages.csvReplying and Editing
# Reply to a specific messagediscli message reply "#general" 1234567890123456 "Thanks for the update!"
# Edit a message (must be your bot's message)discli message edit "#general" 1234567890123456 "Updated content here"
# Delete a message (requires confirmation)discli message delete "#general" 1234567890123456
# Bulk delete multiple messages by IDdiscli -y message bulk-delete "#general" 111 222 333Destructive commands like message delete prompt for confirmation. Pass --yes or -y to skip the prompt in scripts: discli --yes message delete "#general" 1234567890.
Channel Management
# All channels across all serversdiscli channel list
# Channels in a specific serverdiscli channel list --server "My Server"
# JSON output for scriptingdiscli --json channel list --server "My Server" | jq '.[] | select(.type == "text")'# Create a text channeldiscli channel create "My Server" "new-channel"
# Create a voice channeldiscli channel create "My Server" "voice-room" --type voice
# Create a categorydiscli channel create "My Server" "Project Alpha" --type category
# Create a forum channeldiscli channel create "My Server" "feedback" --type forum --topic "Share your feedback"
# Create a forum postdiscli channel forum-post "#feedback" "Feature Request" "Add dark mode support"# Edit a channel's topic and slowmodediscli channel edit "#general" --topic "New topic" --slowmode 10# Set channel permissions for a rolediscli channel set-permissions "#general" "Members" \ --allow send_messages \ --deny manage_messages# Get channel detailsdiscli channel info "#general"
# JSON outputdiscli --json channel info "#general"Output includes: ID, name, type, server, topic, and creation date.
# Delete a channel (requires confirmation)discli channel delete "#old-channel"
# Skip confirmationdiscli --yes channel delete "#old-channel"Member Operations
# List members in a serverdiscli member list "My Server"discli member list "My Server" --limit 100
# Get member details (roles, join date, etc.)discli member info "My Server" "@alice"discli member info "My Server" 1234567890
# Kick a member (confirmation required)discli member kick "My Server" "@spammer" --reason "Spam"
# Ban a memberdiscli member ban "My Server" "@troll" --reason "Repeated violations"
# Unbandiscli member unban "My Server" "@reformed"
# Timeout a member for 1 hour (3600 seconds)discli -y member timeout "My Server" "@spammer" 3600 --reason "Spam"
# Remove a timeout (set duration to 0)discli -y member timeout "My Server" "@spammer" 0The --triggered-by Flag
When your bot acts on behalf of a Discord user, pass their ID to verify they have the required Discord permissions:
discli member kick "My Server" "@spammer" \ --reason "Spam" \ --triggered-by 9876543210This checks that user 9876543210 has kick_members permission in the server before executing. The check is logged to the audit trail.
Reactions
# Add a reactiondiscli reaction add "#general" 1234567890123456 "👍"
# Remove your bot's reactiondiscli reaction remove "#general" 1234567890123456 "👍"
# List reactions on a messagediscli reaction list "#general" 1234567890123456
# List users who reacted with a specific emojidiscli reaction users "#general" 1234567890123456 "👍"Unicode emoji work directly. For custom server emoji, use the format <:name:id> or just the emoji name if your bot is in the server.
Direct Messages
# Send a DM to a userdiscli dm send "@alice" "Your report is ready!"discli dm send 1234567890 "Your report is ready!"
# List recent DMs with a userdiscli dm list "@alice"discli dm list "@alice" --limit 20Threads
# Create a thread from a messagediscli thread create "#general" 1234567890123456 "Discussion Thread"
# List active threads in a channeldiscli thread list "#general"
# Send a message to a threaddiscli thread send 9876543210 "Replying in the thread"
# Send with file attachmentdiscli thread send 9876543210 "Here's the file" --file ./data.json
# Archive / unarchive a threaddiscli thread archive 9876543210discli thread unarchive 9876543210
# Rename a threaddiscli thread rename 9876543210 "New Thread Name"
# Add or remove a member from a threaddiscli thread add-member 9876543210 "@alice"discli thread remove-member 9876543210 "@alice"Roles
# List roles in a serverdiscli role list "My Server"
# Create a rolediscli role create "My Server" "Contributor" --color "00ff00"
# Assign a role to a memberdiscli role assign "My Server" "@alice" "Contributor"
# Remove a rolediscli role remove "My Server" "@alice" "Contributor"
# Edit a rolediscli role edit "My Server" "Contributor" \ --name "Core Contributor" \ --color 00ff00 \ --hoist \ --mentionable
# Delete a role (confirmation required)discli role delete "My Server" "OldRole"Server Operations
# List all servers your bot is indiscli server list
# Get server detailsdiscli server info "My Server"
# JSON for scriptingdiscli --json server list | jq '.[] | {name, member_count}'Polls
# Create a poll (via serve mode action)# See the Serve Mode guide for poll_send details
# View poll resultsdiscli poll results "#general" 1234567890123456
# End a poll earlydiscli poll end "#general" 1234567890123456Webhooks
# List webhooks in a channeldiscli webhook list "#general"
# Create a webhookdiscli webhook create "#general" "Deploy Notifier"
# Delete a webhook (requires confirmation)discli -y webhook delete "#general" 9876543210Scheduled Events
# List scheduled events in a serverdiscli event list "My Server"
# Create a scheduled eventdiscli event create "My Server" "Game Night" \ --start "2026-04-01T20:00:00" \ --end "2026-04-01T23:00:00" \ --description "Weekly game night"
# Delete a scheduled event (requires confirmation)discli -y event delete "My Server" 9876543210Permission Profiles
Control what commands your bot can execute:
# Show current profilediscli permission show
# List available profilesdiscli permission profiles
# Switch to a restricted profilediscli permission set readonly
# Override per-invocationdiscli --profile chat message send "#general" "Hello"See the Security & Permissions guide for full details.
Audit Log
Review what destructive actions have been taken:
# Show recent audit entriesdiscli audit showdiscli audit show --limit 50
# JSON outputdiscli --json audit show --limit 10
# Clear the audit logdiscli audit clearCommon Patterns
Quick Status Check
# How active is a channel?discli --json message list "#general" --limit 100 \ | jq 'length'Find a User’s Messages
discli --json message search "#general" "" --author "alice#1234" --limit 100 \ | jq 'length'Broadcast to Multiple Channels
for channel in "#announcements" "#general" "#dev"; do discli message send "$channel" "Server maintenance at 2 AM UTC tonight."doneExport Channel History
discli --json message history "#general" --days 30 \ | jq -r '.[] | [.timestamp, .author, .content] | @csv' \ > general-export.csvGlobal Flags Reference
| Flag | Short | Description |
|---|---|---|
--token | Bot token (overrides env and config) | |
--json | Output as structured JSON | |
--yes | -y | Skip destructive action confirmations |
--profile | Override permission profile (full, chat, readonly, moderation) |