From 70405a1cd093851185cea673414294a33ee80b0a Mon Sep 17 00:00:00 2001 From: ItzEmerald Date: Tue, 2 Feb 2021 16:07:28 +0000 Subject: [PATCH] SB-6.1-PRE Ticket Reaction Create --- .gitignore | 2 -- Dockerfile | 18 ----------------- README.md | 7 ------- events/messageReactionAdd.js | 38 ++++++++++-------------------------- events/ready.js | 33 +++++-------------------------- storage/SupportTickets.json | 4 ++-- storage/TicketID.json | 3 +++ storage/ticketreaction.yml | 2 +- supportbot-config.yml | 16 ++++++--------- 9 files changed, 27 insertions(+), 96 deletions(-) delete mode 100644 .gitignore delete mode 100755 Dockerfile mode change 100755 => 100644 events/ready.js diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7b0c665..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ - -supportbot-config.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 100755 index 69c15db..0000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM node:alpine - -MAINTAINER Thien Tran, - -RUN apk update \ - && apk upgrade - -RUN apk add --no-cache git && \ - adduser -D -h /home/container container - - # Ensure UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 - -WORKDIR /home/container - -COPY ./entrypoint.sh /entrypoint.sh -CMD ["/bin/ash", "/entrypoint.sh"] diff --git a/README.md b/README.md index abdf011..e69de29 100755 --- a/README.md +++ b/README.md @@ -1,7 +0,0 @@ -![SupportBot](https://i.imgur.com/OFO3XB2.png) - -SupportBot the #1 self-hosted discord ticket system with any customizations and features to help make your support system look clean, tidy and professional. It's self-hosted! No need to use someone's public discord bot thats used in a handful of servers. Create, Configure & Use your own discord bot installed with SupportBot. - -### SupportBot Compatibility - -SupportBot is a free & open projected create by Emerald Services, Anything older than version 6.0 we will not SupportBot. Following off that if you have recieved SupportBot from a third-party user we will not provide support no matter what version you are using. It is against of terms of service to sell our product. diff --git a/events/messageReactionAdd.js b/events/messageReactionAdd.js index 52d7745..75f37e4 100644 --- a/events/messageReactionAdd.js +++ b/events/messageReactionAdd.js @@ -7,7 +7,6 @@ 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 verif = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); module.exports = async (client, reaction, user) => { @@ -20,34 +19,17 @@ module.exports = async (client, reaction, user) => { if (supportbot.ReactionTickets === "true") { if (reaction.message.id === tickets.ReactionMessage_ID) { - switch (reaction.emoji.id) { - case supportbot.ReactionEmoji: { - await reaction.users.remove(user.id) + if (reaction.emoji.name == supportbot.ReactionEmoji || reaction.emoji.id == supportbot.ReactionEmoji) { + await reaction.users.remove(user.id) - try { - const cmd = client.commands.get("ticket"); - if(!cmd) return; - - cmd.execute(message, "undefined"); - } catch (error) { - console.error(error); - } - } - } - } - } - - if (supportbot.Verification === "true") { - if (reaction.message.id === verif.verification_msg) { - switch (reaction.emoji.id) { - case supportbot.VerificationEmoji: { - await reaction.users.remove(user.id) - - let r = reaction.message.channel.guild.roles.cache.find(r => r.name === "verified") - - await reaction.message.channel.guild.members.cache.get(user.id).roles.add(r) - - } + try { + const cmd = client.commands.get("ticket"); + if(!cmd) return; + + cmd.execute(message, "undefined"); + } catch (error) { + console.error(error); + } } } } diff --git a/events/ready.js b/events/ready.js old mode 100755 new mode 100644 index 7d5c410..37fbc9d --- a/events/ready.js +++ b/events/ready.js @@ -7,13 +7,14 @@ 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 verif = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); + module.exports = async (bot) => { bot.user.setActivity(supportbot.BotActivity, { type: supportbot.ActvityType + }); - + console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`) console.log(`\u001b[37m`, `${supportbot.Bot_Name} has successfully connected to discord`) console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`) @@ -40,37 +41,13 @@ module.exports = async (bot) => { } let yamlStr = yaml.dump(data); fs.writeFileSync('./storage/ticketreaction.yml', yamlStr, 'utf8'); - r.react(supportbot.ReactionEmoji) + + r.react(supportbot.ReactionEmoji); }).catch(e => { console.log(e) }) }) } - if (supportbot.Verification === "true") { - let chan2 = bot.channels.cache.find(channel => channel.name === supportbot.Verification_Channel) - if (!chan2) { - console.log('\u001b[33m', "[WARN] Verification Reaction panel is not setup, You can do so via the configuration file!") - return false; - } - - chan2.messages.fetch(verif.verification_msg).catch(r => { - let embed = new Discord.MessageEmbed() - .setTitle(supportbot.VerificationMessage.replace(/%VerificationEmoji%/g, supportbot.VerificationEmoji)) - .setColor(supportbot.EmbedColour) - .setFooter(supportbot.EmbedFooter); - - bot.channels.cache.find(channel => channel.name === supportbot.Verification_Channel).send({embed: embed}).then(r => { - let data = { - "verification_msg": `${r.id}` - } - let yamlStr = yaml.dump(data); - fs.writeFileSync('./storage/verification.yml', yamlStr, 'utf8'); - r.react(supportbot.VerificationEmoji) - }).catch(e => { - console.log(e) - }) - }) - } }; \ No newline at end of file diff --git a/storage/SupportTickets.json b/storage/SupportTickets.json index 72a7bfd..087e82e 100755 --- a/storage/SupportTickets.json +++ b/storage/SupportTickets.json @@ -1,4 +1,4 @@ { - "ticket": "ticket-0064", - "id":207937608779694080 + "ticket": "ticket-0005", + "id":419821884431925260 } \ No newline at end of file diff --git a/storage/TicketID.json b/storage/TicketID.json index 052c513..e10d989 100755 --- a/storage/TicketID.json +++ b/storage/TicketID.json @@ -1,5 +1,8 @@ { "716992597377286145": { "id": 65 + }, + "805909541979029524": { + "id": 6 } } \ No newline at end of file diff --git a/storage/ticketreaction.yml b/storage/ticketreaction.yml index ee425e5..0d906cc 100644 --- a/storage/ticketreaction.yml +++ b/storage/ticketreaction.yml @@ -1 +1 @@ -ReactionMessage_ID: '806157017025609728' +ReactionMessage_ID: '806191841896169473' diff --git a/supportbot-config.yml b/supportbot-config.yml index 0bc3486..1fbb96c 100755 --- a/supportbot-config.yml +++ b/supportbot-config.yml @@ -11,11 +11,12 @@ # General Bot Configuration -Token: "NjUyNjUzMDU3OTQyODgwMjU2.Xerkhg.dhNMOR_rFyQKvoQJYkGRqZ7fq4E" +Token: "BOT_TOKEN" Prefix: "-" Bot_Name: "SupportBot" -BotActivity: "-help ~ SupportBot 6.0" +BotActivity: "-help | SupportBot" + ActivityType: "PLAYING" # Activity status can either be PLAYING, WATCHING or LISTENING. @@ -38,7 +39,7 @@ AutoRole_Role: "Member" LockdownRole: "@everyone" Staff: "Staff" -Admin: "Administration Team" +Admin: "Admin" # Ticket Configuration @@ -51,14 +52,9 @@ TicketSubject: "description" ReactionTickets: "true" ReactionMessage: "React with %reaction_emoji% to create a Support Ticket!" -ReactionChannel: "open-a-ticket" +ReactionChannel: "create-ticket" ReactionEmoji: "📩" - -Verification: "false" -Verification_Channel: "verification" - -VerificationMessage: "React with %VerificationEmoji% to get access to this server!" -VerificationEmoji: "✅" +# Custom Emojis: <:test:EMOJI_ID> Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png" Ticket_Title: "Server Support | %ticketusername%"