Compare commits
38
Commits
v8.4-Beta-2
...
v8.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4af9759700 | ||
|
|
835cbbe937 | ||
|
|
491bb9ba65 | ||
|
|
ced29535f9 | ||
|
|
d99e9a105b | ||
|
|
c72c7c5c34 | ||
|
|
23960bc30d | ||
|
|
abb48c281b | ||
|
|
7acb825713 | ||
|
|
dd2f329485 | ||
|
|
75577ec0bd | ||
|
|
7366bcda71 | ||
|
|
23e43cfad3 | ||
|
|
ad9a8085aa | ||
|
|
2f23e8f23d | ||
|
|
4c07b8a236 | ||
|
|
571bd586fa | ||
|
|
eac2d88873 | ||
|
|
93c793f393 | ||
|
|
1aa97b63f9 | ||
|
|
c1b76a2b84 | ||
|
|
a1429aa723 | ||
|
|
2de7c7b19c | ||
|
|
dc88f6c51a | ||
|
|
d69fb0e26d | ||
|
|
4b2d53d3f4 | ||
|
|
e3fa8b6d72 | ||
|
|
71e33dbf66 | ||
|
|
d468ab1575 | ||
|
|
74482af471 | ||
|
|
3cdfaef942 | ||
|
|
fcf441a190 | ||
|
|
58eb37124e | ||
|
|
afeeda3a8d | ||
|
|
357a85fa3d | ||
|
|
1bb343e49a | ||
|
|
dffa5d4161 | ||
|
|
6e14ce209d |
No files matched your search
@@ -0,0 +1,26 @@
|
|||||||
|
const Discord = require("discord.js");
|
||||||
|
const fs = require("fs");
|
||||||
|
const yaml = require("js-yaml");
|
||||||
|
const { Command } = require('../Structures/Addon.js'); // Adjust the path as needed
|
||||||
|
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
|
||||||
|
|
||||||
|
module.exports = new Command({
|
||||||
|
name: "addon",
|
||||||
|
description: "This is a sample addon!",
|
||||||
|
options: [],
|
||||||
|
permissions: ["Administrator"],
|
||||||
|
|
||||||
|
async run(interaction) {
|
||||||
|
let disableCommand = true;
|
||||||
|
|
||||||
|
const PingEmbed = new Discord.EmbedBuilder()
|
||||||
|
.setDescription(
|
||||||
|
`This is a sample addon.\n\nPong! \`${interaction.client.ws.ping} ms\``
|
||||||
|
)
|
||||||
|
.setColor(supportbot.Embed.Colours.General);
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [PingEmbed],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
+70
-43
@@ -289,112 +289,141 @@ function parseMarkdown(content) {
|
|||||||
function createTranscriptHTML(ticket, reason) {
|
function createTranscriptHTML(ticket, reason) {
|
||||||
return `
|
return `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Ticket Transcript</title>
|
||||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background: url('file-EWLgzFEYsq16ANVg6ENJrP.png') no-repeat center center fixed;
|
background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
|
||||||
background-size: cover;
|
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
color: #ffffff;
|
color: #e5e7eb;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 20px;
|
padding: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
margin: 0 auto;
|
margin: auto;
|
||||||
padding: 20px;
|
padding: 25px;
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
background: rgba(0,0,0,0.4);
|
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
box-shadow: 0 8px 32px rgba(0,0,0,0.5);
|
backdrop-filter: blur(18px) saturate(180%);
|
||||||
|
background: rgba(17, 25, 40, 0.75);
|
||||||
|
box-shadow: 0 8px 32px rgba(0,0,0,0.6);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2.5rem;
|
font-size: 2rem;
|
||||||
font-weight: bold;
|
font-weight: 700;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
color: #22c55e; /* green accent */
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
text-shadow: 0 0 4px rgba(34,197,94,0.4); /* subtle glow */
|
||||||
|
}
|
||||||
|
|
||||||
|
.ticket-info {
|
||||||
|
margin-bottom: 25px;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ticket-info p {
|
.ticket-info p {
|
||||||
margin: 5px 0;
|
margin: 6px 0;
|
||||||
|
font-size: 0.95rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
backdrop-filter: blur(15px);
|
|
||||||
background: rgba(255, 255, 255, 0.05);
|
background: rgba(255, 255, 255, 0.05);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
padding: 15px;
|
padding: 16px;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
transition: transform 0.2s;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message:hover {
|
.message:hover {
|
||||||
transform: scale(1.02);
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 6px 20px rgba(0,0,0,0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-header {
|
.message-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 50px;
|
width: 45px;
|
||||||
height: 50px;
|
height: 45px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-right: 15px;
|
margin-right: 12px;
|
||||||
border: 2px solid rgba(255,255,255,0.3);
|
border: 2px solid rgba(34,197,94,0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.username {
|
.username {
|
||||||
font-weight: bold;
|
font-weight: 600;
|
||||||
color: #00ffe4;
|
color: #22c55e;
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.timestamp {
|
.timestamp {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
color: #aaa;
|
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
|
color: #9ca3af;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
font-size: 1rem;
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.embed {
|
.embed {
|
||||||
border-left: 4px solid #00ffe4;
|
margin-top: 12px;
|
||||||
padding-left: 10px;
|
border-left: 4px solid #22c55e;
|
||||||
margin: 10px 0;
|
padding-left: 12px;
|
||||||
background: rgba(255, 255, 255, 0.05);
|
border-radius: 6px;
|
||||||
border-radius: 10px;
|
background: rgba(34,197,94,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.embed strong {
|
||||||
|
color: #f9fafb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment {
|
.attachment {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background-color: rgba(0, 255, 228, 0.1);
|
background: rgba(34,197,94,0.1);
|
||||||
border: 1px solid #00ffe4;
|
border: 1px solid #22c55e;
|
||||||
border-radius: 5px;
|
border-radius: 6px;
|
||||||
padding: 5px 10px;
|
padding: 6px 12px;
|
||||||
margin: 5px 0;
|
margin: 6px 0;
|
||||||
color: #00ffe4;
|
color: #22c55e;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attachment:hover {
|
||||||
|
background: rgba(34,197,94,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
code, pre {
|
||||||
|
background: rgba(0,0,0,0.4);
|
||||||
|
color: #f8fafc;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: 'Consolas', 'Monaco', monospace;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Ticket Transcript</h1>
|
<h1>Ticket Transcript</h1>
|
||||||
<div class="ticket-info mb-6">
|
<div class="ticket-info">
|
||||||
<p><strong>Channel:</strong> ${ticket.name}</p>
|
<p><strong>Channel:</strong> ${ticket.name}</p>
|
||||||
<p><strong>Ticket ID:</strong> ${ticket.id}</p>
|
<p><strong>Ticket ID:</strong> ${ticket.id}</p>
|
||||||
<p><strong>Message Count:</strong> ${ticket.messages.length}</p>
|
<p><strong>Message Count:</strong> ${ticket.messages.length}</p>
|
||||||
@@ -426,9 +455,7 @@ function createTranscriptHTML(ticket, reason) {
|
|||||||
`).join('')}
|
`).join('')}
|
||||||
|
|
||||||
${msg.attachments.map(att => `
|
${msg.attachments.map(att => `
|
||||||
<a href="${att.url}" class="attachment" target="_blank">
|
<a href="${att.url}" class="attachment" target="_blank">📎 ${att.name}</a>
|
||||||
📎 ${att.name}
|
|
||||||
</a>
|
|
||||||
`).join('')}
|
`).join('')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
// SupportBot | Emerald Services
|
||||||
|
// Info Command
|
||||||
|
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
const {
|
||||||
|
EmbedBuilder,
|
||||||
|
ApplicationCommandOptionType,
|
||||||
|
ApplicationCommandType,
|
||||||
|
ChannelType,
|
||||||
|
ActionRowBuilder,
|
||||||
|
ButtonBuilder,
|
||||||
|
StringSelectMenuBuilder,
|
||||||
|
StringSelectMenuOptionBuilder,
|
||||||
|
ButtonStyle,
|
||||||
|
MessageCollector,
|
||||||
|
MessageFlags,
|
||||||
|
ModalBuilder,
|
||||||
|
TextInputBuilder,
|
||||||
|
TextInputStyle,
|
||||||
|
SeparatorBuilder,
|
||||||
|
ContainerBuilder,
|
||||||
|
TextDisplayBuilder
|
||||||
|
} = 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 msgconfig = yaml.load(
|
||||||
|
fs.readFileSync("./Configs/messages.yml", "utf8")
|
||||||
|
);
|
||||||
|
|
||||||
|
const Command = require("../../Structures/Command.js");
|
||||||
|
|
||||||
|
module.exports = new Command({
|
||||||
|
name: cmdconfig.TicketRename.Command,
|
||||||
|
description: cmdconfig.TicketRename.Description,
|
||||||
|
options: [],
|
||||||
|
permissions: cmdconfig.TicketRename.Permission,
|
||||||
|
|
||||||
|
async run(interaction) {
|
||||||
|
const modal = new ModalBuilder()
|
||||||
|
.setCustomId("renameTicketModal")
|
||||||
|
.setTitle("Rename Channel")
|
||||||
|
.addComponents(
|
||||||
|
new ActionRowBuilder().addComponents(
|
||||||
|
new TextInputBuilder()
|
||||||
|
.setCustomId("renameTicket")
|
||||||
|
.setLabel("New Channel Name")
|
||||||
|
.setStyle(TextInputStyle.Short)
|
||||||
|
.setRequired(true)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return interaction.showModal(modal);
|
||||||
|
},
|
||||||
|
});
|
||||||
+58
-24
@@ -11,6 +11,9 @@ const {
|
|||||||
ButtonStyle,
|
ButtonStyle,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
MessageFlags,
|
MessageFlags,
|
||||||
|
SeparatorBuilder,
|
||||||
|
ContainerBuilder,
|
||||||
|
TextDisplayBuilder
|
||||||
} = require("discord.js");
|
} = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
|
|
||||||
@@ -455,32 +458,61 @@ module.exports = new Command({
|
|||||||
.setColor(supportbot.Embed.Colours.General);
|
.setColor(supportbot.Embed.Colours.General);
|
||||||
await interaction.reply({ embeds: [CreatedTicket], flags: MessageFlags.Ephemeral });
|
await interaction.reply({ embeds: [CreatedTicket], flags: MessageFlags.Ephemeral });
|
||||||
|
|
||||||
const TicketMessage = new EmbedBuilder()
|
// TICKET MESSAGE - UPDATED WITH COMPONENTS V2
|
||||||
.setAuthor({
|
|
||||||
name: msgconfig.Ticket.TicketAuthorTitle.replace(/%ticketauthor%/g, interaction.user.id)
|
const ticketMsgContainer = new ContainerBuilder()
|
||||||
.replace(/%ticketid%/g, ticketChannel.id)
|
|
||||||
.replace(/%ticketusername%/g, interaction.user.username),
|
if (supportbot.Embed.Colours.General) {
|
||||||
iconURL: interaction.user.displayAvatarURL(),
|
ticketMsgContainer.setAccentColor(
|
||||||
})
|
parseInt(supportbot.Embed.Colours.General.replace("#", ""), 16)
|
||||||
.setTitle(
|
|
||||||
msgconfig.Ticket.TicketTitle.replace(/%ticketauthor%/g, interaction.user.id)
|
|
||||||
.replace(/%ticketid%/g, ticketChannel.id)
|
|
||||||
.replace(/%ticketusername%/g, interaction.user.username)
|
|
||||||
)
|
)
|
||||||
.setDescription(
|
}
|
||||||
msgconfig.Ticket.TicketMessage.replace(/%ticketauthor%/g, interaction.user.id)
|
|
||||||
.replace(/%ticketid%/g, ticketChannel.id)
|
const ticketAuthor = new TextDisplayBuilder().setContent(
|
||||||
.replace(/%ticketusername%/g, interaction.user.username)
|
msgconfig.Ticket.TicketAuthorTitle.replace(/%ticketauthor%/g, interaction.user.id)
|
||||||
.replace(/%ticketreason%/g, TicketSubject)
|
.replace(/%ticketid%/g, ticketChannel.id)
|
||||||
)
|
.replace(/%ticketusername%/g, interaction.user.username),
|
||||||
.setColor(supportbot.Embed.Colours.General);
|
);
|
||||||
|
|
||||||
|
ticketMsgContainer.addTextDisplayComponents(ticketAuthor)
|
||||||
|
|
||||||
|
const ticketTitle = new TextDisplayBuilder().setContent(
|
||||||
|
msgconfig.Ticket.TicketTitle.replace(/%ticketauthor%/g, interaction.user.id)
|
||||||
|
.replace(/%ticketid%/g, ticketChannel.id)
|
||||||
|
.replace(/%ticketusername%/g, interaction.user.username)
|
||||||
|
);
|
||||||
|
|
||||||
|
ticketMsgContainer.addTextDisplayComponents(ticketTitle)
|
||||||
|
|
||||||
|
const seperator2 = new SeparatorBuilder()
|
||||||
|
.setDivider(true)
|
||||||
|
|
||||||
|
ticketMsgContainer.addSeparatorComponents(seperator2)
|
||||||
|
|
||||||
|
const ticketDescription = new TextDisplayBuilder().setContent(
|
||||||
|
msgconfig.Ticket.TicketMessage.replace(/%ticketauthor%/g, interaction.user.id)
|
||||||
|
.replace(/%ticketid%/g, ticketChannel.id)
|
||||||
|
.replace(/%ticketusername%/g, interaction.user.username)
|
||||||
|
.replace(/%ticketreason%/g, TicketSubject)
|
||||||
|
);
|
||||||
|
|
||||||
|
ticketMsgContainer.addTextDisplayComponents(ticketDescription)
|
||||||
|
|
||||||
|
const seperator3 = new SeparatorBuilder()
|
||||||
|
.setDivider(true)
|
||||||
|
|
||||||
|
ticketMsgContainer.addSeparatorComponents(seperator3)
|
||||||
|
|
||||||
|
const ticketReason = new TextDisplayBuilder().setContent(
|
||||||
|
`**Reason:**\n ${TicketReason}`
|
||||||
|
);
|
||||||
|
|
||||||
if (supportbot.Ticket.TicketReason && TicketReason) {
|
if (supportbot.Ticket.TicketReason && TicketReason) {
|
||||||
TicketMessage.addFields(
|
ticketMsgContainer.addTextDisplayComponents(ticketReason)
|
||||||
{ name: "Reason", value: TicketReason, inline: false }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectMenuRow = new ActionRowBuilder();
|
||||||
|
|
||||||
const SelectMenus = new StringSelectMenuBuilder()
|
const SelectMenus = new StringSelectMenuBuilder()
|
||||||
.setCustomId("ticketcontrolpanel")
|
.setCustomId("ticketcontrolpanel")
|
||||||
.setPlaceholder("Ticket Control Panel")
|
.setPlaceholder("Ticket Control Panel")
|
||||||
@@ -529,11 +561,13 @@ module.exports = new Command({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const row2 = new ActionRowBuilder().addComponents(SelectMenus);
|
selectMenuRow.addComponents(SelectMenus)
|
||||||
|
|
||||||
|
ticketMsgContainer.addActionRowComponents(selectMenuRow)
|
||||||
|
|
||||||
await ticketChannel.send({
|
await ticketChannel.send({
|
||||||
embeds: [TicketMessage],
|
flags: MessageFlags.IsComponentsV2,
|
||||||
components: [row2],
|
components: [ticketMsgContainer],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (supportbot.Ticket.Questions.Enabled) {
|
if (supportbot.Ticket.Questions.Enabled) {
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ const {
|
|||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
ButtonBuilder,
|
ButtonBuilder,
|
||||||
MessageFlags,
|
MessageFlags,
|
||||||
|
ContainerBuilder,
|
||||||
|
TextDisplayBuilder,
|
||||||
|
MediaGalleryBuilder,
|
||||||
|
SeparatorBuilder,
|
||||||
|
ThumbnailBuilder,
|
||||||
|
SectionBuilder
|
||||||
} = require("discord.js");
|
} = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
|
|
||||||
@@ -52,6 +58,7 @@ module.exports = new Command({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const panelRow = db.getTicketPanel();
|
const panelRow = db.getTicketPanel();
|
||||||
|
|
||||||
if (panelRow) {
|
if (panelRow) {
|
||||||
try {
|
try {
|
||||||
await channel.messages.fetch(panelRow.message_id);
|
await channel.messages.fetch(panelRow.message_id);
|
||||||
@@ -62,24 +69,35 @@ module.exports = new Command({
|
|||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let embed = new EmbedBuilder()
|
const panelContainer = new ContainerBuilder()
|
||||||
.setTitle(panelconfig.PanelTitle)
|
|
||||||
.setColor(panelconfig.PanelColour)
|
|
||||||
.setFooter({
|
|
||||||
text: supportbot.Embed.Footer,
|
|
||||||
iconURL: interaction.user.displayAvatarURL(),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (panelconfig.TicketPanel_Description) {
|
if (panelconfig.Style.Color) {
|
||||||
embed.setDescription(panelconfig.PanelMessage);
|
panelContainer.setAccentColor(
|
||||||
|
parseInt(panelconfig.Style.Color.replace("#", ""), 16)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panelconfig.TicketPanel_Thumbnail) {
|
const panelTitle = new TextDisplayBuilder().setContent(
|
||||||
embed.setThumbnail(panelconfig.PanelThumbnail);
|
panelconfig.Style.Title,
|
||||||
|
);
|
||||||
|
|
||||||
|
const topSeperator = new SeparatorBuilder()
|
||||||
|
.setDivider(true)
|
||||||
|
|
||||||
|
if (panelconfig.Settings.TopTitle) {
|
||||||
|
panelContainer.addTextDisplayComponents(panelTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panelconfig.TicketPanel_Image) {
|
if (panelconfig.Settings.TopDivider) {
|
||||||
embed.setImage(panelconfig.PanelImage);
|
panelContainer.addSeparatorComponents(topSeperator)
|
||||||
|
}
|
||||||
|
|
||||||
|
const panelDesc = new TextDisplayBuilder().setContent(
|
||||||
|
panelconfig.Style.Description,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (panelconfig.Style.Layout === "3") {
|
||||||
|
panelContainer.addTextDisplayComponents(panelDesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
const createTicketButton = new ButtonBuilder()
|
const createTicketButton = new ButtonBuilder()
|
||||||
@@ -88,12 +106,62 @@ module.exports = new Command({
|
|||||||
.setEmoji(panelconfig.Button.Emoji)
|
.setEmoji(panelconfig.Button.Emoji)
|
||||||
.setStyle(panelconfig.Button.Color);
|
.setStyle(panelconfig.Button.Color);
|
||||||
|
|
||||||
let row = new ActionRowBuilder().addComponents(createTicketButton);
|
const middleSection = new SectionBuilder()
|
||||||
|
.addTextDisplayComponents(panelDesc)
|
||||||
|
.setButtonAccessory(createTicketButton)
|
||||||
|
|
||||||
|
if (panelconfig.Style.Layout === "1") {
|
||||||
|
panelContainer.addSectionComponents(middleSection)
|
||||||
|
}
|
||||||
|
|
||||||
|
const panelImage = new MediaGalleryBuilder()
|
||||||
|
.addItems([
|
||||||
|
{
|
||||||
|
media: {
|
||||||
|
url: panelconfig.Style.Image,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
if (panelconfig.Settings.Image) {
|
||||||
|
panelContainer.addMediaGalleryComponents(panelImage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// START OF STYLE 2 - TEXT UNDER THE IMAGE
|
||||||
|
|
||||||
|
const bottomSeperator = new SeparatorBuilder()
|
||||||
|
.setDivider(true)
|
||||||
|
|
||||||
|
if (panelconfig.Settings.BottomTitle) {
|
||||||
|
panelContainer.addTextDisplayComponents(panelTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (panelconfig.Settings.BottomDivider) {
|
||||||
|
panelContainer.addSeparatorComponents(bottomSeperator)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (panelconfig.Style.Layout === "2") {
|
||||||
|
panelContainer.addSectionComponents(middleSection)
|
||||||
|
}
|
||||||
|
|
||||||
|
// START OF STYLE 3
|
||||||
|
|
||||||
|
const buttonRow = new ActionRowBuilder();
|
||||||
|
const ticketButtonRow = new ButtonBuilder()
|
||||||
|
.setCustomId("createticket")
|
||||||
|
.setLabel(panelconfig.Button.Text)
|
||||||
|
.setEmoji(panelconfig.Button.Emoji)
|
||||||
|
.setStyle(panelconfig.Button.Color);
|
||||||
|
buttonRow.addComponents(ticketButtonRow)
|
||||||
|
|
||||||
|
if (panelconfig.Style.Layout === "3") {
|
||||||
|
panelContainer.addActionRowComponents(buttonRow)
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const message = await channel.send({
|
const message = await channel.send({
|
||||||
embeds: [embed],
|
flags: MessageFlags.IsComponentsV2,
|
||||||
components: [row],
|
components: [panelContainer],
|
||||||
});
|
});
|
||||||
|
|
||||||
db.saveTicketPanel(message.id, channel.id);
|
db.saveTicketPanel(message.id, channel.id);
|
||||||
|
|||||||
@@ -37,12 +37,21 @@ Profile:
|
|||||||
Permission: ["SendMessages"]
|
Permission: ["SendMessages"]
|
||||||
# Command is automatically disabled when the TicketClaims is disabled.
|
# Command is automatically disabled when the TicketClaims is disabled.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OpenTicket:
|
OpenTicket:
|
||||||
Command: "ticket"
|
Command: "ticket"
|
||||||
Description: "Create a support ticket."
|
Description: "Create a support ticket."
|
||||||
Permission: ["SendMessages"]
|
Permission: ["SendMessages"]
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
TicketRename:
|
||||||
|
Command: "rename"
|
||||||
|
Description: "Rename a support ticket."
|
||||||
|
Permission: ["SendMessages"]
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
|
||||||
AddUser:
|
AddUser:
|
||||||
Command: "add"
|
Command: "add"
|
||||||
Description: "Add a user to a support ticket."
|
Description: "Add a user to a support ticket."
|
||||||
|
|||||||
+13
-8
@@ -117,8 +117,18 @@ Ticket:
|
|||||||
# <@%ticketauthor%> - Tags the user who created the ticket.
|
# <@%ticketauthor%> - Tags the user who created the ticket.
|
||||||
# <#%ticketid%> - Mentions the ticket channel.
|
# <#%ticketid%> - Mentions the ticket channel.
|
||||||
|
|
||||||
TicketAuthorTitle: "%ticketusername%'s Ticket"
|
# You can use Markdown formatting in this message:
|
||||||
TicketTitle: "Support Ticket"
|
# # Heading 1
|
||||||
|
# ## Heading 2
|
||||||
|
# ### Heading 3
|
||||||
|
# **Bold** text
|
||||||
|
# *Italic* text
|
||||||
|
# -# Small text
|
||||||
|
# - Bullet points
|
||||||
|
# Links: [text](https://example.com)
|
||||||
|
|
||||||
|
TicketAuthorTitle: "-# %ticketusername%'s Ticket"
|
||||||
|
TicketTitle: "## Support Ticket"
|
||||||
TicketMessage: "Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
|
TicketMessage: "Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
|
||||||
TicketThumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
|
TicketThumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
|
||||||
TicketCreatedAlert: ":ticket: Ticked Created: <#%ticketid%>"
|
TicketCreatedAlert: ":ticket: Ticked Created: <#%ticketid%>"
|
||||||
@@ -315,9 +325,4 @@ Error:
|
|||||||
EntryAlreadyExists: ":warning: Cannot complete the action, as the entry already exists."
|
EntryAlreadyExists: ":warning: Cannot complete the action, as the entry already exists."
|
||||||
EntryDoesNotExist: ":warning: Cannot complete the action, as the entry does not exist."
|
EntryDoesNotExist: ":warning: Cannot complete the action, as the entry does not exist."
|
||||||
ActionFailed: ":x: **Error!** An error occurred while processing your request. Please try again later."
|
ActionFailed: ":x: **Error!** An error occurred while processing your request. Please try again later."
|
||||||
|
InvalidChannel: ":x: **Error!** The suggestions channel has not been set up correctly."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+33
-34
@@ -13,7 +13,7 @@
|
|||||||
#
|
#
|
||||||
# SupportBot Configuration (supportbot.yml)
|
# SupportBot Configuration (supportbot.yml)
|
||||||
|
|
||||||
SupportBot_Version: "v8.4-DEV-2"
|
SupportBot_Version: "v8.5"
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# General
|
# General
|
||||||
@@ -21,7 +21,7 @@ SupportBot_Version: "v8.4-DEV-2"
|
|||||||
|
|
||||||
General:
|
General:
|
||||||
Name: "SupportBot"
|
Name: "SupportBot"
|
||||||
Token: ""
|
Token: "BBOT_TOKEN_HERE"
|
||||||
|
|
||||||
Addons:
|
Addons:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@@ -50,10 +50,10 @@ Activity:
|
|||||||
|
|
||||||
Embed:
|
Embed:
|
||||||
Colours:
|
Colours:
|
||||||
General: 0x0cc559
|
General: "#0cc559"
|
||||||
Success: 0x04b545
|
Success: "#04b545"
|
||||||
Error: 0xd13030
|
Error: "#d13030"
|
||||||
Warn: 0xfca117
|
Warn: "#fca117"
|
||||||
|
|
||||||
Footer: "SupportBot | Developed by Emerald Development"
|
Footer: "SupportBot | Developed by Emerald Development"
|
||||||
|
|
||||||
@@ -66,12 +66,12 @@ Embed:
|
|||||||
Roles:
|
Roles:
|
||||||
AutoRole:
|
AutoRole:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Role: "1202669457751801917"
|
Role: "ROLE_ID"
|
||||||
|
|
||||||
StaffMember:
|
StaffMember:
|
||||||
Staff: "996420644373811371"
|
Staff: "ROLE_ID"
|
||||||
Admin: "996419960442208326"
|
Admin: "ROLE_ID"
|
||||||
Moderator: "996420644373811371"
|
Moderator: "ROLE_ID"
|
||||||
|
|
||||||
Mod:
|
Mod:
|
||||||
AllowSupportStaff: false
|
AllowSupportStaff: false
|
||||||
@@ -84,11 +84,11 @@ Roles:
|
|||||||
|
|
||||||
Welcome:
|
Welcome:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Channel: "1295788797065166869"
|
Channel: "WELCOME_CHANNEL_ID"
|
||||||
|
|
||||||
Leave:
|
Leave:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Channel: "1295788797065166869"
|
Channel: "LEAVE_CHANNEL_ID "
|
||||||
|
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Suggestions
|
# Suggestions
|
||||||
@@ -96,8 +96,8 @@ Leave:
|
|||||||
|
|
||||||
Suggestions:
|
Suggestions:
|
||||||
Mode: "Channel" # Channel or Forum
|
Mode: "Channel" # Channel or Forum
|
||||||
ForumChannel: "1402655496477081671"
|
ForumChannel: "FORUM_CHANNEL_ID" # A forum channel, disabled if mode is set to Channel.
|
||||||
Channel: "1295788900094316706"
|
Channel: "SUGGESTIONS_CHANNEL_ID" # A text channel, disabled if mode is set to Forum.
|
||||||
|
|
||||||
UpvoteEmoji: "✅"
|
UpvoteEmoji: "✅"
|
||||||
DownvoteEmoji: "❌"
|
DownvoteEmoji: "❌"
|
||||||
@@ -130,10 +130,10 @@ Suggestions:
|
|||||||
# 4 - Red
|
# 4 - Red
|
||||||
|
|
||||||
Tags:
|
Tags:
|
||||||
Created: "1418937323118137435"
|
Created: "TAG_ID"
|
||||||
Considering: "1418937237156139130"
|
Considering: "TAG_ID"
|
||||||
Solved: "1418937168029679697"
|
Solved: "TAG_ID"
|
||||||
Denied: "1418937185469464647"
|
Denied: "TAG_ID"
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Tickets
|
# Tickets
|
||||||
@@ -141,25 +141,25 @@ Suggestions:
|
|||||||
|
|
||||||
VoiceTickets:
|
VoiceTickets:
|
||||||
Name: "%username%'s VC"
|
Name: "%username%'s VC"
|
||||||
Category: "1419062819688550460"
|
Category: "VC_CATEGORY_ID"
|
||||||
|
|
||||||
Ticket:
|
Ticket:
|
||||||
TicketType: "threads"
|
TicketType: "channels"
|
||||||
|
|
||||||
# Available TicketTypes:
|
# Available TicketTypes:
|
||||||
# channels - Tickets will be created as channels in the TicketChannelsCategory
|
# channels - Tickets will be created as channels in the TicketChannelsCategory
|
||||||
# threads - Tickets will be created as threads through the "TicketHome" channel.
|
# threads - Tickets will be created as threads through the "TicketHome" channel.
|
||||||
|
|
||||||
TicketHome: "1295784943204700171"
|
TicketHome: "TICKET_HOME_CHANNEL_ID"
|
||||||
|
|
||||||
# What is TicketHome?
|
# What is TicketHome?
|
||||||
# - Channel where the Ticket creation panel is sent.
|
# - Channel where the Ticket creation panel is sent.
|
||||||
# - Channel where ticket threads are made. (only if ticket threads is enabled above.)
|
# - Channel where ticket threads are made. (only if ticket threads is enabled above.)
|
||||||
|
|
||||||
# For TicketType: channels
|
# For TicketType: channels
|
||||||
TicketChannelsCategory: "1418988408193155112"
|
TicketChannelsCategory: "TICKET_CHANNELS_CATEGORY_ID"
|
||||||
TicketChannelsCategory2: "1418988456167870615" # This will be used if the first category has reached the max channel limit.
|
TicketChannelsCategory2: "TICKET_CHANNELS_CATEGORY_ID_2" # This will be used if the first category has reached the max channel limit.
|
||||||
TicketArchiveCategory: "1418988434600759348"
|
TicketArchiveCategory: "TICKET_ARCHIVE_CATEGORY_ID"
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
Channel: "ticket-" # The prefix for ticket channel names
|
Channel: "ticket-" # The prefix for ticket channel names
|
||||||
@@ -197,8 +197,8 @@ Ticket:
|
|||||||
StaffOnly: true
|
StaffOnly: true
|
||||||
|
|
||||||
ClaimTickets:
|
ClaimTickets:
|
||||||
Enabled: true
|
Enabled: false
|
||||||
Channel: "1295789389619793961"
|
Channel: "CLAIM_TICKETS_CHANNEL_ID"
|
||||||
# Channel where the ticket assignments are sent for staff to claim.
|
# Channel where the ticket assignments are sent for staff to claim.
|
||||||
|
|
||||||
ClaimAcceptTime: 120000
|
ClaimAcceptTime: 120000
|
||||||
@@ -220,8 +220,8 @@ Ticket:
|
|||||||
# 4 - Red
|
# 4 - Red
|
||||||
|
|
||||||
ReviewSystem:
|
ReviewSystem:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
Channel: "1304480728884445225"
|
Channel: "REVIEW_CHANNEL_ID"
|
||||||
UseModal: true
|
UseModal: true
|
||||||
|
|
||||||
Questions:
|
Questions:
|
||||||
@@ -232,9 +232,9 @@ Ticket:
|
|||||||
- "Have you tried resolving the issue yourself?"
|
- "Have you tried resolving the issue yourself?"
|
||||||
|
|
||||||
Log:
|
Log:
|
||||||
TicketDataLog: "1339271338761650290"
|
TicketDataLog: "TICKKET_DATA_LOG_CHANNEL_ID"
|
||||||
TickeDataTitle: "Ticket Data"
|
TickeDataTitle: "Ticket Data"
|
||||||
TicketBlacklistLog: "1339271338761650290"
|
TicketBlacklistLog: "TICKET_BLACKLIST_LOG_CHANNEL_ID"
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Buttons
|
# Buttons
|
||||||
@@ -258,7 +258,6 @@ Buttons:
|
|||||||
Unlock: "Unlock Ticket"
|
Unlock: "Unlock Ticket"
|
||||||
Unlock_Emoji: "🔓"
|
Unlock_Emoji: "🔓"
|
||||||
Unlock_Style: "2"
|
Unlock_Style: "2"
|
||||||
|
|
||||||
# Available Button Styles
|
# Available Button Styles
|
||||||
# 1 - Blurple
|
# 1 - Blurple
|
||||||
# 2 - Grey
|
# 2 - Grey
|
||||||
@@ -287,12 +286,12 @@ SelectMenus:
|
|||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
MessageDelete:
|
MessageDelete:
|
||||||
Channel: "1202671982932402246"
|
Channel: "LOG_CHANNEL_ID"
|
||||||
Colour: "#d92525"
|
Colour: "#d92525"
|
||||||
|
|
||||||
MessageUpdate:
|
MessageUpdate:
|
||||||
Channel: "1202671982932402246"
|
Channel: "LOG_CHANNEL_ID"
|
||||||
Colour: "#f2a024"
|
Colour: "#f2a024"
|
||||||
|
|
||||||
Translate:
|
Translate:
|
||||||
TranslateLog: "1202671982932402246"
|
TranslateLog: "LOG_CHANNEL_ID"
|
||||||
+25
-11
@@ -19,19 +19,28 @@
|
|||||||
|
|
||||||
Panel: true
|
Panel: true
|
||||||
|
|
||||||
LayoutStyle: modern
|
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Ticket Panel Message Configuration #2b2d31
|
# Ticket Panel Message Configuration #2b2d31
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
|
|
||||||
PanelTitle: "SupportBot"
|
Style:
|
||||||
PanelColour: "#0cc559"
|
Title: "## SupportBot Ticket Creation"
|
||||||
|
Description: "Click on the button to file a `Ticket` and our team will try their best to assist you in the best way we can!"
|
||||||
|
Image: "https://i.imgur.com/dejQvkg.png"
|
||||||
|
Color: "#45b463"
|
||||||
|
# Leave Color empty to remove the color from the embed/container.
|
||||||
|
|
||||||
|
Layout: "3"
|
||||||
|
|
||||||
|
# Available Layout Styles
|
||||||
|
# "1" - Style 1 - Title & Text, Button at the top -- Image at the bottom
|
||||||
|
# "2" - Style 2 - Title & Text, Button at the bottom -- Image at the top
|
||||||
|
# "3" - Style 3 - The classic look - Title & Text at the top -- Image in the middle -- Button at the bottom
|
||||||
|
|
||||||
Button:
|
Button:
|
||||||
Text: "Create Ticket"
|
Text: "Create Ticket"
|
||||||
Emoji: "🎫"
|
Emoji: "🎫"
|
||||||
Color: "2"
|
Color: "3"
|
||||||
|
|
||||||
# Available Button Styles
|
# Available Button Styles
|
||||||
# 1 - Blurple
|
# 1 - Blurple
|
||||||
@@ -39,10 +48,15 @@ Button:
|
|||||||
# 3 - Red
|
# 3 - Red
|
||||||
# 4 - Green
|
# 4 - Green
|
||||||
|
|
||||||
TicketPanel_Description: true
|
Settings:
|
||||||
TicketPanel_Thumbnail: false
|
Image: true
|
||||||
TicketPanel_Image: true
|
|
||||||
|
|
||||||
PanelMessage: "Click on the button to file a `Ticket` and our team will try their best to assist you in the best way we can!"
|
# Text and divider will appear above the image.
|
||||||
PanelThumbnail: "https://i.imgur.com/ieeZejl.png"
|
TopTitle: true
|
||||||
PanelImage: "https://i.imgur.com/dejQvkg.png"
|
TopDivider: true
|
||||||
|
|
||||||
|
# Text and divider will appear below the image.
|
||||||
|
BottomTitle: false
|
||||||
|
BottomDivider: false
|
||||||
|
|
||||||
|
# Note: If Image is set to false, the bottom and top settings will look the samme.
|
||||||
@@ -1 +1 @@
|
|||||||
{}
|
|
||||||
@@ -35,10 +35,12 @@ function getWelcomeThumbnail(client, member, iconCfg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildModernComponents(client, member) {
|
function buildModernComponents(client, member) {
|
||||||
const container = new ContainerBuilder().setAccentColor(
|
const container = new ContainerBuilder()
|
||||||
parseInt(msgconfig.Welcome.Modern.Colour.replace("#", ""), 16)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
if (msgconfig.Welcome.Modern.Colour) {
|
||||||
|
container .setAccentColor(parseInt(msgconfig.Welcome.Modern.Colour.replace("#", ""), 16));
|
||||||
|
}
|
||||||
|
|
||||||
const section = new SectionBuilder().addTextDisplayComponents(
|
const section = new SectionBuilder().addTextDisplayComponents(
|
||||||
new TextDisplayBuilder().setContent(
|
new TextDisplayBuilder().setContent(
|
||||||
msgconfig.Welcome.Modern.Title.replace(/%joined_user%/g, member.user)
|
msgconfig.Welcome.Modern.Title.replace(/%joined_user%/g, member.user)
|
||||||
@@ -79,6 +81,7 @@ function buildModernComponents(client, member) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
container.addActionRowComponents(row);
|
container.addActionRowComponents(row);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [container];
|
return [container];
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025 Emerald Services
|
Copyright (c) 2026 Emerald Services
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
| SupportBot | Node.JS | Discord.JS | Supported |
|
| SupportBot | Node.JS | Discord.JS | Supported |
|
||||||
|------------|---------|------------|------------|
|
|------------|---------|------------|------------|
|
||||||
| 8.x | 20.x | 14.x. | ✅ Yes
|
| 8.x | 22.x | 14.x. | ✅ Yes
|
||||||
| 7.7.3 | 16.x | 13.x. | ✅ Yes
|
| 7.7.3 | 16.x | 13.x. | ❌ No
|
||||||
| 7.x | 16.x | 13.x. | ❌ No
|
| 7.x | 16.x | 13.x. | ❌ No
|
||||||
| 6.x | 14.x | 13.x. | ❌ No
|
| 6.x | 14.x | 13.x. | ❌ No
|
||||||
| 5.x | 12.x | 13.x. | ❌ No
|
| 5.x | 12.x | 13.x. | ❌ No
|
||||||
@@ -74,7 +74,7 @@ Released under the [MIT](https://opensource.org/licenses/MIT) license.
|
|||||||
|
|
||||||
- [Official addons repository](https://github.com/Emerald-Services/Addons/)
|
- [Official addons repository](https://github.com/Emerald-Services/Addons/)
|
||||||
- [Syphers Addons](https://github.com/SypherRed/SB_Addons_Unofficial)
|
- [Syphers Addons](https://github.com/SypherRed/SB_Addons_Unofficial)
|
||||||
- [BuiltByBit](https://builtbybit.com/supportbot)
|
- [BuiltByBit]([https://builtbybit.com/supportbot](https://builtbybit.com/resources/supportbot-advanced-ticket-bot.8940/))
|
||||||
- [Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518)
|
- [Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,26 +41,26 @@ logTypes.forEach((type) => {
|
|||||||
|
|
||||||
function logToFile(type, data) {
|
function logToFile(type, data) {
|
||||||
const date = new Date().toISOString().split("T")[0];
|
const date = new Date().toISOString().split("T")[0];
|
||||||
const file = path.join(`./logs/${type}`, `${type}-${date}.log`);
|
const file = path.join(`./Logs/${type}`, `${type}-${date}.log`);
|
||||||
fs.appendFileSync(file, `[${new Date().toISOString()}] ${data}\n`);
|
fs.appendFileSync(file, `[${new Date().toISOString()}] ${data}\n`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const origLog = console.log;
|
const origLog = console.log;
|
||||||
console.log = (...args) => {
|
console.log = (...args) => {
|
||||||
origLog(...args);
|
origLog(...args);
|
||||||
logToFile("output", args.join(" "));
|
logToFile("Output", args.join(" "));
|
||||||
};
|
};
|
||||||
|
|
||||||
const origWarn = console.warn;
|
const origWarn = console.warn;
|
||||||
console.warn = (...args) => {
|
console.warn = (...args) => {
|
||||||
origWarn(...args);
|
origWarn(...args);
|
||||||
logToFile("warn", args.join(" "));
|
logToFile("Warn", args.join(" "));
|
||||||
};
|
};
|
||||||
|
|
||||||
const origError = console.error;
|
const origError = console.error;
|
||||||
console.error = (...args) => {
|
console.error = (...args) => {
|
||||||
origError(...args);
|
origError(...args);
|
||||||
logToFile("error", args.join(" "));
|
logToFile("Error", args.join(" "));
|
||||||
};
|
};
|
||||||
|
|
||||||
process.on("unhandledRejection", (reason) => {
|
process.on("unhandledRejection", (reason) => {
|
||||||
|
|||||||
Reference in new issue
Block a user