seyfert/README.md
2023-06-05 01:32:15 -05:00

2.5 KiB

biscuit

A brand new bleeding edge non bloated Discord library

biscuit

Install (for node18)

npm install @biscuitland/core
yarn add @biscuitland/core

for further reading join our Discord

Most importantly, biscuit is:

  • A wrapper to interface the Discord API
  • A bleeding edge library

Biscuit is primarily inspired by Discord.js and Discordeno but it does not include a cache layer by default, we believe that you should not make software that does things it is not supposed to do.

Why biscuit?:

  • Minimal, non feature-rich!
  • Scalable

Example bot (TS/JS)

import { Session } from '@biscuitland/core';
import { GatewayIntentBits, InteractionType, InteractionResponseType } from '@biscuitland/common';

const session = new Session({
    intents: GatewayIntentBits,
    token: 'your token goes here'
});

const commands = [{
    name: 'ping',
    description: 'Replies with pong!'
}];

session.on('READY', (payload) => {
    const username = payload.user.username;
    console.log('I'm ready! logged in as %s', username);

    const [shardId, _shardCount] = payload.shard ?? [0, 0];

    if (shardId === 0) session.managers.application.bulkCommands(session.applicationId!, commands);
});

session.on('INTERACTION_CREATE', (interaction) => {
    if (interaction.type !== InteractionType.ApplicationCommand) return;
    session.api.managers.interaction.reply(interaction.id, interaction.token, {
        body: {
            type: InteractionResponseType.ChannelMessageWithSource,
            data: { content: 'pong!' }
        }
    });
});

session.start();

Known issues:

  • node18 is required to run the library, however --experimental-fetch flag should work on node16+
  • redis cache (wip)
  • no optimal way to deliver a webspec bun version to the registry (#50)