From 45bd88e4d2887f2bb20ffe6ff1173d0876c90f9f Mon Sep 17 00:00:00 2001 From: ItzEmerald Date: Sun, 27 Feb 2022 04:30:15 +0000 Subject: [PATCH] 7.5 commit --- Commands/close.js | 8 ++++++- Commands/embed.js | 46 ++++++++++++++++++++++++++++++++++++++- Configs/supportbot.yml | 4 ++-- Data/ticket-panel-id.json | 5 +---- Events/guildMemberAdd.js | 32 +++++++++++++++++++++++++++ Events/ready.js | 2 +- 6 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 Events/guildMemberAdd.js diff --git a/Commands/close.js b/Commands/close.js index 83fd8ef..620cb7a 100644 --- a/Commands/close.js +++ b/Commands/close.js @@ -168,7 +168,10 @@ module.exports = new Command({ .catch(async (err) => { console.error(err); }); - await tUser + + if (supportbot.DMTranscripts) { + + await tUser ?.send({ embeds: [transcriptEmbed], files: [file] }) .catch(async (err) => { console.error(err); @@ -180,6 +183,9 @@ module.exports = new Command({ ?.send({ embeds: [transcriptEmbed], files: [file] }); }); } + + } + await interaction.channel.delete().catch(async (error) => { console.error(error); if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) { diff --git a/Commands/embed.js b/Commands/embed.js index 2ad25b2..3926ca6 100644 --- a/Commands/embed.js +++ b/Commands/embed.js @@ -29,6 +29,41 @@ module.exports = new Command({ type: "STRING", required: true, }, + + { + name: "color", + description: "Embed HEX Color", + type: "STRING", + required: false, + }, + + { + name: "fieldtitle", + description: "Add an additional Embed Field", + type: "STRING", + required: false, + }, + + { + name: "fieldcontent", + description: "Add an additional Embed Field", + type: "STRING", + required: false, + }, + + { + name: "thumbnail", + description: "Embed Thumbnail URL", + type: "STRING", + required: false, + }, + + { + name: "image", + description: "Embed Image URL", + type: "STRING", + required: false, + }, ], permissions: ["SEND_MESSAGES"], @@ -54,10 +89,19 @@ module.exports = new Command({ ) { const EmbedTitle = interaction.options.getString("title"); const EmbedSubject = interaction.options.getString("message"); + const EmbedColour = interaction.options.getString("color"); + const EmbedThumbnail = interaction.options.getString("thumbnail"); + const EmbedImage = interaction.options.getString("image"); + const EmbedFieldContent = interaction.options.getString("fieldcontent"); + const EmbedFieldTitle = interaction.options.getString("fieldtitle"); const EmbedMsg = new Discord.MessageEmbed() .setTitle(EmbedTitle) - .setDescription(EmbedSubject); + .setDescription(EmbedSubject) + .addField(EmbedFieldTitle, EmbedFieldContent) + .setColor(EmbedColour) + .setThumbnail(EmbedThumbnail) + .setImage(EmbedImage); interaction.reply({ embeds: [EmbedMsg], diff --git a/Configs/supportbot.yml b/Configs/supportbot.yml index ec52303..63a8287 100644 --- a/Configs/supportbot.yml +++ b/Configs/supportbot.yml @@ -10,7 +10,7 @@ # Discord Support: https://emeraldsrv.dev/discord # Community Resources: https://emeraldsrv.dev/resources -SupportBot_Version: "7.4.2" +SupportBot_Version: "7.5" # ------------------------- # General Configuration @@ -85,7 +85,7 @@ SuggestionDownvote: "❌" TicketCategory: "Tickets" # Only for tickets without a category TicketPrefix: "ticket-" # The prefix for ticket channel names -TicketLog: "logs" +TicketLog: "ticket-logs" TranscriptLog: "transcripts" DMTranscripts: true diff --git a/Data/ticket-panel-id.json b/Data/ticket-panel-id.json index feb5b04..6bd01c2 100644 --- a/Data/ticket-panel-id.json +++ b/Data/ticket-panel-id.json @@ -1,4 +1 @@ -{ - "id": 0, - "TicketPanelID": "" -} +{"id":0,"TicketPanelID":"947337678720999458"} \ No newline at end of file diff --git a/Events/guildMemberAdd.js b/Events/guildMemberAdd.js new file mode 100644 index 0000000..f2767ee --- /dev/null +++ b/Events/guildMemberAdd.js @@ -0,0 +1,32 @@ + +const Discord = require('discord.js'); +const fs = require("fs"); +const Event = require("../Structures/Event.js"); +const yaml = require("js-yaml"); +const supportbot = yaml.load( + fs.readFileSync("./Configs/supportbot.yml", "utf8") +); + +module.exports = new Event("guildMemberAdd", async (client, member, interaction, guild) => { + + const WelcomeChannel = interaction.guild.channels.get(supportbot.WelcomeChannel) + + const WelcomeEmbed = new Discord.MessageEmbed() + .setColor(supportbot.WelcomeColour) + .setTitle(supportbot.WelcomeTitle) + .setDescription(supportbot.WelcomeMessage.replace(/%joined_user%/g, member.user)) + .setThumbnail(member.user.displayAvatarURL()) + .setTimestamp(); + + member.guild.channels.cache.get( + supportbot.WelcomeChannel).send({ + embeds: [WelcomeEmbed] + + }) + + + const WelcomeMsg = await WelcomeChannel.send({ + embeds: [WelcomeEmbed] + }); + +}); diff --git a/Events/ready.js b/Events/ready.js index 2550984..e154785 100644 --- a/Events/ready.js +++ b/Events/ready.js @@ -14,7 +14,7 @@ const panelconfig = yaml.load( const Event = require("../Structures/Event.js"); -module.exports = new Event("ready", async (client) => { +module.exports = new Event("ready", async (client, interaction) => { const { getRole, getChannel, getCategory } = client; client.user.setActivity(supportbot.BotActivity, { type: supportbot.ActivityType,