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,
|
2021-02-02 17:52:07 +00:00
|
|
|
content: "N/A",
|
2021-02-02 13:50:53 +00:00
|
|
|
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 {
|
2021-02-13 16:25:28 +00:00
|
|
|
const cmd = client.commands.get(supportbot.NewTicket);
|
2021-02-02 16:07:28 +00:00
|
|
|
if(!cmd) return;
|
|
|
|
|
|
2021-02-02 17:56:13 +00:00
|
|
|
cmd.execute(message, message.content);
|
2021-02-02 16:07:28 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
console.error(error);
|
|
|
|
|
}
|
2021-02-02 13:50:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-18 13:46:16 +00:00
|
|
|
};
|