From 4cd3ecf81f8fee09f1e091883c709a02e317a04a Mon Sep 17 00:00:00 2001 From: ItzEmerald Date: Fri, 29 Oct 2021 19:12:11 +0100 Subject: [PATCH] 7.3 --- .DS_Store | Bin 0 -> 10244 bytes Commands/{TicketAdd.js => add.js} | 10 ++-- Commands/{closeticket.js => close.js} | 10 ++-- Commands/embed.js | 38 ++++++------- Commands/help.js | 6 ++- Commands/info.js | 6 ++- Commands/ping.js | 6 ++- Commands/{TicketRemove.js => remove.js} | 10 ++-- Commands/suggest.js | 68 ++++++++++++++++++++++++ Commands/ticket.js | 15 +++--- {Data => Configs}/commands.yml | 8 +-- {Data => Configs}/supportbot.yml | 30 ++++++----- {Data => Configs}/ticket-panel.yml | 4 +- Data/.DS_Store | Bin 0 -> 6148 bytes Data/TicketData.json | 6 ++- Events/interactionCreate.js | 11 ++-- Events/messageReactionAdd.js | 43 --------------- Events/ready.js | 17 +++--- README.md | 13 +++++ Structures/Addons.js | 4 +- Structures/Client.js | 66 ++++++++++++++++------- Structures/Command.js | 4 +- Structures/Event.js | 4 +- Structures/TicketID.js | 4 +- index.js | 4 +- package-lock.json | 4 +- package.json | 8 +-- 27 files changed, 249 insertions(+), 150 deletions(-) create mode 100644 .DS_Store rename Commands/{TicketAdd.js => add.js} (92%) rename Commands/{closeticket.js => close.js} (94%) rename Commands/{TicketRemove.js => remove.js} (92%) create mode 100644 Commands/suggest.js rename {Data => Configs}/commands.yml (84%) rename {Data => Configs}/supportbot.yml (89%) rename {Data => Configs}/ticket-panel.yml (89%) create mode 100644 Data/.DS_Store delete mode 100644 Events/messageReactionAdd.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1f0cfc97ed818a1c306f8c510a1336bb6f95bdd7 GIT binary patch literal 10244 zcmeHMO>7%Q6n>M0#%@x&X_F8NhZT_!sA+ymB2l5Lj+3ZFr6j~5BqYVG?Tx!+y<_dJ zlcrH5pAZ5r9Lf!G<^n=okb3NeBPVVZM@|T?oZy?8wY%QkgdZVPg`L&Ro1OQ)nR#zK zpFLwDV);g8ibyA-46=|~KZ=AT^diSnSJ3i2B!fMXL*Amz%O#taV(7FXjX)ZKGy-V^ z(g>sxcpM^t?`)AWeM+Wf8i6zdX$0C45d5Gc3z-XKQ%Ol3DC7|UvIosFp^kHaw9x~Z z3uIGCX^KA8>462NEI48?We&YA;E=gMHkDN7#FRO)U}P4YP?#JYcDjTU%PEpk%Os66GzVM_j{$V0 z`F&fe+m`1~PX55Ux_h2D)r-{Ed#iAp?-hK*Z+Lmb-4t)DoZF>V-6*YD=3Y@7oa2sf zSdQsR1FK>Jvh|kbRQO(=H=K$mZ3{|~MJj3|2L~@rUK!J;rl$|b^n)vxC&%=enahWV z+04-B#49Vs9lPf64~3IhkAN=ejCyaEAE6fU$|~;$Ua@alUj3+PfnS;I>AwCmPoC8V z&Yd3^92goJ8h&bMWO(?QqISMyly|DGnC~37xtq5e=4REkDuudHww&s^Z{G0>)?Krx zor^$M%*s2DnpXGgzzjZWklkH(P1BM6Ep2amroUd)&U$5++x9Z|EZ^eJMo7D{6{4)hRvqq`+3aX;IcUt#MQp2^v_?C0mp-A-=qtKU z-_b+*g??kb>}mEKyU3>5Rd$WN$`;uTw#?pOE6Td7wV=&w-J4R5Qn=B`$6-D@^*BYMhLUWx8v`-%SWP(a25DQK=HBdLv zIzjWG7aw_o-o(2}u51+;i+1IE30fDAz;Y@FwhpY6y#-l@#sx{~lt)cz3P9HJ2#p`K zPbALu^8ah&{e1wP~*c8skCt?gihN2{39Z{Fnp4Uq)i)f zM){jW(&mvYz7LNl5-pKP-o{51=~yCZFJ&i%j0mP{>muag1mqFYhiRi3({7A$k_>uutiC;)2-Jx-MFX=Z% z_d;mi10W>>l(mDh3ad*XJ3(wa${KYi?s?bMP!Ii)9^|M;*xd`+WoZTRods>(gd7J6 zR}x10Ib?Af^zDN{8 a.createdTimestamp - b.createdTimestamp ); + html += ``; html += `Server Name: ${interaction.guild.name}
`; html += `Ticket: ${ticketChannel.name}
`; html += `Message: ${msgs.size} Messages


