Nicolás Serna 0dc865498c Revert "Fix jsDoc"
This reverts commit c1162d5d1972cb5abb3566dba663822fd1a27911.
2022-07-31 18:51:41 -03:00
..
2022-07-31 18:51:41 -03:00
2022-07-30 22:50:54 -03:00
2022-07-31 02:36:11 -03:00

@biscuitland/core

Classes, functions and main structures to create an application with biscuit. Core contains the essentials to launch you to develop your own customized and scalable bot.

Getting Started

Install (for node18)

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

Example bot

project/index.js:

import { ChatInputApplicationCommandBuilder, Session } from '@biscuitland/core';
import { GatewayIntents } from '@biscuitland/api-types';

const session = new Session({ token: 'your token', intents: GatewayIntents.Guilds });

const commands = [
    new ChatInputApplicationCommandBuilder()
        .setName('ping')
        .setDescription('Replys with pong!')
        .toJSON(),
]

session.events.on('ready', async ({ user }) => {
    console.log('Logged in as:', user.username);
    await session.upsertApplicationCommands(commands, 'GUILD_ID');
});

session.events.on('interactionCreate', (interaction) => {
    if (interaction.isCommand()) {
        if (interaction.commandName === 'ping') {
            interaction.respond({ with: { content: 'pong!' } });
        }
    }
});

session.start();

Execute

For node 18.+:

B:\project> node index.js

For node 16.+:

B:\project> node --experimenta-fetch index.js