droff-commands
TypeScript icon, indicating that this package has built-in type declarations

0.8.15 • Public • Published

droff-commands

Accompanying library to droff for creating message based commands.

It uses lexure for parsing commands.

Usage

import { createClient, Intents } from "droff";
import * as Commands from "droff-commands";
import * as Rx from "rxjs";
import * as RxO from "rxjs/operators";

const client = createClient({
  token: process.env.DISCORD_BOT_TOKEN!,
  gateway: {
    intents: Intents.GUILD_MESSAGES,
  },
});

const command$ = Commands.create(client)("!");

const ping$ = command$({ name: "ping" }).pipe(
  RxO.flatMap(({ reply }) => reply({ content: "Pong!" })),
);

// Subscribe
Rx.merge(client.effects$, ping$).subscribe();

/droff-commands/

    Package Sidebar

    Install

    npm i droff-commands

    Weekly Downloads

    98

    Version

    0.8.15

    License

    MIT

    Unpacked Size

    6.97 kB

    Total Files

    4

    Last publish

    Collaborators

    • tim-smart