Page cover

discord-debug

A simple discord.js debugging tool

Latest: v2.1.0`` [latest][stable]

Installation

npm i discord-debug@latest

Example Usage

const { Client, GatewayIntentBits } = require('discord.js');
const { Debugger } = require('discord-debug');

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.MessageContent
    ]
});

const debug = new Debugger(client, {
    themeColor: '#00ffff',
    secrets: [process.env.WEBHOOK],
    owners: ['838620835282812969'],
    registerApplicationCommands: true,
    loadDefaultListeners: {
        message: true,
        interaction: true
    },
    sqlConnectionOptions: {
        uri: 'mysql://root:password@localhost:3306/database'
    }
});

client.on('ready', () => console.log(`Logged in as ${client.user.tag}`));

client.on('messageCreate', async (message) => {
    if (message.content === '!ping') {
        return message.reply('pong!');
    } else if (message.content.startsWith('!debug')) {
        const args = message.content.split(' ').slice(1);
        await debug.messageRun(message, args);
    }
});

client.login('token');

Last updated