0.1.1 • Published 11 months ago

@windowsedcs/discord-user-installable v0.1.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
11 months ago

discord-user-installable

discord-user-installable is a package that contains a builder for creating user-installable compatible slash commands.

This package is a temporary solution to create user-installable slash commands since discord.js currently does not support this.

Install

Install the package from GitHub

installs from main branch
npm install @windowsedcs/discord-user-installable

Example

register multiple commands
// or require('@discordjs/rest')
const { REST, Routes } = require('discord.js');
const { UserSlashCommandBuilder } = require('@windowsedcs/discord-user-installable');

const PING_COMMAND = new UserSlashCommandBuilder()
  .setName('ping')
  .setDescription('Pong!');

const PONG_COMMAND = new UserSlashCommandBuilder()
  .setName('pong')
  .setDescription('Ping!');

const commands = [PING_COMMAND, PONG_COMMAND].map((cmd) => cmd.toJSON());

const rest = new REST().setToken('client-token');

rest
  .put(Routes.applicationCommands('client-id'), {
    body: commands,
  })
  .then(() => console.log('Registered commands'))
  .catch(console.error);
0.1.1

11 months ago

0.1.0

11 months ago