Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zomoxyz/discordslash


https://github.com/zomoxyz/discordslash

Last synced: 13 days ago
JSON representation

Awesome Lists containing this project

README

        

# discordslash

Discord Application Commands made easy

## usage

run `npm run buildexample ` to compile example(s)

`examples/main.ts`

```ts
import { Client, CommandInteraction, Intents } from 'discord.js';
import { addCommand, CommandGenerator, CommandOptionGenerator, initClient } from '../';

const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

initClient(client);

addCommand([
new CommandGenerator()
.setName('ping')
.setDescription('ping me')
.setRun((interaction: CommandInteraction) =>
interaction.reply('pong')),

new CommandGenerator()
.setName('8ball')
.setDescription('ask the magic 8ball a question')
.addOption('question', 'string', 'question to ask the 8ball', true)
.setRun(EightBall)
]);

client.login(TOKEN);
```

## TODO

- quick option functions
- non global commmands