Created
August 24, 2020 05:25
-
-
Save sell/bff7b542b98c6497889b8527fc21d254 to your computer and use it in GitHub Desktop.
eval command discord.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { MessageEmbed } = require('discord.js'); | |
module.exports = { | |
name: 'eval', | |
run: async (client, message, args) => { | |
if (message.author.id !== '737794159167012905') return | |
const embed = new MessageEmbed() | |
.setTitle('Evaluating...') | |
const msg = await message.channel.send(embed) | |
try { | |
const data = eval(args.join(' ').replace(/```/g, '')) | |
const embed = new MessageEmbed() | |
.setTitle('Eval Command') | |
.setDescription(await data) | |
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((emojis) => { | |
switch (emojis._emoji.name) { | |
case '✅': | |
msg.reactions.removeAll() | |
break; | |
case '❌': | |
msg.delete() | |
break; | |
} | |
}) | |
}) | |
} catch (error) { | |
const embed = new MessageEmbed() | |
.setTitle('An Error occured'); | |
console.error(error); | |
return await msg.edit(embed); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't work