`; @@ -180,6 +183,7 @@ module.exports = new Command({ msgs = msgs.sort( (a, b) => a.createdTimestamp - b.createdTimestamp ); + html += ``; html += `Server Name: ${interaction.guild.name}
`; html += `Ticket: ${ticketChannel.name}
`; html += `Message: ${msgs.size} Messages


`; diff --git a/Commands/embed.js b/Commands/embed.js index 7b6db55..9bff3a8 100644 --- a/Commands/embed.js +++ b/Commands/embed.js @@ -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 Command = require("../Structures/Command.js"); @@ -15,22 +17,20 @@ module.exports = new Command({ description: cmdconfig.EmbedCommandDesc, slashCommandOptions: [ { - name: "title", - description: "Embed Title", - type: "STRING", - }, + name: "title", + description: "Embed Title", + type: "STRING", + }, { name: "message", description: "Embed Message", type: "STRING", }, - ], permission: "SEND_MESSAGES", async run(interaction) { - let SupportStaff = interaction.guild.roles.cache.find( (SupportTeam) => SupportTeam.name === supportbot.Staff @@ -57,22 +57,18 @@ module.exports = new Command({ interaction.member.roles.cache.has(SupportStaff.id) || interaction.member.roles.cache.has(Admins.id) ) { + const EmbedTitle = interaction.options.getString("title"); + const EmbedSubject = interaction.options.getString("message"); - const EmbedTitle = interaction.options.getString("title") - const EmbedSubject = interaction.options.getString("message") - - const EmbedMsg = new Discord.MessageEmbed() - .setTitle(EmbedTitle) - .setDescription(EmbedSubject) - - interaction.reply({ - embeds: [EmbedMsg], - }); + const EmbedMsg = new Discord.MessageEmbed() + .setTitle(EmbedTitle) + .setDescription(EmbedSubject); + interaction.reply({ + embeds: [EmbedMsg], + }); } else { - return interaction.reply({ embeds: [NoPerms] }); + return interaction.reply({ embeds: [NoPerms] }); } - }, - }); diff --git a/Commands/help.js b/Commands/help.js index 8df6568..bc02091 100644 --- a/Commands/help.js +++ b/Commands/help.js @@ -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 Command = require("../Structures/Command.js"); diff --git a/Commands/info.js b/Commands/info.js index 289ce07..b93dcf9 100644 --- a/Commands/info.js +++ b/Commands/info.js @@ -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 Command = require("../Structures/Command.js"); diff --git a/Commands/ping.js b/Commands/ping.js index 799b1f4..edf812d 100644 --- a/Commands/ping.js +++ b/Commands/ping.js @@ -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 Command = require("../Structures/Command.js"); diff --git a/Commands/TicketRemove.js b/Commands/remove.js similarity index 92% rename from Commands/TicketRemove.js rename to Commands/remove.js index f5d673e..d062584 100644 --- a/Commands/TicketRemove.js +++ b/Commands/remove.js @@ -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 Command = require("../Structures/Command.js"); @@ -56,9 +58,7 @@ module.exports = new Command({ interaction.member.roles.cache.has(SupportStaff.id) || interaction.member.roles.cache.has(Admins.id) ) { - if ( - !interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`) - ) { + if (!interaction.channel.name.startsWith(`${supportbot.TicketPrefix}`)) { const Exists = new Discord.MessageEmbed() .setTitle("No Ticket Found!") .setDescription(`${supportbot.NoValidTicket}`) diff --git a/Commands/suggest.js b/Commands/suggest.js new file mode 100644 index 0000000..99a99bc --- /dev/null +++ b/Commands/suggest.js @@ -0,0 +1,68 @@ +// SupportBot | Emerald Services +// Ping Command + +const fs = require("fs"); + +const Discord = require("discord.js"); +const yaml = require("js-yaml"); +const supportbot = yaml.load( + fs.readFileSync("./Configs/supportbot.yml", "utf8") +); +const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8")); + +const Command = require("../Structures/Command.js"); + +module.exports = new Command({ + name: cmdconfig.SuggestCommand, + description: cmdconfig.SuggestCommandDesc, + slashCommandOptions: [ + { + name: "suggestion", + description: "Create a Suggestion", + type: "STRING", + }, + ], + permission: "SEND_MESSAGES", + + async run(interaction) { + const suggestChannel = + interaction.guild.channels.cache.find( + (channel) => channel.name === supportbot.SuggestionChannel + ) || + interaction.guild.channels.cache.find( + (channel) => channel.id === supportbot.SuggestionChannel + ); + + const NoChannel = new Discord.MessageEmbed() + .setTitle("Missing Channel!") + .setDescription(`${supportbot.InvalidChannel}`) + .setColor(supportbot.ErrorColour); + + if (!suggestChannel) return interaction.reply({ embeds: [NoChannel] }); + + let suggestion = interaction.options.getString("suggestion"); + + const SuggestEmbed = new Discord.MessageEmbed() + .addField("Suggestion", suggestion, true) + .addField("From", `<@${interaction.user.id}>`) + .setThumbnail(interaction.user.displayAvatarURL()) + .setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL()) + .setColor(supportbot.EmbedColour); + + const suggestionMsg = await suggestChannel.send({ embeds: [SuggestEmbed] }); + if (supportbot.SuggestionUpvote && supportbot.SuggestionDownvote) { + suggestionMsg.react(supportbot.SuggestionUpvote); + suggestionMsg.react(supportbot.SuggestionDownvote); + } + + const Submitted = new Discord.MessageEmbed() + .setTitle("Suggestion Submitted!") + .setDescription( + `:white_check_mark: You have successfully submitted a suggestion.` + ) + .addField("Sent to:", `<#${suggestChannel.id}>`) + .setColor(supportbot.SuccessColour); + + return interaction.reply({ embeds: [Submitted] }); + }, +}); diff --git a/Commands/ticket.js b/Commands/ticket.js index f1a65d8..27329fd 100644 --- a/Commands/ticket.js +++ b/Commands/ticket.js @@ -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 Command = require("../Structures/Command.js"); const TicketNumberID = require("../Structures/TicketID.js"); @@ -62,10 +64,9 @@ module.exports = new Command({ .setColor(supportbot.WarningColour); if ( - interaction.guild.channels.cache.find( - (ticketChannel) => - ticketChannel.name === `${supportbot.TicketChannel}-${ticketNumberID}` - ) + await interaction.guild.channels.cache.find((ticketChannel) => { + ticketChannel.name === `${supportbot.TicketPrefix}${ticketNumberID}`; + }) ) { return interaction.reply({ embeds: [TicketExists] }); } @@ -113,7 +114,7 @@ module.exports = new Command({ const Author = interaction.user; const Everyone = interaction.guild.id; const ticketChannel = await interaction.guild.channels.create( - `${supportbot.TicketChannel}-${ticketNumberID}`, + `${supportbot.TicketPrefix}${ticketNumberID}`, { type: "GUILD_TEXT", } diff --git a/Data/commands.yml b/Configs/commands.yml similarity index 84% rename from Data/commands.yml rename to Configs/commands.yml index 8edc372..1e56d35 100644 --- a/Data/commands.yml +++ b/Configs/commands.yml @@ -7,8 +7,8 @@ # SupportBot created by Emerald Services # Installed with MIT License # -# Discord Support: https:#emeraldsrv.dev/discord -# Community Resources: https:#emeraldsrv.dev/resources +# Discord Support: https://emeraldsrv.dev/discord +# Community Resources: https://emeraldsrv.dev/resources # ------------------------------- # Command Name Configuration @@ -22,6 +22,7 @@ InfoCommand: "info" PingCommand: "ping" HelpCommand: "help" EmbedCommand: "embed" +SuggestCommand: "suggest" # --------------------------------------- # Command Description Configuration @@ -35,5 +36,4 @@ InfoCommandDesc: "Get information about the brand." PingCommandDesc: "Pong!" HelpCommandDesc: "Get a list of all the commands." EmbedCommandDesc: "Send a message as an embed." - - +SuggestCommandDesc: "Suggest a feature for the server." diff --git a/Data/supportbot.yml b/Configs/supportbot.yml similarity index 89% rename from Data/supportbot.yml rename to Configs/supportbot.yml index a7f1cee..e76fa4f 100644 --- a/Data/supportbot.yml +++ b/Configs/supportbot.yml @@ -7,17 +7,17 @@ # SupportBot created by Emerald Services # Installed with MIT License # -# Discord Support: https:#emeraldsrv.dev/discord -# Community Resources: https:#emeraldsrv.dev/resources +# Discord Support: https://emeraldsrv.dev/discord +# Community Resources: https://emeraldsrv.dev/resources -SupportBot_Version: "7.2 pre-3" +SupportBot_Version: "7.2" # ------------------------- # General Configuration # ------------------------- Name: "SupportBot" -Prefix: "!" # Everything uses the new Slash (/) Commands feature! +# No Prefix, as everything uses the new Slash (/) Commands feature! Token: "BOT_TOKEN" # ------------------------- @@ -69,19 +69,25 @@ AutoRole: true AutoRole_Role: "Member" LockdownRole: "@everyone" -Staff: "Support Team" +Staff: "Staff" Admin: "Project Developer" TicketBlackListRole: "Blacklisted" +# ---------------------------- +# Suggestions Configuration +# ---------------------------- + +SuggestionChannel: "suggestions" + # ------------------------- # Tickets Configuration # ------------------------- -TicketCategory: "▬▬ TICKETS ▬▬" -TicketChannel: "ticket" +TicketCategory: "Tickets" +TicketPrefix: "ticket-" # The prefix for ticket channel names -TicketLog: "ticket-log" -TranscriptLog: "ticket-data" +TicketLog: "logs" +TranscriptLog: "transcripts" TranscriptTitle: "Ticket Transcript" TicketLog_Title: "Ticket Log" @@ -165,9 +171,9 @@ DepartmentTitle_2: "Billing Support" DepartmentTitle_3: "Admin Team" # Ticket department title, This is the title for a ticket department to help users know what is available. -DepartmentRole_1: "Support Team" -DepartmentRole_2: "Support Team" -DepartmentRole_3: "Project Developer" +DepartmentRole_1: "Support" +DepartmentRole_2: "Support" +DepartmentRole_3: "Admin" # Ticket roles are the roles that will be able to gain access to tickets depending on what department has been chosen. # --- Closing Config --- diff --git a/Data/ticket-panel.yml b/Configs/ticket-panel.yml similarity index 89% rename from Data/ticket-panel.yml rename to Configs/ticket-panel.yml index baeca8d..10f37bf 100644 --- a/Data/ticket-panel.yml +++ b/Configs/ticket-panel.yml @@ -7,8 +7,8 @@ # SupportBot created by Emerald Services # Installed with MIT License # -# Discord Support: https:#emeraldsrv.dev/discord -# Community Resources: https:#emeraldsrv.dev/resources +# Discord Support: https://emeraldsrv.dev/discord +# Community Resources: https://emeraldsrv.dev/resources # ------------------------------- # Ticket Panel Configuration diff --git a/Data/.DS_Store b/Data/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..23c4cb2f77fa94cdbe0b504efb7a13336d1b286d GIT binary patch literal 6148 zcmeHKOHRWu5PdF{C}Pn{Y}g?A0#xdrMX17pbvXdE4Nyp%ina@OxdaE{44ewFfH(H2 zY6%~K1VU&=8b8PJ^VrW;CI;ZTi(v<70cg+#Yg;VdFnKRtv6{AQ5?vT0!yNmV;tZ2Y zZ)^CA3dr8=aMwl{;2Nv@mm%j~jxaF{;Noc{yttZr0g2{2DvI==27~cpByzizYsdH!jjt z*V>q6PY3sR4-)fJ*61AbhD-*S0lAA0K__*gRw4m3E_CfM6ry>H#8Ti#7K2|#c+|%cCY;s#WG@~!|CP2X=JB2 z6c?g%d>^{QB@wMO1x$f;1vcViOY;BG`}hBKl0BIMrog{az}3@U+U1fow^kM>xz^K9 q>0;8ajJTw*5>heyN-Ex^2V=XJ3NcYEBeI2NKLSApD@=i3Rp13>7;2dS literal 0 HcmV?d00001 diff --git a/Data/TicketData.json b/Data/TicketData.json index 0967ef4..cf23c47 100644 --- a/Data/TicketData.json +++ b/Data/TicketData.json @@ -1 +1,5 @@ -{} +{ + "854057237495676938": { + "id": 2 + } +} \ No newline at end of file diff --git a/Events/interactionCreate.js b/Events/interactionCreate.js index 7b06425..d7e67a1 100644 --- a/Events/interactionCreate.js +++ b/Events/interactionCreate.js @@ -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 += ``; html += `Server Name: ${interaction.guild.name}
`; html += `Ticket: ${ticketChannel.name}
`; html += `Message: ${msgs.size} Messages


`; @@ -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 = diff --git a/Events/messageReactionAdd.js b/Events/messageReactionAdd.js deleted file mode 100644 index 22d20d6..0000000 --- a/Events/messageReactionAdd.js +++ /dev/null @@ -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); - } - } - } - } -}); diff --git a/Events/ready.js b/Events/ready.js index 872e412..24bfa7f 100644 --- a/Events/ready.js +++ b/Events/ready.js @@ -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); diff --git a/README.md b/README.md index e69de29..01cd9e6 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,13 @@ +![imgur](https://i.imgur.com/TQj40Mt.png) + +## What is SupportBot? + +SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customisation to match your own brand. + +## Quick Links + +**|** [Discord](https://emeraldsrv.dev/discord) **|** +[Hosting](https://emeraldsrv.dev/hosting) **|** +[Documentation](https://docs.emeraldsrv.dev) **|** +[Download via Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518) **|** +[Download via MC-Market](https://www.mc-market.org/resources/8940/) **|** diff --git a/Structures/Addons.js b/Structures/Addons.js index d5c8935..95b24f7 100644 --- a/Structures/Addons.js +++ b/Structures/Addons.js @@ -6,7 +6,9 @@ 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") +); function RunFunction(interaction) {} diff --git a/Structures/Client.js b/Structures/Client.js index e37007d..e70422d 100644 --- a/Structures/Client.js +++ b/Structures/Client.js @@ -9,7 +9,9 @@ const Event = require("./Event.js"); const intents = new Discord.Intents(32767); 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") +); class Client extends Discord.Client { constructor() { @@ -23,6 +25,12 @@ class Client extends Discord.Client { .readdirSync("./Commands") .filter((file) => file.endsWith(".js")); + const addonFiles = fs + .readdirSync("./Addons") + .filter((file) => file.endsWith(".js")); + + const addons = addonFiles.map((file) => require(`../Addons/${file}`)); + const commands = commandFiles.map((file) => require(`../Commands/${file}`)); console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬"); @@ -32,26 +40,19 @@ class Client extends Discord.Client { this.commands.set(cmd.name, cmd); }); - console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬"); - - // Addons - - const addonFiles = fs - .readdirSync("./Addons") - .filter((file) => file.endsWith(".js")); - - const addons = addonFiles.map((file) => require(`../Addons/${file}`)); - - console.log(" "); - console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬"); - addons.forEach((addon) => { - console.log(`\u001b[31;1m`, `${addon.name}`, `\u001b[32;1m`, "Loaded"); + console.log( + `\u001b[33m`, + `[ADDON]`, + `\u001b[31;1m`, + `${addon.name}`, + `\u001b[32;1m`, + "Loaded" + ); this.commands.set(addon.name, addon); }); - console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬"); - console.log(" "); + console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬"); // Slash Commands @@ -63,17 +64,42 @@ class Client extends Discord.Client { defaultPermission: true, })); + const slashCommands1 = addons.map((addon) => ({ + name: addon.name.toLowerCase(), + description: addon.description, + permissions: [], + options: addon.slashCommandOptions, + defaultPermission: true, + })); + this.removeAllListeners(); this.on("ready", async () => { - const cmds = await this.application?.commands.set(slashCommands); + const allCommands = slashCommands.concat(slashCommands1); + await this.application?.commands.set(allCommands); console.log(" "); console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Slash Command ▬▬▬▬▬▬▬"), console.log(" "); - cmds.forEach((cmd) => - console.log(`Slash Command ${cmd.name} registered`) + slashCommands.forEach((cmd) => + console.log( + `\u001b[31;1m`, + `${cmd.name}`, + `\u001b[32;1m`, + `| Slash Command Registered` + ) + ); + + slashCommands1.forEach((addon) => + console.log( + `\u001b[33m`, + `[ADDON]`, + `\u001b[31;1m`, + `${addon.name}`, + `\u001b[32;1m`, + `| Slash Command Registered` + ) ); }); diff --git a/Structures/Command.js b/Structures/Command.js index a075110..ba663b5 100644 --- a/Structures/Command.js +++ b/Structures/Command.js @@ -6,7 +6,9 @@ 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") +); function RunFunction(interaction) {} diff --git a/Structures/Event.js b/Structures/Event.js index 8f81bf1..61e4381 100644 --- a/Structures/Event.js +++ b/Structures/Event.js @@ -6,7 +6,9 @@ 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") +); function RunFunction(client, ...eventArgs) {} diff --git a/Structures/TicketID.js b/Structures/TicketID.js index e0f0d80..11c9d9f 100644 --- a/Structures/TicketID.js +++ b/Structures/TicketID.js @@ -9,7 +9,9 @@ const Client = require("./Client.js"); const Event = require("./Event.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") +); class TicketNumberID { static pad(guildId) { diff --git a/index.js b/index.js index ed48bb2..db39ccc 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,9 @@ 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 Client = require("./Structures/Client.js"); const client = new Client({}); diff --git a/package-lock.json b/package-lock.json index adbb482..96e00a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supportbot", - "version": "7.2.0", + "version": "7.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "supportbot", - "version": "7.2.0", + "version": "7.3.0", "license": "MIT", "dependencies": { "discord.js": "^13.2.0", diff --git a/package.json b/package.json index aa20175..d7e99f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supportbot", - "version": "7.2.0", + "version": "7.3.0", "description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.", "main": "index.js", "scripts": { @@ -8,14 +8,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/1tzemerald/SupportBot.git" + "url": "git+https://github.com/Emerald-Services/SupportBot.git" }, "author": "Emerald Services", "license": "MIT", "bugs": { - "url": "https://github.com/1tzemerald/SupportBot/issues" + "url": "https://github.com/Emerald-Services/SupportBot/issues" }, - "homepage": "https://github.com/1tzemerald/SupportBot#readme", + "homepage": "https://github.com/Emerald-Services/SupportBot#readme", "dependencies": { "discord.js": "^13.2.0", "js-yaml": "^4.1.0"