From f6d4383ff6e86c50977518d3d60d7afb75a21670 Mon Sep 17 00:00:00 2001 From: ItzEmerald Date: Fri, 18 Dec 2020 13:37:56 +0000 Subject: [PATCH] 6.1 PRE-0.2 --- .DS_Store | Bin 6148 -> 8196 bytes Dockerfile | 0 LICENSE | 0 README.md | 18 ++++++++---- addons/.DS_Store | Bin 0 -> 6148 bytes addons/addon-example.js | 0 addons/settings/.DS_Store | Bin 0 -> 6148 bytes addons/settings/exampleaddon.yml | 0 commands/addUser.js | 2 +- commands/announce.js | 4 +-- commands/botSay.js | 2 +- commands/close.js | 2 +- commands/help.js | 2 +- commands/links.js | 2 +- commands/newticket.js | 4 +-- commands/ping.js | 2 +- commands/removeUser.js | 2 +- commands/suggest.js | 2 +- events/guildMemberAdd.js | 2 +- events/guildMemberRemove.js | 4 +-- events/message.js | 2 +- events/messageReactionAdd.js | 49 +++++++++++++++++++++++++++++++ events/ready.js | 35 ++++++++++++++++++++-- index.js | 2 +- package-lock.json | 26 ++++++++-------- package.json | 2 +- storage/SupportTickets.json | 0 storage/TicketID.json | 0 storage/ticketreaction.yml | 1 + supportbot-config.yml | 22 +++++++++++--- utils/TicketNumber.js | 0 31 files changed, 145 insertions(+), 42 deletions(-) mode change 100644 => 100755 Dockerfile mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md create mode 100644 addons/.DS_Store mode change 100644 => 100755 addons/addon-example.js create mode 100644 addons/settings/.DS_Store mode change 100644 => 100755 addons/settings/exampleaddon.yml mode change 100644 => 100755 commands/addUser.js mode change 100644 => 100755 commands/announce.js mode change 100644 => 100755 commands/botSay.js mode change 100644 => 100755 commands/close.js mode change 100644 => 100755 commands/help.js mode change 100644 => 100755 commands/links.js mode change 100644 => 100755 commands/newticket.js mode change 100644 => 100755 commands/ping.js mode change 100644 => 100755 commands/removeUser.js mode change 100644 => 100755 commands/suggest.js mode change 100644 => 100755 events/guildMemberAdd.js mode change 100644 => 100755 events/guildMemberRemove.js mode change 100644 => 100755 events/message.js create mode 100644 events/messageReactionAdd.js mode change 100644 => 100755 events/ready.js mode change 100644 => 100755 index.js mode change 100644 => 100755 package-lock.json mode change 100644 => 100755 package.json mode change 100644 => 100755 storage/SupportTickets.json mode change 100644 => 100755 storage/TicketID.json create mode 100644 storage/ticketreaction.yml mode change 100644 => 100755 supportbot-config.yml mode change 100644 => 100755 utils/TicketNumber.js diff --git a/.DS_Store b/.DS_Store index 60ffdb604e26cdbf5dcb9361b2bc4f33e873f5ae..56b5e8bcd0dc1dd5ba32f33d5f0cc49cbbdd626a 100644 GIT binary patch literal 8196 zcmeHM&2G~`5S~fXl2D*d+k{APh{y%0QdK0bsBS2N&_hB~p+p7R#Mz`4&TeEo3FVY0 z-~o6BZd`Z)UV;lRz=0E2nEfejllH&`5wR1^eCyenUHeu~@8OM~`3fII-CNF_Rp zWG)cdFLg>1#xqZdln>=Vc&$LR=-8QxwhqgHWxz6E8L$jk2L1&GXwR0Cx@6ziz1CU= zECc@~1M>M$AeHDE9BWjM4l=3)AWV{53ANR$KVd;S2wj6?jpQLgol2-v(UcfyDhJf* z)bE=3u|}N^sAi^d%*<#i6f}hg7F0N(tI=A^fMsBs0a?2zVI8{QLp)KxZ&Ba+PbDfb z1s(|K(XR;{+7S8Pu&?WV{MhOTeiUzPe03a5%q8a+uB6ge7q4BvvE*cyS2C-aY&M&_ zna$^Nw+@_@R?~ak4aI=BABsSPrC`A7z9)Fif6MAIdlSpXfwMdjx69hEPF;J)eTrE< zb*Ql(hm7(4Zs@lwoleB!`hl|)d7%h`s)+p97rb$%xA7u65~Fg=dS%`bG~>``qe@?f zMbB9n5l-dT8_h6m@-8bKzYLl!7F2ji#IfkfNI4o^NHt_~BsEj5-}HRmEpC3-{1@Ho zN#m|=IEkWe0Hht<@WAZ<(yb* zeOH{d@&+i7N^}j5HAk1qfIKSNh!Pt`JD8TeBM zFu7gZE>V`+)i21FyL^H4kW`9{8*5Z4WX`<^(DCm-45?k9P?_Tz9BU*GiTx0uXt2gI I@K+i51)awt!2kdN literal 6148 zcmeHK-EPw`6h7{{H7$Qd0&SPMLE@rJoyyn+LMmN*Q3((t2rd9^Nt1PjEUDUbWt5`c z@DT6-NIVKpz=QAr@EzNrBxSd#LOzxKInMd9KcCn&5sB8s-yy0Jk%huotf2af@Ov&x zQqVn@fkOI-Xxt6so)^a6lD6qE3>XGhjRF34H^?O)znHS$FK-HWQEvW}B8P5K4|*r~ zxzP4A-#hDn&FNRD4gDUyp@2qoL<0&bNbM1@5u332l8Uhb-BXl^lDvPZn;uU_*PD)q zdhhw>4a31Wsn@@Y!dh{CqhwhXt8%IG$~lgwPU0q$amyXO;HSrKa_s5$(>M+_mD z+uN(x?Awhy^Lg3Yys>kydw6p8ZuWlu;gh751U679S2X^H&uC;OdFqU!Fpm1@XB!KY z@5;C(Pa+dLefV)=^9a*1@wiH&Q_i}uN`o?E zF$@?6R)PWEA8ZuHrpARrxpknDR{&rU-BQrzzX5DxYiw# Anything older than v6 we will no longer be supporting, However our terms & conditions still remain valid for all copies of our product "SupportBot". + +|---------|---------| +| Version | | +|---------|---------| +| 6.0. | ✅ | +|---------|---------| -SupportBot is a free discord application that can be easily customised to your own brand. -Yes you heard me. This documentation will explain you how to setup & install SupportBot.[ -[**Documentation**](https://docs.emeraldsrv.dev/) diff --git a/addons/.DS_Store b/addons/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a61e04e33b7a7aa937387564518121afd3d08b0e GIT binary patch literal 6148 zcmeHK-A)rh6h2dmY>UY9Q^2Un#>T`1B!EJ~1)&yL+>y@7Qsr*#qof5NWGxMD}bIzHWZ#z3303gX~aS}iW01XSr za1^Uw2=C{mO+w1jiAY2a2W|m{12Cc7<{cOU1_B1o8v}gr>bPHv_%JxRe=A_)ULJ?1 z;H7L<$lEM0d;#tvj(-;-mZO1(o<2SnW+Mb7 zx-=~sjrK&hGP|sn@lC(#B~5pOx6-D+n^*cOWA;zo%&%FrmeU6pnB$w4LtPPU6)C!G zKDL}9t0h_0DS9GLMs{dgBofK#BlY^!%*>cEIeoh^X4Ge=r^bxwso6#&q7C1eoJ(z& z50C248qZ&fr31kapO9XKEqH}W8!=X4UoDipZ7uY(uD6yNiFRM?xzwxo^$+w7_Qhhc zq2bub(9o5fK9DyHdnK1odV$%@P1;quQF5(freYQ>rSfuFICXio1x9*`7SB5Cr7tjOq4>y=(@4Iz49O2i%%B0~{nC{b4oBE!*c zD8GclrbHPIL|s0J8kwjY3K64YenYqeNk|OpfPsL4(+qUTrq0j*d%wT`pAHII0RsU8 z{}lryyqH-`;*!+a+O{};)*4v0v2fvjO^G4|D|H+Tg&)NuScG7o!4<@W!lp#Dpag#e N1PwtIFz{Cy_yJV~?9%`M literal 0 HcmV?d00001 diff --git a/addons/addon-example.js b/addons/addon-example.js old mode 100644 new mode 100755 diff --git a/addons/settings/.DS_Store b/addons/settings/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..110dbfb043e441eb2fe818d39a620e3e2935509f GIT binary patch literal 6148 zcmeHKyH3ME5S)V)k!V~}-WNpT4~{4)sQCd1p);5UDRl1m>@fQv!m^N3QJ`6CcYNy| zpFG8_7eHCR?{9z(z>;o=PYZLi=jJoJ$V?&9`HnaAc*Z04yv{S@cH|t$dYSMCykdn9 zX8XH-c-r;D&TD~N;_B#j-X^M&0#ZN0rOAuS)7|0B*1eF-nk|Rb5I`cK_TH+WObQIs2@5!A@PAJ89 zXTEwlN()q!0#abAz-25u>;GH&FZ2JDq?Htq0{=>Zve?{j*8HUGt+S7_UR&u8^lxLW omos=PCVDI8!dmh5kGg92eBKhrK&LbBbfSI)Oc$9H_zMNT0E37fS^xk5 literal 0 HcmV?d00001 diff --git a/addons/settings/exampleaddon.yml b/addons/settings/exampleaddon.yml old mode 100644 new mode 100755 diff --git a/commands/addUser.js b/commands/addUser.js old mode 100644 new mode 100755 index 891878b..52f0555 --- a/commands/addUser.js +++ b/commands/addUser.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot, Created by Emerald Services // Add User const Discord = require("discord.js"); diff --git a/commands/announce.js b/commands/announce.js old mode 100644 new mode 100755 index 31bcf48..5edf538 --- a/commands/announce.js +++ b/commands/announce.js @@ -1,5 +1,5 @@ -// SupportBot Created by Emerald Services -// Announce User +// SupportBot, Created by Emerald Services +// Announce const Discord = require("discord.js"); const fs = require("fs"); diff --git a/commands/botSay.js b/commands/botSay.js old mode 100644 new mode 100755 index 9129a70..80fa179 --- a/commands/botSay.js +++ b/commands/botSay.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot, Created by Emerald Services // Say Command const Discord = require("discord.js"); diff --git a/commands/close.js b/commands/close.js old mode 100644 new mode 100755 index eb32c6e..64340ab --- a/commands/close.js +++ b/commands/close.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot, Created by Emerald Services // Close Command const Discord = require("discord.js"); diff --git a/commands/help.js b/commands/help.js old mode 100644 new mode 100755 index 04855e1..2f6281f --- a/commands/help.js +++ b/commands/help.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot, Created by Emerald Services // Help Command const Discord = require("discord.js"); diff --git a/commands/links.js b/commands/links.js old mode 100644 new mode 100755 index 7d37c9d..82b30f5 --- a/commands/links.js +++ b/commands/links.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot, Created by Emerald Services // Links Command const Discord = require("discord.js"); diff --git a/commands/newticket.js b/commands/newticket.js old mode 100644 new mode 100755 index 2ab4605..b3340f3 --- a/commands/newticket.js +++ b/commands/newticket.js @@ -1,5 +1,5 @@ -// SupportBot Created by Emerald Services -// Create Ticket +// SupportBot, Created by Emerald Services +// Ticket Command const Discord = require("discord.js"); diff --git a/commands/ping.js b/commands/ping.js old mode 100644 new mode 100755 index 03e293a..f38eabb --- a/commands/ping.js +++ b/commands/ping.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot, Created by Emerald Services // Ping Command const Discord = require("discord.js"); diff --git a/commands/removeUser.js b/commands/removeUser.js old mode 100644 new mode 100755 index e4a667f..5a83022 --- a/commands/removeUser.js +++ b/commands/removeUser.js @@ -1,4 +1,4 @@ -// SupportBot 6.0, Created by Emerald Services +// SupportBot, Created by Emerald Services // Remove User const Discord = require("discord.js"); diff --git a/commands/suggest.js b/commands/suggest.js old mode 100644 new mode 100755 index 45979d7..a6993d8 --- a/commands/suggest.js +++ b/commands/suggest.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot, Created by Emerald Services // Suggest Command const Discord = require("discord.js"); diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js old mode 100644 new mode 100755 index 898a00a..e4ffa83 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot 6.0, Created by Emerald Services // Ready Event const Discord = require("discord.js"); diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js old mode 100644 new mode 100755 index 88b08f9..15d1f72 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -1,5 +1,5 @@ -// SupportBot Created by Emerald Services -// Member Remove Event +// SupportBot 6.0, Created by Emerald Services +// Ready Event const Discord = require("discord.js"); const fs = require("fs"); diff --git a/events/message.js b/events/message.js old mode 100644 new mode 100755 index c6bdf1f..800ea86 --- a/events/message.js +++ b/events/message.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot 6.0, Created by Emerald Services // Message Event const Discord = require("discord.js"); diff --git a/events/messageReactionAdd.js b/events/messageReactionAdd.js new file mode 100644 index 0000000..2fed6a6 --- /dev/null +++ b/events/messageReactionAdd.js @@ -0,0 +1,49 @@ +// 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')); + +const reacted = []; + +module.exports = async (bot, message) => { + + // Ticket Creation Panel + // This is an embed message where users are able to react and a ticket is created in return. + + bot.on('messageReactionAdd', async (reaction, user) => { + + + if (supportbot.ReactionTickets === "true") { + + + + if (reaction.message.id === tickets.ReactionMessage_ID) { + + let user = await reaction.message.guild.members.fetch(user); + + switch (reaction.emoji.id) { + case supportbot.ReactionEmoji: { + reaction.message.guild.members.fetch(user).then(r => { + reaction.users.remove(r.id) + }); + + + const cmd = bot.commands.get(supportbot.NewTicket); + if(!cmd) return; + console.log("1") + cmd.execute(bot, message, args); + + } + } + } + + } + + }) + +}; \ No newline at end of file diff --git a/events/ready.js b/events/ready.js old mode 100644 new mode 100755 index 5a04202..7a68574 --- a/events/ready.js +++ b/events/ready.js @@ -1,4 +1,4 @@ -// SupportBot Created by Emerald Services +// SupportBot 6.0, Created by Emerald Services // Ready Event const Discord = require("discord.js"); @@ -6,6 +6,7 @@ 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')); module.exports = async (bot) => { @@ -16,4 +17,34 @@ module.exports = async (bot) => { console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`) console.log(`\u001b[37m`, `${supportbot.Bot_Name} has successfully connected to discord`) console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`) -}; + + if (supportbot.ReactionTickets === "true") { + let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel) + + if (!chan1) { + console.log('\u001b[33m', "[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!") + return false; + } + + chan1.messages.fetch(tickets.ReactionMessage_ID).catch(r => { + let embed = new Discord.MessageEmbed() + .setTitle(supportbot.ReactionMessage.replace(/%reaction_emoji%/g, supportbot.ReactionEmoji)) + .setColor(supportbot.SuccessColour) + .setFooter(supportbot.EmbedFooter); + + bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel).send({ + embed: embed + }).then(r => { + let data = { + "ReactionMessage_ID": `${r.id}` + } + let yamlStr = yaml.dump(data); + fs.writeFileSync('./storage/ticketreaction.yml', yamlStr, 'utf8'); + r.react(supportbot.ReactionEmoji) + }).catch(e => { + console.log(e) + }) + }) + } + +}; \ No newline at end of file diff --git a/index.js b/index.js old mode 100644 new mode 100755 index d8e4e1e..0727bb9 --- a/index.js +++ b/index.js @@ -87,4 +87,4 @@ fs.readdir("./addons/", (err, files) => { console.info(`\u001b[37m`, "-----------------------------------------------------------------------------"); }); -bot.login(supportbot.Token); +bot.login(supportbot.Token); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json old mode 100644 new mode 100755 index 9cf70f5..efd3757 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@discordjs/collection": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.5.tgz", - "integrity": "sha512-CU1q0UXQUpFNzNB7gufgoisDHP7n+T3tkqTsp3MNUkVJ5+hS3BCvME8uCXAUFlz+6T2FbTCu75A+yQ7HMKqRKw==" + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", + "integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==" }, "@discordjs/form-data": { "version": "3.0.1", @@ -54,18 +54,18 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "discord.js": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.2.0.tgz", - "integrity": "sha512-Ueb/0SOsxXyqwvwFYFe0msMrGqH1OMqpp2Dpbplnlr4MzcRrFWwsBM9gKNZXPVBHWUKiQkwU8AihXBXIvTTSvg==", + "version": "12.5.1", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.1.tgz", + "integrity": "sha512-VwZkVaUAIOB9mKdca0I5MefPMTQJTNg0qdgi1huF3iwsFwJ0L5s/Y69AQe+iPmjuV6j9rtKoG0Ta0n9vgEIL6w==", "requires": { - "@discordjs/collection": "^0.1.5", + "@discordjs/collection": "^0.1.6", "@discordjs/form-data": "^3.0.1", "abort-controller": "^3.0.0", - "node-fetch": "^2.6.0", - "prism-media": "^1.2.0", + "node-fetch": "^2.6.1", + "prism-media": "^1.2.2", "setimmediate": "^1.0.5", "tweetnacl": "^1.0.3", - "ws": "^7.2.1" + "ws": "^7.3.1" } }, "esprima": { @@ -126,9 +126,9 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, "ws": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", - "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==" + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz", + "integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==" } } } diff --git a/package.json b/package.json old mode 100644 new mode 100755 index ab4ae6a..980c025 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "SupportBot | #1 Self-Hosted Ticket Bot", "main": "index.js", "dependencies": { - "discord.js": "^12.2.0", + "discord.js": "^12.5.1", "js-yaml": "^3.14.0" }, "devDependencies": { diff --git a/storage/SupportTickets.json b/storage/SupportTickets.json old mode 100644 new mode 100755 diff --git a/storage/TicketID.json b/storage/TicketID.json old mode 100644 new mode 100755 diff --git a/storage/ticketreaction.yml b/storage/ticketreaction.yml new file mode 100644 index 0000000..696f71b --- /dev/null +++ b/storage/ticketreaction.yml @@ -0,0 +1 @@ +ReactionMessage_ID: '789248228406198313' diff --git a/supportbot-config.yml b/supportbot-config.yml old mode 100644 new mode 100755 index 1c28fd5..7ade056 --- a/supportbot-config.yml +++ b/supportbot-config.yml @@ -11,7 +11,7 @@ # General Bot Configuration -Token: "BOT_TOKEN_HERE" +Token: "BOT TOKEN" Prefix: "-" Bot_Name: "SupportBot" @@ -37,8 +37,8 @@ AutoRole: "true" AutoRole_Role: "Member" LockdownRole: "@everyone" -Staff: "Support" -Admin: "Admin" +Staff: "Staff" +Admin: "Administration Team" # Ticket Configuration @@ -47,7 +47,12 @@ TicketCategory: "Tickets" TicketLog: "ticket-logs" TranscriptLog: "transcripts" TicketSubject: "description" -# TicketSuvject: "description" means that the subject (reason) of the ticket will be displayed upon the channel description if set to "embed" it will be displayed within the embed. +# TicketSubject: "description" means that the subject (reason) of the ticket will be displayed upon the channel description if set to "embed" it will be displayed within the embed. + +ReactionTickets: "true" +ReactionMessage: "React with %reaction_emoji% to create a Support Ticket!" +ReactionChannel: "open-a-ticket" +ReactionEmoji: "📩" Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png" Ticket_Title: "Server Support | %ticketusername%" @@ -124,6 +129,15 @@ SuggestionStarter: "What would you like to suggest?" SuggestReact_1: 👍 SuggestReact_2: 👎 +# Poll Configuration + +PollChannel: "polls" +PollTitle: "Suggestion" +PollStarter: "What would you like to create a poll about?" +PollReact_1: 👍 +PollReact_2: 👎 + + # Announcement Configuration AnnouncementChannel: "announcements" diff --git a/utils/TicketNumber.js b/utils/TicketNumber.js old mode 100644 new mode 100755