Skip to content

Instantly share code, notes, and snippets.

@sell
Created August 24, 2020 05:25
Show Gist options
  • Save sell/bff7b542b98c6497889b8527fc21d254 to your computer and use it in GitHub Desktop.
Save sell/bff7b542b98c6497889b8527fc21d254 to your computer and use it in GitHub Desktop.
eval command discord.js
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);
}
}
}
@amogus38
Copy link

Doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment