Ran prettier

This commit is contained in:
Noah committed 2021-10-23 20:12:04 -05:00
1 parent b681eb3cd2
commit cf610fbe49
11 files changed
+150 -105

No files matched your search

-1
View File
@@ -11,7 +11,6 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
-2
View File
@@ -33,5 +33,3 @@ CloseTicketDesc: "Close your support ticket."
InfoCommandDesc: "Get information about the brand." InfoCommandDesc: "Get information about the brand."
PingCommandDesc: "Pong!" PingCommandDesc: "Pong!"
HelpCommandDesc: "Get a list of all the commands." HelpCommandDesc: "Get a list of all the commands."
-1
View File
@@ -115,7 +115,6 @@ TicketCreatedAlert: ":ticket: Your support ticket has been created: <#%ticketid%
AddedUser: "👍 <@%user%> has been added to this ticket" AddedUser: "👍 <@%user%> has been added to this ticket"
RemovedUser: "👍 <@%user%> has been removed from this ticket" RemovedUser: "👍 <@%user%> has been removed from this ticket"
# --- Buttons Config --- # --- Buttons Config ---
# --- Start --- # --- Start ---
+1 -1
View File
@@ -1 +1 @@
TicketPanelID: '896035054235574362' TicketPanelID: "896035054235574362"
-1
View File
@@ -39,4 +39,3 @@ TicketPanel_Image: false
PanelMessage: "Click the button to open a new support ticket." PanelMessage: "Click the button to open a new support ticket."
PanelThumbnail: "https://i.imgur.com/ieeZejl.png" PanelThumbnail: "https://i.imgur.com/ieeZejl.png"
PanelImage: "https://i.imgur.com/5NkcmDq.png" PanelImage: "https://i.imgur.com/5NkcmDq.png"
+13 -10
View File
@@ -4,26 +4,30 @@
const fs = require("fs"); const fs = require("fs");
const Discord = require("discord.js"); const Discord = require("discord.js");
const yaml = require('js-yaml'); const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8')); const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
const panelconfig = yaml.load(fs.readFileSync('./Data/ticket-panel.yml', 'utf8')); const panelconfig = yaml.load(
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
);
const Event = require("../Structures/Event.js"); const Event = require("../Structures/Event.js");
module.exports = new Event("messageReactionAdd", async (client) => { module.exports = new Event("messageReactionAdd", async (client) => {
let message = { let message = {
guild: reaction.message.channel.guild, guild: reaction.message.channel.guild,
author: user, author: user,
content: "N/A", content: "N/A",
channel: reaction.message.channel channel: reaction.message.channel,
} };
if (panelconfig.TicketPanel) { if (panelconfig.TicketPanel) {
if (reaction.message.id === panelconfig.TicketPanelID) { if (reaction.message.id === panelconfig.TicketPanelID) {
if (reaction.emoji.name == panelconfig.ButtonEmoji || reaction.emoji.id == panelconfig.ButtonEmoji) { if (
await reaction.users.remove(user.id) reaction.emoji.name == panelconfig.ButtonEmoji ||
reaction.emoji.id == panelconfig.ButtonEmoji
) {
await reaction.users.remove(user.id);
try { try {
const cmd = client.commands.get(cmdconfig.OpenTicket); const cmd = client.commands.get(cmdconfig.OpenTicket);
@@ -36,5 +40,4 @@ module.exports = new Event("messageReactionAdd", async (client) => {
} }
} }
} }
}); });
+2 -3
View File
@@ -5,13 +5,12 @@ const fs = require("fs");
const Discord = require("discord.js"); const Discord = require("discord.js");
const yaml = require('js-yaml'); const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
function RunFunction(client, ...eventArgs) {} function RunFunction(client, ...eventArgs) {}
class Event { class Event {
constructor(event, runFunction) { constructor(event, runFunction) {
this.event = event; this.event = event;
this.run = runFunction; this.run = runFunction;
+37 -23
View File
@@ -8,14 +8,13 @@ const Command = require("./Command.js");
const Client = require("./Client.js"); const Client = require("./Client.js");
const Event = require("./Event.js"); const Event = require("./Event.js");
const yaml = require('js-yaml'); const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
class TicketNumberID { class TicketNumberID {
static pad(guildId) { static pad(guildId) {
let n = this.get(guildId) + ''; let n = this.get(guildId) + "";
let z = '0'; let z = "0";
let width = 4; let width = 4;
setTimeout(() => { setTimeout(() => {
this.set(guildId, this.get(guildId) + 1); this.set(guildId, this.get(guildId) + 1);
@@ -24,50 +23,65 @@ class TicketNumberID {
} }
static get(guildId) { static get(guildId) {
let ticketnumberID = JSON.parse(
let ticketnumberID = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8")); fs.readFileSync("./Data/TicketData.json", "utf8")
);
if (!ticketnumberID[guildId]) { if (!ticketnumberID[guildId]) {
ticketnumberID[guildId] = { ticketnumberID[guildId] = {
id: 0 id: 0,
} };
fs.writeFileSync("./Data/TicketData.json", JSON.stringify(ticketnumberID, null, 4), err => { fs.writeFileSync(
"./Data/TicketData.json",
JSON.stringify(ticketnumberID, null, 4),
(err) => {
if (err) console.log(err); if (err) console.log(err);
}); }
);
return 0; return 0;
} else { } else {
return ticketnumberID[guildId].id; return ticketnumberID[guildId].id;
} }
} }
static set(guildId, value) { static set(guildId, value) {
let ticketnumberID = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8")); let ticketnumberID = JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
);
ticketnumberID[guildId] = { ticketnumberID[guildId] = {
id: value id: value,
} };
fs.writeFileSync("./Data/TicketData.json", JSON.stringify(ticketnumberID, null, 4), err => { fs.writeFileSync(
"./Data/TicketData.json",
JSON.stringify(ticketnumberID, null, 4),
(err) => {
if (err) console.log(err); if (err) console.log(err);
}); }
);
return value; return value;
} }
static reset(guildId) { static reset(guildId) {
let ticketnumberID = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8")); let ticketnumberID = JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
);
ticketnumberID[guildId] = { ticketnumberID[guildId] = {
id: 0 id: 0,
} };
fs.writeFileSync("./Data/TicketData.json", JSON.stringify(ticketnumberID, null, 4), err => { fs.writeFileSync(
"./Data/TicketData.json",
JSON.stringify(ticketnumberID, null, 4),
(err) => {
if (err) console.log(err); if (err) console.log(err);
}); }
);
return 0; return 0;
} }
+13 -10
View File
@@ -4,26 +4,30 @@
const fs = require("fs"); const fs = require("fs");
const Discord = require("discord.js"); const Discord = require("discord.js");
const yaml = require('js-yaml'); const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8')); const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
const panelconfig = yaml.load(fs.readFileSync('./Data/ticket-panel.yml', 'utf8')); const panelconfig = yaml.load(
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
);
const Event = require("../Structures/Event.js"); const Event = require("../Structures/Event.js");
module.exports = new Event("messageReactionAdd", async (client) => { module.exports = new Event("messageReactionAdd", async (client) => {
let message = { let message = {
guild: reaction.message.channel.guild, guild: reaction.message.channel.guild,
author: user, author: user,
content: "N/A", content: "N/A",
channel: reaction.message.channel channel: reaction.message.channel,
} };
if (panelconfig.TicketPanel) { if (panelconfig.TicketPanel) {
if (reaction.message.id === panelconfig.TicketPanelID) { if (reaction.message.id === panelconfig.TicketPanelID) {
if (reaction.emoji.name == panelconfig.ButtonEmoji || reaction.emoji.id == panelconfig.ButtonEmoji) { if (
await reaction.users.remove(user.id) reaction.emoji.name == panelconfig.ButtonEmoji ||
reaction.emoji.id == panelconfig.ButtonEmoji
) {
await reaction.users.remove(user.id);
try { try {
const cmd = client.commands.get(cmdconfig.OpenTicket); const cmd = client.commands.get(cmdconfig.OpenTicket);
@@ -36,5 +40,4 @@ module.exports = new Event("messageReactionAdd", async (client) => {
} }
} }
} }
}); });
+82 -49
View File
@@ -4,90 +4,123 @@
const fs = require("fs"); const fs = require("fs");
const Discord = require("discord.js"); const Discord = require("discord.js");
const yaml = require('js-yaml'); const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
const panelconfig = yaml.load(fs.readFileSync('./Data/ticket-panel.yml', 'utf8')); const panelconfig = yaml.load(
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
);
const Event = require("../Structures/Event.js"); const Event = require("../Structures/Event.js");
module.exports = new Event("ready", client => { module.exports = new Event("ready", (client) => {
client.user.setActivity(supportbot.BotActivity, { client.user.setActivity(supportbot.BotActivity, {
type: supportbot.ActivityType, type: supportbot.ActivityType,
url: supportbot.StreamingURL url: supportbot.StreamingURL,
}); });
console.log(`\u001b[32m`, `┏━━━┓╋╋╋╋╋╋╋╋╋╋╋╋╋┏┓┏━━┓╋╋╋┏┓`) console.log(`\u001b[32m`, `┏━━━┓╋╋╋╋╋╋╋╋╋╋╋╋╋┏┓┏━━┓╋╋╋┏┓`);
console.log(`\u001b[32m`, `┃┏━┓┃╋╋╋╋╋╋╋╋╋╋╋╋┏┛┗┫┏┓┃╋╋┏┛┗┓`) console.log(`\u001b[32m`, `┃┏━┓┃╋╋╋╋╋╋╋╋╋╋╋╋┏┛┗┫┏┓┃╋╋┏┛┗┓`);
console.log(`\u001b[32m`, `┃┗━━┳┓┏┳━━┳━━┳━━┳┻┓┏┫┗┛┗┳━┻┓┏┛`) console.log(`\u001b[32m`, `┃┗━━┳┓┏┳━━┳━━┳━━┳┻┓┏┫┗┛┗┳━┻┓┏┛`);
console.log(`\u001b[32m`, `┗━━┓┃┃┃┃┏┓┃┏┓┃┏┓┃┏┫┃┃┏━┓┃┏┓┃┃`) console.log(`\u001b[32m`, `┗━━┓┃┃┃┃┏┓┃┏┓┃┏┓┃┏┫┃┃┏━┓┃┏┓┃┃`);
console.log(`\u001b[32m`, `┃┗━┛┃┗┛┃┗┛┃┗┛┃┗┛┃┃┃┗┫┗━┛┃┗┛┃┗┓`) console.log(`\u001b[32m`, `┃┗━┛┃┗┛┃┗┛┃┗┛┃┗┛┃┃┃┗┫┗━┛┃┗┛┃┗┓`);
console.log(`\u001b[32m`, `┗━━━┻━━┫┏━┫┏━┻━━┻┛┗━┻━━━┻━━┻━┛`) console.log(`\u001b[32m`, `┗━━━┻━━┫┏━┫┏━┻━━┻┛┗━┻━━━┻━━┻━┛`);
console.log(`\u001b[32m`, `┗╋╋╋╋╋╋╋┃┃╋┃┃`) console.log(`\u001b[32m`, `┗╋╋╋╋╋╋╋┃┃╋┃┃`);
console.log(`\u001b[32m`, `╋╋╋╋╋╋╋┗┛╋┗┛`) console.log(`\u001b[32m`, `╋╋╋╋╋╋╋┗┛╋┗┛`);
console.log(` `) console.log(` `);
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`) console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
console.log(` `) console.log(` `);
console.log(`\u001b[33m`, `${supportbot.Name} v${supportbot.SupportBot_Version}`, `\u001b[36m`, `Connected to Discord`) console.log(
console.log(`\u001b[33m`, `Resources:`, `\u001b[36m`, `https://emeraldsrv.dev/resources`) `\u001b[33m`,
console.log(`\u001b[33m`, `Documentation:`, `\u001b[36m`, `https://supportbot.emeraldsrv.dev`) `${supportbot.Name} v${supportbot.SupportBot_Version}`,
console.log(`\u001b[33m`, `Discord:`, `\u001b[36m`, `https://emeraldsrv.dev/discord`) `\u001b[36m`,
console.log(`\u001b[33m`, `Hosting:`, `\u001b[36m`, `https://emeraldsrv.dev/hosting`) `Connected to Discord`
console.log(` `) );
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`) console.log(
console.log(` `) `\u001b[33m`,
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`) `Resources:`,
`\u001b[36m`,
`https://emeraldsrv.dev/resources`
);
console.log(
`\u001b[33m`,
`Documentation:`,
`\u001b[36m`,
`https://supportbot.emeraldsrv.dev`
);
console.log(
`\u001b[33m`,
`Discord:`,
`\u001b[36m`,
`https://emeraldsrv.dev/discord`
);
console.log(
`\u001b[33m`,
`Hosting:`,
`\u001b[36m`,
`https://emeraldsrv.dev/hosting`
);
console.log(` `);
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`);
console.log(` `);
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
if (panelconfig.TicketPanel) { if (panelconfig.TicketPanel) {
let chan1 = client.channels.cache.find(channel => channel.name === panelconfig.Channel) let chan1 = client.channels.cache.find(
(channel) => channel.name === panelconfig.Channel
);
if (!chan1) { if (!chan1) {
console.log('\u001b[33m', "[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!") console.log(
"\u001b[33m",
"[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!"
);
return false; return false;
} }
const panelid = yaml.load(fs.readFileSync('./Data/ticket-panel-id.yml', 'utf8')); const panelid = yaml.load(
fs.readFileSync("./Data/ticket-panel-id.yml", "utf8")
);
chan1.messages.fetch(panelid.TicketPanelID).catch(async r => { chan1.messages.fetch(panelid.TicketPanelID).catch(async (r) => {
let embed = new Discord.MessageEmbed() let embed = new Discord.MessageEmbed()
.setTitle(`${panelconfig.PanelTitle}`) .setTitle(`${panelconfig.PanelTitle}`)
.setColor(supportbot.SuccessColour) .setColor(supportbot.SuccessColour)
.setFooter(supportbot.EmbedFooter); .setFooter(supportbot.EmbedFooter);
if (panelconfig.TicketPanel_Description) { if (panelconfig.TicketPanel_Description) {
embed.setDescription(panelconfig.PanelMessage) embed.setDescription(panelconfig.PanelMessage);
} }
if (panelconfig.TicketPanel_Thumbnail) { if (panelconfig.TicketPanel_Thumbnail) {
embed.setThumbnail(panelconfig.PanelThumbnail) embed.setThumbnail(panelconfig.PanelThumbnail);
} }
if (panelconfig.TicketPanel_Image) { if (panelconfig.TicketPanel_Image) {
embed.setImage(panelconfig.PanelImage) embed.setImage(panelconfig.PanelImage);
} }
let button = new Discord.MessageButton() let button = new Discord.MessageButton()
.setLabel(panelconfig.ButtonLabel) .setLabel(panelconfig.ButtonLabel)
.setCustomId('openticket') .setCustomId("openticket")
.setStyle(panelconfig.ButtonColour) .setStyle(panelconfig.ButtonColour);
let row = new Discord.MessageActionRow() let row = new Discord.MessageActionRow().addComponents(button);
.addComponents(button)
await chan1
await chan1.send({ .send({
embeds: [embed], embeds: [embed],
components: [row] components: [row],
}).then(r => { })
.then((r) => {
let data = { let data = {
"TicketPanelID": `${r.id}` TicketPanelID: `${r.id}`,
} };
let yamlStr = yaml.dump(data); let yamlStr = yaml.dump(data);
fs.writeFileSync('./Data/ticket-panel-id.yml', yamlStr, 'utf8'); fs.writeFileSync("./Data/ticket-panel-id.yml", yamlStr, "utf8");
}).catch(e => {
console.log("Raw"+e)
}) })
}) .catch((e) => {
} console.log("Raw" + e);
});
});
}
}); });
+2 -4
View File
@@ -13,12 +13,10 @@
const fs = require("fs"); const fs = require("fs");
const Discord = require("discord.js"); const Discord = require("discord.js");
const yaml = require('js-yaml'); const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
const Client = require("./Structures/Client.js"); const Client = require("./Structures/Client.js");
const client = new Client({}); const client = new Client({});
client.start(supportbot.Token); client.start(supportbot.Token);