0.3.0 ā€¢ Published 2 years ago

@frostzzone/discord-sync-commands v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Discord Sync Commands

kinda a fix to Androz2019's package

Easily keep your bot's slash commands synchronized with Discord! šŸ”

Features

āš” No useless calls to the Discord API!
ā— Auto detection of changes in your commands!
šŸ¤Ÿ Super easy to use!

Example

const Discord = require('discord.js');
const client = new Discord.Client({
    intents: []
});

const synchronizeSlashCommands = require('@frostzzone/discord-sync-commands');
synchronizeSlashCommands(client, [
    {
        name: 'ping',
        description: 'Check whether the bot is working'
    }
], {
    debug: true,
    guildId: '558328638911545423' // remove this property to use global commands
});

client.on('ready', () => {
    console.log('Ready!');
});

client.on('interactionCreate', (interaction) => {

    if (!interaction.isCommand()) return;

    if (interaction.commandName === 'ping') {
        interaction.reply('Pong!');
    }

});

client.login('token');