This commit is contained in:
ItzEmerald committed 2021-10-29 19:12:11 +01:00
1 parent 2f0ddcec3f
commit 4cd3ecf81f
27 files changed
+249 -150

No files matched your search

+7 -4
View File
@@ -5,8 +5,10 @@ const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Event = require("../Structures/Event.js");
@@ -55,7 +57,7 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
}
if (interaction.customId === "ticketclose") {
if (interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
if (interaction.channel.name.startsWith(`${supportbot.TicketPrefix}`)) {
interaction.message.fetch();
interaction.deferUpdate();
const DeleteTicketEmbed = new Discord.MessageEmbed()
@@ -92,6 +94,7 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
msgs = msgs.sort(
(a, b) => a.createdTimestamp - b.createdTimestamp
);
html += `<style>* {background-color: #2c2f33;color: #fff;font-family: Arial, Helvetica, sans-serif;}</style>`;
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`;
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
@@ -124,7 +127,7 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
}
}
if (interaction.customId === "ticketlock") {
if (interaction.channel.name.startsWith(`${supportbot.TicketChannel}`)) {
if (interaction.channel.name.startsWith(`${supportbot.TicketPrefix}`)) {
interaction.message.fetch();
interaction.deferUpdate();
let Admin =
-43
View File
@@ -1,43 +0,0 @@
// SupportBot | Emerald Services
// Ready Event
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
const panelconfig = yaml.load(
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
);
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);
}
}
}
}
});
+11 -6
View File
@@ -5,9 +5,11 @@ const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const panelconfig = yaml.load(
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
fs.readFileSync("./Configs/ticket-panel.yml", "utf8")
);
const Event = require("../Structures/Event.js");
@@ -77,8 +79,8 @@ module.exports = new Event("ready", (client) => {
return false;
}
const panelid = yaml.load(
fs.readFileSync("./Data/ticket-panel-id.yml", "utf8")
const panelid = JSON.parse(
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
);
chan1.messages.fetch(panelid.TicketPanelID).catch(async (r) => {
@@ -115,8 +117,11 @@ module.exports = new Event("ready", (client) => {
let data = {
TicketPanelID: `${r.id}`,
};
let yamlStr = yaml.dump(data);
fs.writeFileSync("./Data/ticket-panel-id.yml", yamlStr, "utf8");
fs.writeFileSync(
"./Data/ticket-panel-id.json",
JSON.stringify(data),
"utf8"
);
})
.catch((e) => {
console.log("Raw" + e);