2021-10-24 22:48:25 +01:00
|
|
|
// SupportBot | Emerald Services
|
|
|
|
|
// Ready Event
|
|
|
|
|
|
|
|
|
|
const fs = require("fs");
|
|
|
|
|
|
|
|
|
|
const Discord = require("discord.js");
|
|
|
|
|
const yaml = require("js-yaml");
|
2021-10-27 19:30:10 -05:00
|
|
|
const supportbot = yaml.load(
|
|
|
|
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
|
|
|
|
);
|
|
|
|
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
2021-10-24 22:48:25 +01:00
|
|
|
const panelconfig = yaml.load(
|
2021-10-27 19:30:10 -05:00
|
|
|
fs.readFileSync("./Configs/ticket-panel.yml", "utf8")
|
2021-10-24 22:48:25 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const Event = require("../Structures/Event.js");
|
|
|
|
|
|
|
|
|
|
module.exports = new Event("messageReactionAdd", async (client) => {
|
|
|
|
|
let message = {
|
|
|
|
|
guild: reaction.message.channel.guild,
|
|
|
|
|
author: user,
|
|
|
|
|
content: "N/A",
|
|
|
|
|
channel: reaction.message.channel,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (panelconfig.TicketPanel) {
|
|
|
|
|
if (reaction.message.id === panelconfig.TicketPanelID) {
|
|
|
|
|
if (
|
|
|
|
|
reaction.emoji.name == panelconfig.ButtonEmoji ||
|
|
|
|
|
reaction.emoji.id == panelconfig.ButtonEmoji
|
|
|
|
|
) {
|
|
|
|
|
await reaction.users.remove(user.id);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
|
|
|
|
if (!cmd) return;
|
|
|
|
|
|
|
|
|
|
cmd.run(message, message.content);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|