@windowsedcs/discord-user-installable
v0.1.1
Published
Represents a Discord User-Installable Command
Downloads
4
Readme
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);