43 lines
1.7 KiB
JavaScript
43 lines
1.7 KiB
JavaScript
|
const { MessageEmbed } = require('discord.js');
|
||
|
const Discord = require('discord.js');
|
||
|
const client = new Discord.Client()
|
||
|
module.exports = {
|
||
|
name: 'eval',
|
||
|
category: 'owner',
|
||
|
run: async (client, message, args) => {
|
||
|
if (message.author.id !== '612686200318459914') return message.channel.send("Sie haben keine Berechtigung, diesen Befehl zu verwenden!");
|
||
|
const embed = new MessageEmbed()
|
||
|
.setTitle('Auswerten...')
|
||
|
const msg = await message.channel.send(embed);
|
||
|
try {
|
||
|
const data = eval(args.join(' ').replace(/```/g, ''));
|
||
|
const embed = new MessageEmbed()
|
||
|
.setTitle('output:')
|
||
|
.setDescription(await data)
|
||
|
.setColor('GREEN')
|
||
|
await msg.edit(embed)
|
||
|
await msg.react('✅')
|
||
|
await msg.react('❌')
|
||
|
const filter = (reaction, user) => (reaction.emoji.name === '❌' || reaction.emoji.name === '✅') && (user.id === message.author.id);
|
||
|
msg.awaitReactions(filter, { max: 1 })
|
||
|
.then((collected) => {
|
||
|
collected.map((emoji) => {
|
||
|
switch (emoji._emoji.name) {
|
||
|
case '✅':
|
||
|
msg.reactions.removeAll();
|
||
|
break;
|
||
|
case '❌':
|
||
|
msg.delete()
|
||
|
break;
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
} catch (e) {
|
||
|
const embed = new MessageEmbed()
|
||
|
.setTitle('error')
|
||
|
.setDescription(e)
|
||
|
.setColor("#FF0000")
|
||
|
return await msg.edit(embed);
|
||
|
}
|
||
|
}
|
||
|
}
|