Skip to content

frostzzone/discord-sync-commands

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Sync Commands

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('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');

About

Easily keep your bot's slash commands synchronized with Discord

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%