2022-04-21 20:53:03 -05:00
|
|
|
const { Constants } = require('discord.js');
|
|
|
|
|
2022-04-21 18:09:21 -05:00
|
|
|
const { inspect } = require('util');
|
2022-04-18 11:25:40 -05:00
|
|
|
|
2021-01-19 14:02:09 -06:00
|
|
|
module.exports = {
|
2021-01-23 01:08:05 -06:00
|
|
|
|
2022-04-21 18:09:21 -05:00
|
|
|
name: require('path').parse(__filename).name,
|
|
|
|
description: 'Executes JS code',
|
2022-04-21 20:53:03 -05:00
|
|
|
options: [{
|
|
|
|
name: 'text',
|
|
|
|
description: 'The string to evaluate',
|
|
|
|
required: true,
|
|
|
|
type: Constants.ApplicationCommandOptionTypes.STRING
|
|
|
|
}],
|
2022-04-18 11:25:40 -05:00
|
|
|
|
2022-04-21 18:09:21 -05:00
|
|
|
async execute (_, message, args, config) {
|
|
|
|
if (message.author.id === config.ownerID) {
|
2022-03-26 03:33:18 -05:00
|
|
|
try {
|
2022-04-21 18:09:21 -05:00
|
|
|
const code = args.join(' ');
|
2022-03-26 03:33:18 -05:00
|
|
|
const evaled = inspect(eval(code));
|
2022-04-21 18:09:21 -05:00
|
|
|
await message.channel.send(evaled, { code: 'xl' });
|
2022-03-26 03:33:18 -05:00
|
|
|
} catch (error) {
|
2022-04-21 18:09:21 -05:00
|
|
|
await message.channel.send({
|
|
|
|
embeds: [{
|
|
|
|
title: '<:AnitroxError:809651936563429416> **Something went wrong! **',
|
|
|
|
color: 13632027,
|
|
|
|
footer: {
|
|
|
|
icon_url: message.author.displayAvatarURL(),
|
|
|
|
text: config.footerTxt
|
2022-03-26 03:33:18 -05:00
|
|
|
},
|
2022-04-21 18:09:21 -05:00
|
|
|
fields: [
|
|
|
|
{
|
|
|
|
name: '**What Happened?**',
|
|
|
|
value: 'The command you tried to run failed to execute due to an error.'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Error Info',
|
|
|
|
value: error.message
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}]
|
|
|
|
});
|
2022-03-26 03:33:18 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2022-04-21 18:09:21 -05:00
|
|
|
};
|