cord-bot 1.1.2 → 1.1.3
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.
- package/README.md +7 -1
- package/bin/cord.ts +25 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ cord start
|
|
|
55
55
|
5. Click **Reset Token** → Copy the token (this is your `DISCORD_BOT_TOKEN`)
|
|
56
56
|
6. Go to **OAuth2** → **URL Generator**:
|
|
57
57
|
- Scopes: `bot`
|
|
58
|
-
- Bot Permissions: `Send Messages`, `Create Public Threads`, `Send Messages in Threads`, `Read Message History`
|
|
58
|
+
- Bot Permissions: `Send Messages`, `Create Public Threads`, `Send Messages in Threads`, `Read Message History`, `Add Reactions`
|
|
59
59
|
7. Copy the generated URL → Open in browser → Invite bot to your server
|
|
60
60
|
|
|
61
61
|
**Note:** This runs 100% locally. The bot connects *outbound* to Discord's gateway - no need to expose ports or use ngrok.
|
|
@@ -99,10 +99,16 @@ cord reply <channel> <msgId> "reply" # Reply to message
|
|
|
99
99
|
cord react <channel> <msgId> "emoji" # Add reaction
|
|
100
100
|
cord thread <channel> <msgId> "name" # Create thread
|
|
101
101
|
cord rename <threadId> "new name" # Rename thread
|
|
102
|
+
cord state <channel> <msgId> done # Update status (processing, done, error, etc.)
|
|
103
|
+
cord health # Check bot connection status
|
|
102
104
|
```
|
|
103
105
|
|
|
104
106
|
See [skills/cord/SKILL.md](./skills/cord/SKILL.md) for full CLI documentation.
|
|
105
107
|
|
|
108
|
+
## Auto-Complete Threads
|
|
109
|
+
|
|
110
|
+
When a user adds a ✅ reaction to the **last message** in a thread, Cord automatically updates the thread starter to "✅ Done". This provides a quick way to signal "conversation complete" without explicit commands.
|
|
111
|
+
|
|
106
112
|
## HTTP API
|
|
107
113
|
|
|
108
114
|
Cord also exposes an HTTP API on port 2643 for external scripts and webhooks.
|
package/bin/cord.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* cord start - Start bot and worker
|
|
7
7
|
* cord stop - Stop all processes
|
|
8
8
|
* cord status - Show running status
|
|
9
|
+
* cord health - Check Discord connection
|
|
9
10
|
* cord setup - Interactive setup wizard
|
|
10
11
|
*
|
|
11
12
|
* Discord Commands:
|
|
@@ -580,6 +581,26 @@ function isProcessRunning(pid: number): boolean {
|
|
|
580
581
|
}
|
|
581
582
|
}
|
|
582
583
|
|
|
584
|
+
async function health() {
|
|
585
|
+
try {
|
|
586
|
+
const response = await fetch(`${API_BASE}/health`);
|
|
587
|
+
const data = await response.json() as { status: string; connected: boolean; user: string };
|
|
588
|
+
|
|
589
|
+
if (data.connected) {
|
|
590
|
+
console.log(`✓ Connected as ${data.user}`);
|
|
591
|
+
} else {
|
|
592
|
+
console.log('✗ Bot not connected to Discord');
|
|
593
|
+
}
|
|
594
|
+
} catch (error: any) {
|
|
595
|
+
if (error.code === 'ECONNREFUSED') {
|
|
596
|
+
console.log('✗ Cannot connect to Cord API. Is the bot running? (cord start)');
|
|
597
|
+
} else {
|
|
598
|
+
console.log(`✗ Error: ${error.message}`);
|
|
599
|
+
}
|
|
600
|
+
process.exit(1);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
583
604
|
function showHelp() {
|
|
584
605
|
console.log(`
|
|
585
606
|
Cord - Discord to Claude Code bridge
|
|
@@ -590,6 +611,7 @@ Management Commands:
|
|
|
590
611
|
start Start bot and worker
|
|
591
612
|
stop Stop all processes
|
|
592
613
|
status Show running status
|
|
614
|
+
health Check Discord connection
|
|
593
615
|
setup Interactive setup wizard
|
|
594
616
|
help Show this help
|
|
595
617
|
|
|
@@ -675,6 +697,9 @@ switch (command) {
|
|
|
675
697
|
case 'setup':
|
|
676
698
|
setup();
|
|
677
699
|
break;
|
|
700
|
+
case 'health':
|
|
701
|
+
health();
|
|
702
|
+
break;
|
|
678
703
|
case 'help':
|
|
679
704
|
case '--help':
|
|
680
705
|
case '-h':
|