discordcli-agents 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- discordcli_agents-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +34 -0
- discordcli_agents-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +26 -0
- discordcli_agents-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- discordcli_agents-0.1.0/.github/workflows/ci.yml +61 -0
- discordcli_agents-0.1.0/.github/workflows/release.yml +77 -0
- discordcli_agents-0.1.0/.gitignore +41 -0
- discordcli_agents-0.1.0/.python-version +1 -0
- discordcli_agents-0.1.0/CHANGELOG.md +17 -0
- discordcli_agents-0.1.0/CONTRIBUTING.md +39 -0
- discordcli_agents-0.1.0/LICENSE +21 -0
- discordcli_agents-0.1.0/PKG-INFO +248 -0
- discordcli_agents-0.1.0/README.md +213 -0
- discordcli_agents-0.1.0/SECURITY.md +5 -0
- discordcli_agents-0.1.0/pyproject.toml +62 -0
- discordcli_agents-0.1.0/src/discord_cli/__init__.py +3 -0
- discordcli_agents-0.1.0/src/discord_cli/__main__.py +6 -0
- discordcli_agents-0.1.0/src/discord_cli/cli.py +48 -0
- discordcli_agents-0.1.0/src/discord_cli/client.py +102 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/__init__.py +1 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/categories.py +93 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/channels.py +198 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/export.py +66 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/guilds.py +239 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/invites.py +84 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/members.py +200 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/messages.py +204 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/permissions.py +121 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/roles.py +193 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/search.py +73 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/threads.py +140 -0
- discordcli_agents-0.1.0/src/discord_cli/commands/webhooks.py +82 -0
- discordcli_agents-0.1.0/src/discord_cli/config.py +29 -0
- discordcli_agents-0.1.0/src/discord_cli/errors.py +17 -0
- discordcli_agents-0.1.0/src/discord_cli/models.py +290 -0
- discordcli_agents-0.1.0/src/discord_cli/output.py +57 -0
- discordcli_agents-0.1.0/src/discord_cli/registry.py +60 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a reproducible problem with discord-cli.
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: [bug]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: "Thanks for reporting a bug. Please remove any tokens or sensitive server data."
|
|
9
|
+
- type: input
|
|
10
|
+
id: version
|
|
11
|
+
attributes:
|
|
12
|
+
label: discord-cli version
|
|
13
|
+
placeholder: "0.1.0"
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: description
|
|
18
|
+
attributes:
|
|
19
|
+
label: What happened?
|
|
20
|
+
description: Include expected and actual behavior.
|
|
21
|
+
validations:
|
|
22
|
+
required: true
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: reproduce
|
|
25
|
+
attributes:
|
|
26
|
+
label: Steps to reproduce
|
|
27
|
+
placeholder: "1. Run ...\n2. Observe ..."
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
- type: textarea
|
|
31
|
+
id: environment
|
|
32
|
+
attributes:
|
|
33
|
+
label: Environment
|
|
34
|
+
description: Include OS and Python version.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an improvement to discord-cli.
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
labels: [enhancement]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: "Thanks for sharing an idea. Do not include tokens or private server data."
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: problem
|
|
11
|
+
attributes:
|
|
12
|
+
label: Problem to solve
|
|
13
|
+
description: What workflow or limitation does this address?
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: proposal
|
|
18
|
+
attributes:
|
|
19
|
+
label: Proposed solution
|
|
20
|
+
description: Describe the behavior you would like.
|
|
21
|
+
validations:
|
|
22
|
+
required: true
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: alternatives
|
|
25
|
+
attributes:
|
|
26
|
+
label: Alternatives considered
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Describe the change and the problem it solves.
|
|
4
|
+
|
|
5
|
+
## Validation
|
|
6
|
+
|
|
7
|
+
- [ ] `ruff check src/`
|
|
8
|
+
- [ ] `ruff format --check src/`
|
|
9
|
+
- [ ] Tests or the import smoke test pass
|
|
10
|
+
- [ ] Documentation and changelog are updated when needed
|
|
11
|
+
|
|
12
|
+
## Security
|
|
13
|
+
|
|
14
|
+
- [ ] No bot tokens, webhook URLs, private server data, or other credentials are included
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- name: Install Ruff
|
|
17
|
+
run: pip install ruff
|
|
18
|
+
- name: Lint source
|
|
19
|
+
run: ruff check src/
|
|
20
|
+
- name: Check formatting
|
|
21
|
+
run: ruff format --check src/
|
|
22
|
+
|
|
23
|
+
test:
|
|
24
|
+
runs-on: ${{ matrix.os }}
|
|
25
|
+
strategy:
|
|
26
|
+
fail-fast: false
|
|
27
|
+
matrix:
|
|
28
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
29
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: actions/setup-python@v5
|
|
33
|
+
with:
|
|
34
|
+
python-version: ${{ matrix.python-version }}
|
|
35
|
+
- name: Install project and development dependencies
|
|
36
|
+
run: pip install -e ".[dev]"
|
|
37
|
+
- name: Run tests or smoke test
|
|
38
|
+
shell: bash
|
|
39
|
+
run: |
|
|
40
|
+
if [ -d tests ] && find tests -name 'test_*.py' -print -quit | grep -q .; then
|
|
41
|
+
python -m pytest tests/
|
|
42
|
+
else
|
|
43
|
+
python -c "import discord_cli; print(discord_cli.__version__)"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
build:
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
- uses: actions/setup-python@v5
|
|
51
|
+
with:
|
|
52
|
+
python-version: "3.12"
|
|
53
|
+
- name: Install build tools
|
|
54
|
+
run: pip install build
|
|
55
|
+
- name: Build distribution
|
|
56
|
+
run: python -m build
|
|
57
|
+
- name: Upload distribution artifacts
|
|
58
|
+
uses: actions/upload-artifact@v4
|
|
59
|
+
with:
|
|
60
|
+
name: dist
|
|
61
|
+
path: dist/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- name: Install release checks and build tools
|
|
20
|
+
run: pip install -e ".[dev]"
|
|
21
|
+
- name: Run lint checks
|
|
22
|
+
run: |
|
|
23
|
+
ruff check src/
|
|
24
|
+
ruff format --check src/
|
|
25
|
+
- name: Run tests or smoke test
|
|
26
|
+
shell: bash
|
|
27
|
+
run: |
|
|
28
|
+
if [ -d tests ] && find tests -name 'test_*.py' -print -quit | grep -q .; then
|
|
29
|
+
python -m pytest tests/
|
|
30
|
+
else
|
|
31
|
+
python -c "import discord_cli; print(discord_cli.__version__)"
|
|
32
|
+
fi
|
|
33
|
+
- name: Build source and wheel distributions
|
|
34
|
+
run: python -m build
|
|
35
|
+
- name: Upload distribution artifacts
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: dist
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
publish-pypi:
|
|
42
|
+
needs: build
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
environment: pypi
|
|
45
|
+
permissions:
|
|
46
|
+
id-token: write
|
|
47
|
+
steps:
|
|
48
|
+
- name: Download distribution artifacts
|
|
49
|
+
uses: actions/download-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: dist
|
|
52
|
+
path: dist/
|
|
53
|
+
- uses: actions/setup-python@v5
|
|
54
|
+
with:
|
|
55
|
+
python-version: "3.12"
|
|
56
|
+
- name: Publish distribution to PyPI
|
|
57
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
58
|
+
|
|
59
|
+
create-github-release:
|
|
60
|
+
needs: publish-pypi
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v4
|
|
64
|
+
- name: Download distribution artifacts
|
|
65
|
+
uses: actions/download-artifact@v4
|
|
66
|
+
with:
|
|
67
|
+
name: dist
|
|
68
|
+
path: dist/
|
|
69
|
+
- name: Create GitHub release
|
|
70
|
+
uses: softprops/action-gh-release@v2
|
|
71
|
+
with:
|
|
72
|
+
tag_name: ${{ github.ref_name }}
|
|
73
|
+
name: ${{ github.ref_name }}
|
|
74
|
+
body_path: CHANGELOG.md
|
|
75
|
+
files: dist/*
|
|
76
|
+
draft: false
|
|
77
|
+
prerelease: false
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*$py.class
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
# Virtual environments
|
|
9
|
+
venv/
|
|
10
|
+
.venv/
|
|
11
|
+
env/
|
|
12
|
+
ENV/
|
|
13
|
+
|
|
14
|
+
# Environment variables
|
|
15
|
+
.env
|
|
16
|
+
|
|
17
|
+
# Build artifacts
|
|
18
|
+
dist/
|
|
19
|
+
build/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
.eggs/
|
|
22
|
+
.tox/
|
|
23
|
+
|
|
24
|
+
# Test / cache
|
|
25
|
+
.pytest_cache/
|
|
26
|
+
.mypy_cache/
|
|
27
|
+
.ruff_cache/
|
|
28
|
+
.coverage
|
|
29
|
+
htmlcov/
|
|
30
|
+
|
|
31
|
+
# Editors
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
|
34
|
+
*.swp
|
|
35
|
+
|
|
36
|
+
# OS
|
|
37
|
+
.DS_Store
|
|
38
|
+
Thumbs.db
|
|
39
|
+
|
|
40
|
+
# Archived source
|
|
41
|
+
legacy/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to discord-cli will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-07-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release of discordcli-agents
|
|
13
|
+
- 50+ commands across 12 command groups (channels, categories, roles, members, messages, guilds, permissions, webhooks, invites, threads, search, export)
|
|
14
|
+
- JSON output by default with `--human` flag for table output
|
|
15
|
+
- Headless operation (connect, act, disconnect)
|
|
16
|
+
- AI agent-friendly design with structured JSON output
|
|
17
|
+
- Modular command architecture with plugin-friendly registry pattern
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve discord-cli.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
Use Python 3.9 or newer, then install the project and development dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/1solomonwakhungu/discord-cli.git
|
|
11
|
+
cd discord-cli
|
|
12
|
+
python -m pip install -e ".[dev]"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Run the checks before opening a pull request:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
ruff check src/
|
|
19
|
+
ruff format --check src/
|
|
20
|
+
python -m pytest tests/
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If the repository has no tests for your change yet, run the import smoke test:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python -c "import discord_cli; print(discord_cli.__version__)"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Pull requests
|
|
30
|
+
|
|
31
|
+
Keep pull requests focused, include tests when practical, and describe user-visible changes. Do not commit bot tokens, `.env` files, or other credentials.
|
|
32
|
+
|
|
33
|
+
Use Conventional Commit-style subjects:
|
|
34
|
+
|
|
35
|
+
- `feat:` for a new feature
|
|
36
|
+
- `fix:` for a bug fix
|
|
37
|
+
- `docs:` for documentation-only changes
|
|
38
|
+
- `chore:` for maintenance
|
|
39
|
+
- `refactor:` for code restructuring without behavior changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 1solomonwakhungu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: discordcli-agents
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Command-line tool for managing Discord servers and automating Discord via AI agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/1solomonwakhungu/discord-cli
|
|
6
|
+
Project-URL: Issues, https://github.com/1solomonwakhungu/discord-cli/issues
|
|
7
|
+
Project-URL: Repository, https://github.com/1solomonwakhungu/discord-cli
|
|
8
|
+
Project-URL: Changelog, https://github.com/1solomonwakhungu/discord-cli/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: PyPI, https://pypi.org/project/discordcli-agents/
|
|
10
|
+
Author-email: Solomon Wakhungu <1solomonwakhungu@gmail.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: ai-agent,cli,discord,discord-automation,discord-bot
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Communications :: Chat
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Requires-Dist: click>=8.0
|
|
25
|
+
Requires-Dist: discord-py>=2.3
|
|
26
|
+
Requires-Dist: python-dotenv>=1.0
|
|
27
|
+
Requires-Dist: rich>=13.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# discord-cli: Command-Line Tool for Discord Server Management & Automation
|
|
37
|
+
|
|
38
|
+
**discord-cli** is a command-line interface for managing Discord servers and automating Discord operations via AI agents. It provides 50+ commands for channel management, role administration, member moderation, message operations, and more — all from the terminal with JSON output for programmatic consumption.
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/discordcli-agents/)
|
|
41
|
+
[](https://www.python.org/downloads/)
|
|
42
|
+
[](https://opensource.org/licenses/MIT)
|
|
43
|
+
[](https://github.com/1solomonwakhungu/discord-cli/actions)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## What is discord-cli?
|
|
48
|
+
|
|
49
|
+
discord-cli is a Discord command-line tool that lets you manage Discord servers from the terminal. Instead of clicking through the Discord UI, you run commands like `discord-cli channel list` or `discord-cli role create "Moderators"` to automate server administration, bulk operations, and bot-like workflows — all without keeping a bot process running.
|
|
50
|
+
|
|
51
|
+
It's designed for **DevOps teams**, **server administrators**, and **AI agents** who need programmatic, scriptable access to Discord server management.
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
discord-cli provides **50+ commands** organized into 12 command groups:
|
|
56
|
+
|
|
57
|
+
| Command Group | Key Commands | Use Case |
|
|
58
|
+
|---------------|-------------|----------|
|
|
59
|
+
| **channels** | list, create, delete, edit, move, info | Manage text, voice, stage, and forum channels |
|
|
60
|
+
| **categories** | list, create, delete, edit | Organize channels into categories |
|
|
61
|
+
| **roles** | list, create, delete, edit, assign, remove | Manage server roles and permissions |
|
|
62
|
+
| **members** | list, info, kick, ban, timeout, nickname | Moderate and manage server members |
|
|
63
|
+
| **messages** | send, edit, delete, purge, pin, react | Manage channel messages at scale |
|
|
64
|
+
| **guilds** | info, edit, emojis, bans, prune | Server-level configuration and management |
|
|
65
|
+
| **permissions** | list, set, reset | Fine-grained permission control per channel |
|
|
66
|
+
| **webhooks** | list, create, delete, info | Manage webhooks for automation |
|
|
67
|
+
| **invites** | list, create, delete | Manage server invites |
|
|
68
|
+
| **threads** | list, create, archive, members | Manage forum and thread channels |
|
|
69
|
+
| **search** | messages, members | Search server content programmatically |
|
|
70
|
+
| **export** | channel | Export message history to JSON or CSV |
|
|
71
|
+
|
|
72
|
+
### Key Design Principles
|
|
73
|
+
|
|
74
|
+
- **JSON by default**: Every command outputs structured JSON for programmatic consumption and piping
|
|
75
|
+
- **Human-readable mode**: Add `--human` flag for rich table output in the terminal
|
|
76
|
+
- **Headless operation**: Connects, performs the action, disconnects — no persistent bot process needed
|
|
77
|
+
- **AI agent friendly**: JSON output makes it trivial for AI agents (Claude, Codex, GPT) to parse results
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
### pip (recommended)
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install discordcli-agents
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The PyPI package is named `discordcli-agents`; the installed command remains `discord-cli`.
|
|
88
|
+
|
|
89
|
+
### From source
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/1solomonwakhungu/discord-cli.git
|
|
93
|
+
cd discord-cli
|
|
94
|
+
pip install -e .
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Quick setup
|
|
98
|
+
|
|
99
|
+
1. Create a Discord bot application at the [Discord Developer Portal](https://discord.com/developers/applications)
|
|
100
|
+
2. Enable the **Message Content Intent** and **Server Members Intent** in your bot settings
|
|
101
|
+
3. Add the bot to your server with administrator permissions
|
|
102
|
+
4. Set your bot token:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
export DISCORD_BOT_TOKEN="your-bot-token-here"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or create a `.env` file in your working directory:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
echo 'DISCORD_BOT_TOKEN=your-bot-token-here' > .env
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Quickstart
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Get server info
|
|
118
|
+
discord-cli guild info
|
|
119
|
+
|
|
120
|
+
# List all channels
|
|
121
|
+
discord-cli channels list
|
|
122
|
+
|
|
123
|
+
# Create a new text channel
|
|
124
|
+
discord-cli channels create "announcements" --type text --topic "Server announcements"
|
|
125
|
+
|
|
126
|
+
# List all members
|
|
127
|
+
discord-cli members list
|
|
128
|
+
|
|
129
|
+
# Send a message
|
|
130
|
+
discord-cli messages send 1234567890 --content "Hello from the CLI!"
|
|
131
|
+
|
|
132
|
+
# Bulk delete messages
|
|
133
|
+
discord-cli messages purge 1234567890 --limit 100
|
|
134
|
+
|
|
135
|
+
# Ban a member
|
|
136
|
+
discord-cli members ban 9876543210 --reason "Spam"
|
|
137
|
+
|
|
138
|
+
# Export channel history
|
|
139
|
+
discord-cli export channel 1234567890 --limit 500 --format json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## AI Agent Integration
|
|
143
|
+
|
|
144
|
+
discord-cli is designed to be used by AI agents for Discord automation. The JSON output format makes it easy for agents to parse results and make decisions:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
# Example: AI agent uses discord-cli to manage a server
|
|
148
|
+
import subprocess
|
|
149
|
+
import json
|
|
150
|
+
|
|
151
|
+
# List all channels
|
|
152
|
+
result = subprocess.run(
|
|
153
|
+
["discord-cli", "channels", "list"],
|
|
154
|
+
capture_output=True, text=True
|
|
155
|
+
)
|
|
156
|
+
channels = json.loads(result.stdout)
|
|
157
|
+
|
|
158
|
+
# Find a channel by name
|
|
159
|
+
target = next(c for c in channels if c["name"] == "general")
|
|
160
|
+
|
|
161
|
+
# Send a message to that channel
|
|
162
|
+
subprocess.run([
|
|
163
|
+
"discord-cli", "messages", "send", str(target["id"]),
|
|
164
|
+
"--content", "Automated message from AI agent"
|
|
165
|
+
])
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Supported AI agent platforms:**
|
|
169
|
+
- Claude Code (Anthropic)
|
|
170
|
+
- Codex CLI (OpenAI)
|
|
171
|
+
- Custom LLM agents with terminal access
|
|
172
|
+
- Any tool that can parse JSON output
|
|
173
|
+
|
|
174
|
+
## Configuration
|
|
175
|
+
|
|
176
|
+
discord-cli loads configuration in the following order (first match wins):
|
|
177
|
+
|
|
178
|
+
1. `--token` CLI flag
|
|
179
|
+
2. `DISCORD_BOT_TOKEN` environment variable
|
|
180
|
+
3. `.env` file in the current directory
|
|
181
|
+
4. `.env` file in the package directory
|
|
182
|
+
|
|
183
|
+
### Options
|
|
184
|
+
|
|
185
|
+
| Flag | Description | Default |
|
|
186
|
+
|------|-------------|---------|
|
|
187
|
+
| `--token` | Discord bot token | Falls back to env/.env |
|
|
188
|
+
| `--guild ID` | Target guild ID (for multi-guild bots) | First available guild |
|
|
189
|
+
| `--human` | Human-readable table output | JSON (default) |
|
|
190
|
+
| `--dry-run` | Preview without executing | Disabled |
|
|
191
|
+
|
|
192
|
+
## FAQ
|
|
193
|
+
|
|
194
|
+
### How does discord-cli differ from a Discord bot?
|
|
195
|
+
|
|
196
|
+
A Discord bot runs as a persistent process that stays online and responds to events. discord-cli is a **headless command-line tool** — it connects, performs a single action, and disconnects. This makes it ideal for scripts, CI/CD pipelines, and AI agent workflows where you need one-off actions without maintaining a bot process.
|
|
197
|
+
|
|
198
|
+
### Can I use discord-cli without a Discord bot token?
|
|
199
|
+
|
|
200
|
+
No. discord-cli requires a valid Discord bot token to connect to the Discord API. You can create a bot for free at the [Discord Developer Portal](https://discord.com/developers/applications).
|
|
201
|
+
|
|
202
|
+
### Does discord-cli support multiple servers?
|
|
203
|
+
|
|
204
|
+
Yes. If your bot is in multiple servers, use `--guild ID` to specify which server to operate on. Without this flag, discord-cli defaults to the first available guild.
|
|
205
|
+
|
|
206
|
+
### Is discord-cli safe for production use?
|
|
207
|
+
|
|
208
|
+
discord-cli uses the official [discord.py](https://github.com/dpydpyd/discord.py) library and respects Discord's rate limits automatically. However, always test commands in a development server first, especially destructive operations like `channel delete` or `member ban`.
|
|
209
|
+
|
|
210
|
+
### Can AI agents use discord-cli?
|
|
211
|
+
|
|
212
|
+
Yes! discord-cli is specifically designed for AI agent integration. The JSON output format allows agents to parse results programmatically. See the [AI Agent Integration](#ai-agent-integration) section above.
|
|
213
|
+
|
|
214
|
+
### How do I contribute to discord-cli?
|
|
215
|
+
|
|
216
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding standards, and PR guidelines.
|
|
217
|
+
|
|
218
|
+
## Comparison with Alternatives
|
|
219
|
+
|
|
220
|
+
| Feature | discord-cli | Discord Bot | Discord UI |
|
|
221
|
+
|---------|-------------|-------------|------------|
|
|
222
|
+
| Headless/CLI | Yes | No (persistent process) | No |
|
|
223
|
+
| JSON output | Yes (default) | Custom code needed | No |
|
|
224
|
+
| AI agent compatible | Yes | Requires custom integration | No |
|
|
225
|
+
| Bulk operations | Yes | Custom code needed | Limited |
|
|
226
|
+
| Scriptable | Yes (shell/python) | Requires bot framework | No |
|
|
227
|
+
| Persistent process | No | Yes | N/A |
|
|
228
|
+
| Setup time | 2 minutes | 30+ minutes | Instant |
|
|
229
|
+
|
|
230
|
+
## Contributing
|
|
231
|
+
|
|
232
|
+
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
233
|
+
|
|
234
|
+
1. Fork the repository
|
|
235
|
+
2. Create a feature branch (`git checkout -b feat/amazing-feature`)
|
|
236
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
|
|
237
|
+
4. Push to the branch (`git push origin feat/amazing-feature`)
|
|
238
|
+
5. Open a Pull Request
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
|
|
243
|
+
|
|
244
|
+
## Links
|
|
245
|
+
|
|
246
|
+
- [GitHub Repository](https://github.com/1solomonwakhungu/discord-cli)
|
|
247
|
+
- [Issue Tracker](https://github.com/1solomonwakhungu/discord-cli/issues)
|
|
248
|
+
- [PyPI Package](https://pypi.org/project/discord-cli/)
|