thaldrin/DiscordEvents/messageReactionAdd.js

40 lines
1002 B
JavaScript
Raw Normal View History

2019-10-09 16:19:30 +00:00
const p = require('phin').defaults({
2019-11-10 08:42:09 +00:00
method: 'POST',
parse: 'json'
2019-10-09 16:19:30 +00:00
});
2019-11-10 08:42:09 +00:00
const hastebin = require('hastebin-gen');
2019-10-09 16:19:30 +00:00
module.exports = {
2019-11-10 08:42:09 +00:00
name: 'messageReactionAdd',
run: async (client, reaction, user) => {
if (user.bot) return;
if (user.id !== '318044130796109825') return;
if (reaction.emoji.name == '📥') {
let haste;
try {
if (!client.lastEval) {
await reaction.message.edit(`\`Unable to upload uncached eval results\``);
await reaction.message.reactions.removeAll();
} else {
hastebin(`${client.lastEval || `Last eval resuts weren't cached`}`, { extension: 'js' })
.then(async (h) => {
await reaction.message.edit(`<${h}>`);
await reaction.message.reactions.removeAll();
})
.catch((error) => {
// Handle error
console.error(error);
});
}
} catch (err) {
console.error(err);
}
}
2019-10-09 16:19:30 +00:00
2019-11-10 08:42:09 +00:00
if (reaction.emoji.name == '🗑') {
try {
await reaction.message.delete();
} catch (err) {}
}
}
};