Files
SupportBot/events/messageReactionAdd.js
T

36 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2020-12-18 13:37:56 +00:00
// SupportBot 6.0, Created by Emerald Services
// Message Reaction Event
const Discord = require("discord.js");
const fs = require("fs");
const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
2021-02-02 13:50:53 +00:00
module.exports = async (client, reaction, user) => {
let message = {
guild: reaction.message.channel.guild,
author: user,
content: "Not available",
channel: reaction.message.channel
}
if (supportbot.ReactionTickets === "true") {
if (reaction.message.id === tickets.ReactionMessage_ID) {
2021-02-02 16:07:28 +00:00
if (reaction.emoji.name == supportbot.ReactionEmoji || reaction.emoji.id == supportbot.ReactionEmoji) {
await reaction.users.remove(user.id)
try {
const cmd = client.commands.get("ticket");
if(!cmd) return;
cmd.execute(message, "undefined");
} catch (error) {
console.error(error);
}
2021-02-02 13:50:53 +00:00
}
}
}
2020-12-18 13:46:16 +00:00
};