Warning
whirlybird is experimental software. I would advise against using whirlybird for production for now.
A JavaScript library for making Discord bots.
- Works on any JavaScript runtime that supports Web APIs.
- The most performant and fastest library for making bots.
- Complete low-level control over your application.
- Includes high-level utilities for ease-of-use.
whirlybird/cache
whirlybird/cli
whirlybird/client
whirlybird/commands
whirlybird/gateway
whirlybird/interactions
whirlybird/rest
whirlybird/util
whirlybird/voice
Want to participate in the development of whirlybird? Come chat with us!
Issues and pull requests are also welcomed.
If you want to run the test script on your machine:
Fork the repository:
$ git clone https://github.com/apacheli/whirlybird
Move to the directory:
$ cd whirlybird
Run the test script:
$ bun start
Make sure to set environment variables for $BOT_TOKEN
and $DEVELOPER_ID
.
Using Bun (recommended) 1.x.x or higher:
$ bun add https://github.com/apacheli/whirlybird
Using Deno 1.41.x or higher:
import * as whirlybird from "https://raw.githubusercontent.com/apacheli/whirlybird/master/core/lib.js";
Using import maps:
{
"imports": {
"whirlybird": "https://raw.githubusercontent.com/apacheli/whirlybird/master/core/lib.js"
}
}
Using Node.js 22.x.x or higher:
$ npm i https://github.com/apacheli/whirlybird
Note
You can install ws
and node-fetch
on older versions of Node.js. I do not recommend this option. You should just update your Node.js version or use Bun.
You can also clone the repository and use it as is:
$ git clone https://github.com/apacheli/whirlybird
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 = async (event, data) => {
cache.handleEvent(event, data);
switch (event) {
case "MESSAGE_CREATE": {
if (data.content === "===ping") {
await rest.createMessage(data.channel_id, {
body: {
content: "Hello, World!",
},
});
}
break;
}
}
};
const gateway = new GatewayClient(token, {
handleEvent,
identifyOptions: {
intents: IntentFlags.GUILD_MESSAGES | IntentFlags.MESSAGE_CONTENT,
},
shards: 1,
url: "wss://gateway.discord.gg",
});
gateway.connect();
More details regarding core modules can be found in their respective READMEs.
Need help? Find me at the whirlybird development server.
© 2024-present apacheli