droff-commands
v0.8.15
Published
Command helpers for the droff discord client
Downloads
34
Readme
droff-commands
Accompanying library to droff
for creating message based commands.
It uses lexure for parsing commands.
- API documentation: https://tim-smart.github.io/droff/droff-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();