dc
droff-commands
npm i droff-commands
dc

droff-commands

Simple Discord client powered by RxJS and Axios

by Tim

0.8.12 (see all)License:MITTypeScript:Built-In
npm i droff-commands
Readme

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();
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate