Skip to content

Commit 06acbb4

Browse files
DevRohit06claude
andcommitted
docs: comprehensive README update + bump to 0.3.0
- Added search & history commands section - Added full security & permissions docs (profiles, audit, confirmation, rate limiting, user permission checks) - Fixed --json flag placement examples - Added attachment/embed info to JSON output examples - Updated project structure with security.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 009af0a commit 06acbb4

2 files changed

Lines changed: 97 additions & 9 deletions

File tree

README.md

Lines changed: 96 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,25 @@ Every command supports `--json` for machine-readable output.
4848
discli message send #general "Hello world!"
4949
discli message send #general "Check this out" --embed-title "News" --embed-desc "Big update"
5050
discli message list #general --limit 20
51+
discli message list #general --after 2026-03-01 --before 2026-03-14
5152
discli message get #general 123456789
5253
discli message reply #general 123456789 "Thanks for your question!"
5354
discli message edit #general 123456789 "Updated text"
5455
discli message delete #general 123456789
5556
```
5657

58+
### Search & History
59+
60+
```bash
61+
# Search messages by content
62+
discli message search #general "bug report" --limit 100
63+
discli message search #general "help" --author alice --after 2026-03-01
64+
65+
# Deep history backfill
66+
discli message history #general --days 7
67+
discli message history #general --hours 24 --limit 500
68+
```
69+
5770
### Direct Messages
5871

5972
```bash
@@ -138,11 +151,83 @@ discli listen --events messages,reactions
138151
discli listen --include-bots
139152

140153
# JSON output for piping to an agent
141-
discli listen --json --events messages
154+
discli --json listen --events messages
142155
```
143156

144157
Supported event types: `messages`, `reactions`, `members`, `edits`, `deletes`
145158

159+
## Security & Permissions
160+
161+
### Confirmation Prompts
162+
163+
Destructive actions (kick, ban, delete) require confirmation by default:
164+
165+
```bash
166+
$ discli member kick "My Server" spammer
167+
⚠ Destructive action: member kick (spammer from My Server). Continue? [y/N]
168+
169+
# Skip with --yes for automation
170+
$ discli -y member kick "My Server" spammer --reason "Spam"
171+
```
172+
173+
### Permission Profiles
174+
175+
Restrict which commands an agent can use:
176+
177+
```bash
178+
# List available profiles
179+
discli permission profiles
180+
181+
# Set a profile
182+
discli permission set chat # Messages, reactions, threads only — no moderation
183+
discli permission set readonly # Can only read — no sending or deleting
184+
discli permission set moderation # Full access including kick/ban
185+
discli permission set full # Everything (default)
186+
```
187+
188+
| Profile | Can Send | Can Delete | Can Kick/Ban | Can Manage Channels |
189+
|---------|----------|------------|--------------|---------------------|
190+
| `full` | Yes | Yes | Yes | Yes |
191+
| `moderation` | Yes | Yes | Yes | Yes |
192+
| `chat` | Yes | No | No | No |
193+
| `readonly` | No | No | No | No |
194+
195+
### User Permission Checking
196+
197+
Verify the Discord user who triggered an action actually has the required permissions:
198+
199+
```bash
200+
discli member kick "My Server" target --triggered-by 123456789
201+
```
202+
203+
This checks that user `123456789` has `kick_members` permission in the server. Server owners and administrators always pass. If the user can't be found in cache, it fetches from the API. If that also fails, it warns but doesn't block.
204+
205+
### Audit Log
206+
207+
Every destructive action is logged to `~/.discli/audit.log`:
208+
209+
```bash
210+
# View recent actions
211+
discli audit show --limit 20
212+
213+
# JSON output
214+
discli --json audit show
215+
216+
# Clear the log
217+
discli audit clear
218+
```
219+
220+
Example output:
221+
```
222+
[2026-03-14 12:30:00] member kick ok (by 123456789)
223+
[2026-03-14 12:31:00] channel delete ok
224+
[2026-03-14 12:32:00] permission_check denied
225+
```
226+
227+
### Rate Limiting
228+
229+
Built-in rate limiter (5 calls per 5 seconds) on destructive actions to prevent Discord API bans. If the limit is hit, discli waits automatically.
230+
146231
## Resolving Identifiers
147232

148233
All commands accept both **IDs** and **names**:
@@ -158,21 +243,23 @@ All commands accept both **IDs** and **names**:
158243

159244
## JSON Output
160245

161-
Add `--json` to any command for machine-readable output:
246+
Add `--json` **before the subcommand** for machine-readable output:
162247

163248
```bash
164-
$ discli message list #general --limit 1 --json
249+
$ discli --json message list #general --limit 1
165250
[
166251
{
167252
"id": "123456789",
168253
"author": "alice",
169254
"content": "Hello!",
170-
"timestamp": "2026-03-14T10:32:00+00:00"
255+
"timestamp": "2026-03-14T10:32:00+00:00",
256+
"attachments": [],
257+
"embeds": []
171258
}
172259
]
173260

174-
$ discli listen --json
175-
{"event": "message", "server": "My Server", "channel": "general", "channel_id": "111", "author": "alice", "author_id": "222", "content": "hello", "message_id": "333", "mentions_bot": false, "attachments": [], ...}
261+
$ discli --json listen --events messages
262+
{"event": "message", "server": "My Server", "channel": "general", "channel_id": "111", "author": "alice", "author_id": "222", "content": "hello", "message_id": "333", "mentions_bot": false, "attachments": []}
176263
```
177264

178265
## Examples
@@ -221,9 +308,10 @@ done
221308
```
222309
discli/
223310
├── src/discli/ # CLI source code
224-
│ ├── cli.py # Root click group
311+
│ ├── cli.py # Root click group + permission/audit commands
225312
│ ├── client.py # Async discord.py wrapper
226-
│ ├── config.py # Token storage
313+
│ ├── config.py # Token storage (~/.discli/config.json)
314+
│ ├── security.py # Permissions, audit logging, rate limiting
227315
│ ├── utils.py # Output formatting, resolvers
228316
│ └── commands/ # Command groups (message, channel, role, etc.)
229317
├── agents/ # Agent instruction files

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "discord-cli-agent"
7-
version = "0.2.0"
7+
version = "0.3.0"
88
description = "Discord CLI for AI agents"
99
readme = "README.md"
1010
license = "MIT"

0 commit comments

Comments
 (0)