@chirp-dev/chirp-sdk 1.0.2
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 +57 -0
- package/dist/index.d.ts +891 -0
- package/dist/index.js +1402 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @chirp-dev/chirp-sdk
|
|
2
|
+
|
|
3
|
+
Official SDK for building Chirp bots. Simplifies bot creation with built-in WebSocket connection, command registration, event handling, and REST API calls.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 Simple API - Create a bot in ~5 lines of code
|
|
8
|
+
- 🔌 Auto-reconnecting WebSocket connection
|
|
9
|
+
- 📝 Fluent command builder or simple object registration
|
|
10
|
+
- 🎯 Type-safe event handling with TypeScript
|
|
11
|
+
- 🔑 Built-in REST API client
|
|
12
|
+
- 📦 Manager classes for Servers, Channels, and Messages
|
|
13
|
+
- 🔄 Automatic caching and state management
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @chirp-dev/chirp-sdk socket.io-client
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { ChirpClient, CommandBuilder } from '@chirp-dev/chirp-sdk';
|
|
25
|
+
|
|
26
|
+
const client = new ChirpClient();
|
|
27
|
+
|
|
28
|
+
client.commands.register(
|
|
29
|
+
new CommandBuilder()
|
|
30
|
+
.setName('ping')
|
|
31
|
+
.setDescription('Check bot latency')
|
|
32
|
+
.setHandler(async (ctx) => {
|
|
33
|
+
await ctx.reply('Pong!');
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
await client.login(process.env.CHIRP_BOT_TOKEN);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Environment Variables
|
|
41
|
+
|
|
42
|
+
| Variable | Description | Default |
|
|
43
|
+
|----------|-------------|---------|
|
|
44
|
+
| `CHIRP_BOT_TOKEN` | Your bot token from Chirp settings | Required |
|
|
45
|
+
| `CHIRP_WS_URL` | WebSocket URL for Chirp server | `ws://localhost:3001` |
|
|
46
|
+
|
|
47
|
+
## Examples
|
|
48
|
+
|
|
49
|
+
See the `/examples` directory for complete bot examples:
|
|
50
|
+
|
|
51
|
+
- `basic-bot.ts` - Minimal ping/echo bot
|
|
52
|
+
- `commands-bot.ts` - Full-featured command system
|
|
53
|
+
- `event-handling-bot.ts` - All event types demonstrated
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|