Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apacheli/whirlybird
A JavaScript library for making Discord bots.
https://github.com/apacheli/whirlybird
bot bun discord discord-api discord-bot javascript typescript
Last synced: 6 days ago
JSON representation
A JavaScript library for making Discord bots.
- Host: GitHub
- URL: https://github.com/apacheli/whirlybird
- Owner: apacheli
- License: other
- Created: 2024-06-21T19:37:27.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-07-03T22:04:33.000Z (4 months ago)
- Last Synced: 2024-10-20T14:26:28.095Z (17 days ago)
- Topics: bot, bun, discord, discord-api, discord-bot, javascript, typescript
- Language: JavaScript
- Homepage: https://apache.li/whirlybird
- Size: 38.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# whirlybird
A JavaScript library for making Discord bots.
## Core
- [`whirlybird/bot`](core/bot)
- [`whirlybird/cache`](core/cache)
- [`whirlybird/gateway`](core/gateway)
- [`whirlybird/interactions`](core/interactions)
- [`whirlybird/rest`](core/rest)
- [`whirlybird/util`](core/util)## Install
Using Bun v1.1.15 (recommended):
```sh
$ bun install https://github.com/apacheli/whirlybird
```Using Deno v1.44.4:
```js
import * as whirlybird from "https://github.com/apacheli/whirlybird/raw/dev/core/lib.js";
```Using Node.js v22.3.0:
```sh
$ npm i https://github.com/apacheli/whirlybird
```## Example
```js
import { CacheClient, GatewayClient, IntentFlags, RestClient } from "whirlybird";const token = `Bot ${process.env.BOT_TOKEN}`;
const cache = new CacheClient();
const rest = new RestClient(token);const handleEvent = (event, data) => {
cache.handleEvent(event, data);switch (event) {
case "MESSAGE_CREATE": {
if (data.content === "!ping") {
rest.createMessage(data.channel_id, {
data: {
content: "Pong!",
},
});
}
break;
}
}
};const gateway = new GatewayClient(token, {
handleEvent,
identify: {
intents: IntentFlags.GUILD_MESSAGES | IntentFlags.MESSAGE_CONTENT,
},
token,
url: "wss://gateway.discord.gg",
});gateway.connect();
```