24 lines
645 B
JavaScript
24 lines
645 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
module.exports = {
|
|
name: 'ping',
|
|
description: 'Replies with Pong!',
|
|
execute(interaction) {
|
|
fs.readFile(path.join(__dirname, '../../backend/db.json'), 'utf8', (err, data) => {
|
|
if (err) {
|
|
console.error(err);
|
|
return interaction.reply('An error occurred.');
|
|
}
|
|
const db = JSON.parse(data);
|
|
const settings = db[interaction.guildId] || { pingCommand: false };
|
|
|
|
if (settings.pingCommand) {
|
|
interaction.reply('Pong!');
|
|
} else {
|
|
interaction.reply('The ping command is disabled on this server.');
|
|
}
|
|
});
|
|
},
|
|
};
|