cord-bot 1.0.2 → 1.0.5

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.
@@ -0,0 +1,273 @@
1
+ # HTTP API Reference
2
+
3
+ Low-level HTTP API for interacting with Discord. For Claude Code, use the CLI commands in [SKILL.md](./SKILL.md) instead.
4
+
5
+ **Port:** `2643` (configurable via `API_PORT` env var)
6
+
7
+ ## Health Check
8
+
9
+ ```bash
10
+ curl http://localhost:2643/health
11
+ # {"status":"ok","connected":true,"user":"MyBot#1234"}
12
+ ```
13
+
14
+ ## send-message
15
+
16
+ Send a text message to a channel or thread.
17
+
18
+ ```bash
19
+ curl -X POST http://localhost:2643/command \
20
+ -H 'Content-Type: application/json' \
21
+ -d '{
22
+ "command": "send-to-thread",
23
+ "args": {
24
+ "thread": "CHANNEL_OR_THREAD_ID",
25
+ "message": "Hello from Cord!"
26
+ }
27
+ }'
28
+ ```
29
+
30
+ ## send-embed
31
+
32
+ Send a formatted embed card with optional fields.
33
+
34
+ ```bash
35
+ curl -X POST http://localhost:2643/command \
36
+ -H 'Content-Type: application/json' \
37
+ -d '{
38
+ "command": "send-to-thread",
39
+ "args": {
40
+ "thread": "CHANNEL_OR_THREAD_ID",
41
+ "embeds": [{
42
+ "title": "Status Report",
43
+ "description": "Daily summary",
44
+ "color": 3447003,
45
+ "fields": [
46
+ {"name": "Tasks", "value": "5 completed", "inline": true},
47
+ {"name": "Emails", "value": "12 processed", "inline": true}
48
+ ],
49
+ "footer": {"text": "Generated by Cord"}
50
+ }]
51
+ }
52
+ }'
53
+ ```
54
+
55
+ **Color reference:**
56
+ - Success/Green: `3066993` (0x2ECC71)
57
+ - Info/Blue: `3447003` (0x3498DB)
58
+ - Warning/Yellow: `16776960` (0xFFFF00)
59
+ - Error/Red: `15158332` (0xE74C3C)
60
+ - Purple: `10181046` (0x9B59B6)
61
+
62
+ ## send-file
63
+
64
+ Attach content as a file (good for long reports).
65
+
66
+ ```bash
67
+ curl -X POST http://localhost:2643/send-with-file \
68
+ -H 'Content-Type: application/json' \
69
+ -d '{
70
+ "channelId": "CHANNEL_OR_THREAD_ID",
71
+ "fileName": "report.md",
72
+ "fileContent": "# Report\n\nContent here...",
73
+ "content": "Here is the detailed report"
74
+ }'
75
+ ```
76
+
77
+ ## send-buttons
78
+
79
+ Send a message with interactive button choices.
80
+
81
+ ```bash
82
+ curl -X POST http://localhost:2643/send-with-buttons \
83
+ -H 'Content-Type: application/json' \
84
+ -d '{
85
+ "channelId": "CHANNEL_OR_THREAD_ID",
86
+ "content": "Choose an option:",
87
+ "buttons": [
88
+ {"label": "Approve", "customId": "approve-123", "style": "success"},
89
+ {"label": "Reject", "customId": "reject-123", "style": "danger"}
90
+ ]
91
+ }'
92
+ ```
93
+
94
+ **Button styles:** `primary`, `secondary`, `success`, `danger`
95
+
96
+ ### Buttons with inline handler
97
+
98
+ Register a handler that fires when the button is clicked.
99
+
100
+ ```bash
101
+ curl -X POST http://localhost:2643/send-with-buttons \
102
+ -H 'Content-Type: application/json' \
103
+ -d '{
104
+ "channelId": "CHANNEL_OR_THREAD_ID",
105
+ "content": "Click for details",
106
+ "buttons": [{
107
+ "label": "Show Details",
108
+ "customId": "details-123",
109
+ "style": "secondary",
110
+ "handler": {
111
+ "type": "inline",
112
+ "content": "Here are the details...",
113
+ "ephemeral": true
114
+ }
115
+ }]
116
+ }'
117
+ ```
118
+
119
+ ### Buttons with webhook handler
120
+
121
+ Call an external URL when clicked.
122
+
123
+ ```bash
124
+ curl -X POST http://localhost:2643/send-with-buttons \
125
+ -H 'Content-Type: application/json' \
126
+ -d '{
127
+ "channelId": "CHANNEL_OR_THREAD_ID",
128
+ "content": "Approve deployment?",
129
+ "buttons": [{
130
+ "label": "Deploy",
131
+ "customId": "deploy-prod",
132
+ "style": "success",
133
+ "handler": {
134
+ "type": "webhook",
135
+ "url": "http://localhost:8080/deploy",
136
+ "data": {"env": "production"}
137
+ }
138
+ }]
139
+ }'
140
+ ```
141
+
142
+ ## typing
143
+
144
+ Show typing indicator (useful before slow operations).
145
+
146
+ ```bash
147
+ curl -X POST http://localhost:2643/command \
148
+ -H 'Content-Type: application/json' \
149
+ -d '{
150
+ "command": "start-typing",
151
+ "args": {"channel": "CHANNEL_OR_THREAD_ID"}
152
+ }'
153
+ ```
154
+
155
+ ## edit-message
156
+
157
+ Edit an existing message.
158
+
159
+ ```bash
160
+ curl -X POST http://localhost:2643/command \
161
+ -H 'Content-Type: application/json' \
162
+ -d '{
163
+ "command": "edit-message",
164
+ "args": {
165
+ "channel": "CHANNEL_ID",
166
+ "message": "MESSAGE_ID",
167
+ "content": "Updated content"
168
+ }
169
+ }'
170
+ ```
171
+
172
+ ## delete-message
173
+
174
+ Delete a message.
175
+
176
+ ```bash
177
+ curl -X POST http://localhost:2643/command \
178
+ -H 'Content-Type: application/json' \
179
+ -d '{
180
+ "command": "delete-message",
181
+ "args": {
182
+ "channel": "CHANNEL_ID",
183
+ "message": "MESSAGE_ID"
184
+ }
185
+ }'
186
+ ```
187
+
188
+ ## rename-thread
189
+
190
+ Rename a thread.
191
+
192
+ ```bash
193
+ curl -X POST http://localhost:2643/command \
194
+ -H 'Content-Type: application/json' \
195
+ -d '{
196
+ "command": "rename-thread",
197
+ "args": {
198
+ "thread": "THREAD_ID",
199
+ "name": "New Thread Name"
200
+ }
201
+ }'
202
+ ```
203
+
204
+ ## reply-to-message
205
+
206
+ Reply to a specific message (shows reply preview).
207
+
208
+ ```bash
209
+ curl -X POST http://localhost:2643/command \
210
+ -H 'Content-Type: application/json' \
211
+ -d '{
212
+ "command": "reply-to-message",
213
+ "args": {
214
+ "channel": "CHANNEL_ID",
215
+ "message": "MESSAGE_ID",
216
+ "content": "This is a reply"
217
+ }
218
+ }'
219
+ ```
220
+
221
+ ## create-thread
222
+
223
+ Create a thread from a message.
224
+
225
+ ```bash
226
+ curl -X POST http://localhost:2643/command \
227
+ -H 'Content-Type: application/json' \
228
+ -d '{
229
+ "command": "create-thread",
230
+ "args": {
231
+ "channel": "CHANNEL_ID",
232
+ "message": "MESSAGE_ID",
233
+ "name": "Thread Name"
234
+ }
235
+ }'
236
+ ```
237
+
238
+ ## add-reaction
239
+
240
+ Add a reaction to a message.
241
+
242
+ ```bash
243
+ curl -X POST http://localhost:2643/command \
244
+ -H 'Content-Type: application/json' \
245
+ -d '{
246
+ "command": "add-reaction",
247
+ "args": {
248
+ "channel": "CHANNEL_ID",
249
+ "message": "MESSAGE_ID",
250
+ "emoji": "👍"
251
+ }
252
+ }'
253
+ ```
254
+
255
+ ## Response Format
256
+
257
+ All endpoints return JSON:
258
+
259
+ ```json
260
+ {"success": true, "messageId": "1234567890"}
261
+ ```
262
+
263
+ On error:
264
+
265
+ ```json
266
+ {"error": "Description of what went wrong"}
267
+ ```
268
+
269
+ ## Environment Variables
270
+
271
+ | Variable | Default | Description |
272
+ |----------|---------|-------------|
273
+ | `API_PORT` | `2643` | HTTP API server port |
@@ -0,0 +1,304 @@
1
+ ---
2
+ name: cord
3
+ description: Send messages, embeds, files, and interactive buttons to Discord via the Cord CLI. Use for notifications, reports, interactive choices, and dynamic Discord interactions.
4
+ triggers:
5
+ - "send to discord"
6
+ - "post to discord"
7
+ - "discord message"
8
+ - "notify discord"
9
+ ---
10
+
11
+ # Cord - Discord Bridge Skill
12
+
13
+ Interact with Discord through Cord's CLI commands. This skill teaches Claude Code how to send messages, embeds, files, and interactive buttons.
14
+
15
+ **GitHub:** https://github.com/alexknowshtml/cord
16
+
17
+ ## Setup
18
+
19
+ Ensure Cord is running:
20
+ ```bash
21
+ cord start
22
+ ```
23
+
24
+ Verify it's connected:
25
+ ```bash
26
+ curl -s http://localhost:2643/health
27
+ # {"status":"ok","connected":true,"user":"MyBot#1234"}
28
+ ```
29
+
30
+ ---
31
+
32
+ ## CLI Commands
33
+
34
+ ### send
35
+
36
+ Send a text message to a channel or thread.
37
+
38
+ ```bash
39
+ cord send <channel> "message"
40
+ ```
41
+
42
+ **Example:**
43
+ ```bash
44
+ cord send 123456789 "Hello world!"
45
+ ```
46
+
47
+ ---
48
+
49
+ ### embed
50
+
51
+ Send a formatted embed card with optional styling.
52
+
53
+ ```bash
54
+ cord embed <channel> "description" [options]
55
+ ```
56
+
57
+ **Options:**
58
+ | Flag | Description |
59
+ |------|-------------|
60
+ | `--title "..."` | Embed title |
61
+ | `--url "..."` | Title link URL |
62
+ | `--color <name\|hex>` | red, green, blue, yellow, purple, orange, or 0xHEX |
63
+ | `--author "..."` | Author name |
64
+ | `--author-url "..."` | Author link |
65
+ | `--author-icon "..."` | Author icon URL |
66
+ | `--thumbnail "..."` | Small image (top right) |
67
+ | `--image "..."` | Large image (bottom) |
68
+ | `--footer "..."` | Footer text |
69
+ | `--footer-icon "..."` | Footer icon URL |
70
+ | `--timestamp` | Add current timestamp |
71
+ | `--field "Name:Value"` | Add field (append `:inline` for inline) |
72
+
73
+ **Examples:**
74
+
75
+ Simple embed:
76
+ ```bash
77
+ cord embed 123456789 "Daily status update" --title "Status Report" --color green
78
+ ```
79
+
80
+ Embed with fields:
81
+ ```bash
82
+ cord embed 123456789 "Build completed successfully" \
83
+ --title "CI/CD Pipeline" \
84
+ --color green \
85
+ --field "Branch:main:inline" \
86
+ --field "Duration:2m 34s:inline" \
87
+ --field "Tests:142 passed" \
88
+ --footer "Deployed by Cord" \
89
+ --timestamp
90
+ ```
91
+
92
+ ---
93
+
94
+ ### file
95
+
96
+ Send a file attachment.
97
+
98
+ ```bash
99
+ cord file <channel> <filepath> ["message"]
100
+ ```
101
+
102
+ **Examples:**
103
+ ```bash
104
+ cord file 123456789 ./report.md "Here's the weekly report"
105
+ cord file 123456789 ./logs.txt
106
+ ```
107
+
108
+ ---
109
+
110
+ ### buttons
111
+
112
+ Send interactive buttons with optional handlers.
113
+
114
+ ```bash
115
+ cord buttons <channel> "prompt" --button label="..." id="..." [options]
116
+ ```
117
+
118
+ **Button options:**
119
+ | Option | Description |
120
+ |--------|-------------|
121
+ | `label="..."` | Button text (required) |
122
+ | `id="..."` | Custom ID for tracking (required) |
123
+ | `style="..."` | primary, secondary, success, danger |
124
+ | `reply="..."` | Ephemeral reply when clicked |
125
+ | `webhook="..."` | URL to POST click data to |
126
+
127
+ **Examples:**
128
+
129
+ Simple confirmation:
130
+ ```bash
131
+ cord buttons 123456789 "Deploy to production?" \
132
+ --button label="Deploy" id="deploy-prod" style="success" \
133
+ --button label="Cancel" id="cancel-deploy" style="secondary"
134
+ ```
135
+
136
+ With inline responses:
137
+ ```bash
138
+ cord buttons 123456789 "Approve this PR?" \
139
+ --button label="Approve" id="approve" style="success" reply="Approved! Merging now." \
140
+ --button label="Reject" id="reject" style="danger" reply="Rejected. Please revise."
141
+ ```
142
+
143
+ With webhook callback:
144
+ ```bash
145
+ cord buttons 123456789 "Start backup?" \
146
+ --button label="Start Backup" id="backup-start" style="primary" webhook="http://localhost:8080/backup"
147
+ ```
148
+
149
+ ---
150
+
151
+ ### typing
152
+
153
+ Show typing indicator (useful before slow operations).
154
+
155
+ ```bash
156
+ cord typing <channel>
157
+ ```
158
+
159
+ ---
160
+
161
+ ### edit
162
+
163
+ Edit an existing message.
164
+
165
+ ```bash
166
+ cord edit <channel> <messageId> "new content"
167
+ ```
168
+
169
+ ---
170
+
171
+ ### delete
172
+
173
+ Delete a message.
174
+
175
+ ```bash
176
+ cord delete <channel> <messageId>
177
+ ```
178
+
179
+ ---
180
+
181
+ ### rename
182
+
183
+ Rename a thread.
184
+
185
+ ```bash
186
+ cord rename <threadId> "new name"
187
+ ```
188
+
189
+ ---
190
+
191
+ ### reply
192
+
193
+ Reply to a specific message (shows reply preview).
194
+
195
+ ```bash
196
+ cord reply <channel> <messageId> "message"
197
+ ```
198
+
199
+ ---
200
+
201
+ ### thread
202
+
203
+ Create a thread from a message.
204
+
205
+ ```bash
206
+ cord thread <channel> <messageId> "thread name"
207
+ ```
208
+
209
+ ---
210
+
211
+ ### react
212
+
213
+ Add a reaction to a message.
214
+
215
+ ```bash
216
+ cord react <channel> <messageId> "emoji"
217
+ ```
218
+
219
+ **Example:**
220
+ ```bash
221
+ cord react 123456789 987654321 "👍"
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Choosing the Right Command
227
+
228
+ | Use Case | Command |
229
+ |----------|---------|
230
+ | Simple notification | `cord send` |
231
+ | Formatted status update | `cord embed` |
232
+ | Long content (logs, reports) | `cord file` |
233
+ | User needs to make a choice | `cord buttons` |
234
+ | Indicate processing | `cord typing` |
235
+ | Update previous message | `cord edit` |
236
+ | Start a focused discussion | `cord thread` |
237
+ | Quick acknowledgment | `cord react` |
238
+
239
+ ---
240
+
241
+ ## Assembly Patterns
242
+
243
+ ### Notification with follow-up options
244
+
245
+ ```bash
246
+ # Send the notification
247
+ cord embed 123456789 "Build failed on main branch" \
248
+ --title "CI Alert" \
249
+ --color red \
250
+ --field "Error:Test suite timeout" \
251
+ --field "Commit:abc1234:inline"
252
+
253
+ # Offer actions
254
+ cord buttons 123456789 "What would you like to do?" \
255
+ --button label="View Logs" id="view-logs" style="primary" reply="Fetching logs..." \
256
+ --button label="Retry Build" id="retry" style="success" webhook="http://ci/retry" \
257
+ --button label="Ignore" id="ignore" style="secondary" reply="Acknowledged"
258
+ ```
259
+
260
+ ### Progress updates
261
+
262
+ ```bash
263
+ # Start with typing indicator
264
+ cord typing 123456789
265
+
266
+ # Send initial status
267
+ MSGID=$(cord send 123456789 "Processing... 0%" | grep -o '[0-9]*$')
268
+
269
+ # Update as progress continues
270
+ cord edit 123456789 $MSGID "Processing... 50%"
271
+ cord edit 123456789 $MSGID "Processing... 100% Complete!"
272
+
273
+ # Add completion reaction
274
+ cord react 123456789 $MSGID "✅"
275
+ ```
276
+
277
+ ### Report delivery
278
+
279
+ ```bash
280
+ # Send summary embed
281
+ cord embed 123456789 "Weekly metrics compiled" \
282
+ --title "Weekly Report Ready" \
283
+ --color blue \
284
+ --field "Period:Jan 15-21:inline" \
285
+ --field "Pages:12:inline"
286
+
287
+ # Attach the full report
288
+ cord file 123456789 ./weekly-report.pdf "Full report attached"
289
+ ```
290
+
291
+ ### Confirmation flow
292
+
293
+ ```bash
294
+ # Ask for confirmation
295
+ cord buttons 123456789 "Delete all archived items older than 30 days?" \
296
+ --button label="Yes, Delete" id="confirm-delete" style="danger" reply="Deleting..." \
297
+ --button label="Cancel" id="cancel-delete" style="secondary" reply="Cancelled"
298
+ ```
299
+
300
+ ---
301
+
302
+ ## HTTP API
303
+
304
+ For advanced use cases (webhooks, external scripts), see [HTTP-API.md](./HTTP-API.md).