v8.0 New configuration files

This commit is contained in:
ItzEmerald committed 2022-08-12 01:35:36 +01:00
1 parent 4eadef8b65
commit c911cb4423
21 files changed
+725 -657

No files matched your search

+21 -12
View File
@@ -5,10 +5,18 @@ 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 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");
@@ -30,9 +38,10 @@ module.exports = new Command({
let disableCommand = true;
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
@@ -40,9 +49,9 @@ module.exports = new Command({
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
`${msgconfig.Error.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``
)
.setColor(supportbot.WarningColour);
.setColor(supportbot.Embed.Colours.Warn);
if (
!interaction.member.roles.cache.has(SupportStaff.id) &&
@@ -59,8 +68,8 @@ module.exports = new Command({
if (ticket === -1) {
const Exists = new Discord.EmbedBuilder()
.setTitle("No Ticket Found!")
.setDescription(supportbot.NoValidTicket)
.setColor(supportbot.WarningColour);
.setDescription(msgconfig.Error.NoValidTicket)
.setColor(supportbot.Embed.Colours.Warn);
return interaction.reply({ ephemeral: true, embeds: [Exists] });
}
@@ -68,20 +77,20 @@ module.exports = new Command({
const UserNotExist = new Discord.EmbedBuilder()
.setTitle("User Not Found!")
.setDescription(
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketAdd} <user#0000>\``
`${msgconfig.Error.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketAdd} <user#0000>\``
)
.setColor(supportbot.ErrorColour);
.setColor(supportbot.Embed.Colours.Error);
if (!uMember) return interaction.reply({ embeds: [UserNotExist] });
await interaction.channel.permissionOverwrites.edit(uMember.id, {
VIEW_CHANNEL: true,
ViewChannel: true,
});
const Complete = new Discord.EmbedBuilder()
.setTitle("User Added!")
.setDescription(supportbot.AddedUser.replace(/%user%/g, uMember.id))
.setDescription(msgconfig.Ticket.AddedUser.replace(/%user%/g, uMember.id))
.setTimestamp()
.setColor(supportbot.GeneralColour);
.setColor(supportbot.Embeds.Colours.General);
interaction.reply({ embeds: [Complete] });
TicketData.tickets[ticket].subUsers.push(uMember.id);
fs.writeFileSync(
+37 -27
View File
@@ -5,10 +5,18 @@ 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 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");
@@ -29,19 +37,21 @@ module.exports = new Command({
let disableCommand = true;
const { getRole, getChannel } = interaction.client;
if (supportbot.StaffOnly) {
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
if (supportbot.Ticket.Close.StaffOnly) {
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
)
.setColor(supportbot.WarningColour);
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``
)
.setColor(supportbot.Embed.Colours.Warn);
if (
!interaction.member.roles.cache.has(SupportStaff.id) &&
@@ -60,31 +70,31 @@ module.exports = new Command({
if (TicketData === -1) {
const Exists = new Discord.EmbedBuilder()
.setTitle("No Ticket Found!")
.setDescription(supportbot.NoValidTicket)
.setColor(supportbot.WarningColour);
.setDescription(msgconfig.Error.NoValidTicket)
.setColor(supportbot.Embed.Colours.Warn);
return interaction.followUp({ embeds: [Exists] });
}
let tUser = interaction.client.users.cache.get(ticket.user);
let transcriptChannel = await getChannel(
supportbot.TranscriptLog,
supportbot.Ticket.Log.TranscriptLog,
interaction.guild
);
let logChannel = await getChannel(supportbot.TicketLog, interaction.guild);
let logChannel = await getChannel(supportbot.Log.TicketLog, interaction.guild);
let reason =
(await interaction.options?.getString("reason")) || "No Reason Provided.";
if (!transcriptChannel || !logChannel)
return interaction.followUp("Some Channels seem to be missing!");
if (supportbot.CloseConfirmation) {
if (supportbot.Ticket.Close.CloseConfirmation) {
const CloseTicketRequest = new Discord.EmbedBuilder()
.setTitle(`**${supportbot.ClosingTicket}**`)
.setDescription(
`Please confirm by repeating the following word.. \`${supportbot.ClosingConfirmation_Word}\` `
`Please confirm by repeating the following word.. \`${supportbot.Ticket.Close.ClosingConfirmation_Word}\` `
)
.setColor(supportbot.GeneralColour);
.setColor(supportbot.Embed.Colours.General);
await interaction.followUp({ embeds: [CloseTicketRequest] });
let filter = (m) =>
m.content.toLowerCase() === supportbot.ClosingConfirmation_Word &&
m.content.toLowerCase() === supportbot.Ticket.Close.ClosingConfirmation_Word &&
m.author.id === interaction.user.id;
await interaction.channel.awaitMessages({
filter,
@@ -102,12 +112,12 @@ module.exports = new Command({
if (err) console.error(err);
}
);
await interaction.followUp(`**${supportbot.ClosingTicket}**`);
await interaction.followUp(`**${msgconfig.Ticket.ClosingTicket}**`);
const transcriptEmbed = new Discord.EmbedBuilder()
.setTitle(supportbot.TranscriptTitle)
.setColor(supportbot.GeneralColour)
.setTitle(supportbot.Ticket.Log.TranscriptTitle)
.setColor(supportbot.Embed.Colours.General)
.setFooter({
text: supportbot.EmbedFooter,
text: supportbot.Embed.Footer,
iconURL: interaction.user.displayAvatarURL(),
})
.addField(
@@ -123,10 +133,10 @@ module.exports = new Command({
.addField("Closed By", interaction.user.tag)
.addField("Reason", reason);
const logEmbed = new Discord.EmbedBuilder()
.setTitle(supportbot.TicketLog_Title)
.setColor(supportbot.GeneralColour)
.setTitle(supportbot.Ticket.Log.TicketLog_Title)
.setColor(supportbot.Embed.Colours.General)
.setFooter({
text: supportbot.EmbedFooter,
text: supportbot.Embed.Footer,
iconURL: interaction.user.displayAvatarURL(),
})
.addField(
@@ -157,7 +167,7 @@ module.exports = new Command({
html += `-----<br><br>`;
}
});
if (!(supportbot.DisableTicketLogChannel)) {
if (!(supportbot.Ticket.Log.DisableTicketLogChannel)) {
await logChannel.send({ embeds: [logEmbed] }).catch((err) => {
console.error(err);
});
@@ -172,7 +182,7 @@ module.exports = new Command({
console.error(err);
});
if (supportbot.DMTranscripts) {
if (supportbot.Ticket.DMTranscripts) {
await tUser
?.send({ embeds: [transcriptEmbed], files: [file] })
+15 -14
View File
@@ -5,10 +5,18 @@ 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 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");
@@ -66,28 +74,21 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Embed.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
const NoPerms = new Discord.EmbedBuilder()
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
`${msgconfig.Error.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``
)
.setColor(supportbot.WarningColour);
.setColor(supportbot.Embed.Colours.Warn);
if (
interaction.member.roles.cache.has(SupportStaff.id) ||
+12 -26
View File
@@ -5,10 +5,14 @@ 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 cmdconfig = yaml.load(
fs.readFileSync("./Configs/commands.yml", "utf8")
);
const Command = require("../Structures/Command.js");
@@ -22,18 +26,11 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Help.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
@@ -63,13 +60,13 @@ module.exports = new Command({
.setColor(supportbot.Embed.Colours.General)
.addFields(
{
name: "🖥️ General Commands\n",
value: `${botCommands}\n`,
name: "🖥️ Commands\n",
value: `${botCommands} ${ticketCommands} ${staffCommands}\n`,
inline: false,
},
{
name: "🎫 Support Commands\n",
value: `${ticketCommands}\n`,
name: "🖥️ Addons\n",
value: `\`hello\`\n`,
inline: false,
}
)
@@ -80,17 +77,6 @@ module.exports = new Command({
iconURL: interaction.user.displayAvatarURL(),
});
if (
interaction.member.roles.cache.has(SupportStaff.id) ||
interaction.member.roles.cache.has(Admin.id)
) {
HelpEmbed1.addFields({
name: "🔐 Staff Commands\n",
value: `${staffCommands}\n`,
inline: false,
});
}
interaction.reply({
ephemeral: true,
embeds: [HelpEmbed1],
+16 -14
View File
@@ -5,10 +5,18 @@ 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 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");
@@ -19,26 +27,20 @@ module.exports = new Command({
permissions: cmdconfig.Info.Permission,
async run(interaction) {
if (cmdconfig.Info.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
let disableCommand = true;
const InfoButton = new Discord.ButtonBuilder()
.setLabel(supportbot.InfoButtonText)
.setURL(supportbot.InfoURL)
.setLabel(msgconfig.Info.Button)
.setURL(msgconfig.Info.URL)
.setStyle("Link");
const inforow = new Discord.ActionRowBuilder().addComponents(InfoButton);
const InfoEmbed = new Discord.EmbedBuilder()
.setURL(supportbot.InfoURL)
.setTitle(supportbot.InfoTitle)
.setDescription(supportbot.InfoDesc)
.setColor(supportbot.InfoColour)
.setURL(msgconfig.Info.URL)
.setTitle(msgconfig.Info.Title)
.setDescription(msgconfig.Info.Description)
.setColor(msgconfig.Info.Colour)
interaction.reply({
embeds: [InfoEmbed],
+1 -9
View File
@@ -21,19 +21,11 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Ping.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const PingEmbed = new Discord.EmbedBuilder()
.setDescription(
`:ping_pong: **Ping:** \`${interaction.client.ws.ping} ms\``
)
.setColor(supportbot.GeneralColour);
.setColor(supportbot.Embed.Colours.General);
interaction.reply({
embeds: [PingEmbed],
+25 -24
View File
@@ -5,10 +5,18 @@ 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 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");
@@ -20,7 +28,6 @@ module.exports = new Command({
{
name: "user",
description: "User to remove",
type: "USER",
type: Discord.ApplicationCommandOptionType.User,
required: true,
},
@@ -30,18 +37,11 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.TicketRemove.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let Staff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
if (!Staff || !Admin)
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
@@ -49,15 +49,16 @@ module.exports = new Command({
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
`${msgconfig.Error.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``
)
.setColor(supportbot.WarningColour);
.setColor(supportbot.Embed.Colours.Warn);
if (
!interaction.member.roles.cache.has(Staff.id) &&
!interaction.member.roles.cache.has(SupportStaff.id) &&
!interaction.member.roles.cache.has(Admin.id)
)
return interaction.reply({ embeds: [NoPerms] });
return interaction.reply({ ephemeral: true, embeds: [NoPerms] });
let TicketData = await JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
);
@@ -67,8 +68,8 @@ module.exports = new Command({
if (ticket === -1) {
const Exists = new Discord.EmbedBuilder()
.setTitle("No Ticket Found!")
.setDescription(supportbot.NoValidTicket)
.setColor(supportbot.WarningColour);
.setDescription(msgconfig.Error.NoValidTicket)
.setColor(supportbot.Embed.Colours.Warn);
return interaction.reply({ ephemeral: true, embeds: [Exists] });
}
@@ -76,21 +77,21 @@ module.exports = new Command({
const UserNotExist = new Discord.EmbedBuilder()
.setTitle("User Not Found!")
.setDescription(
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketRemove} <user#0000>\``
`${msgconfig.Error.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketRemove} <user#0000>\``
)
.setColor(supportbot.ErrorColour);
.setColor(supportbot.Embed.Colours.Error);
if (!uMember) return interaction.reply({ ephemeral: true, embeds: [UserNotExist] });
await interaction.channel.permissionOverwrites.edit(uMember.id, {
VIEW_CHANNEL: false,
ViewChannel: false,
});
const Complete = new Discord.EmbedBuilder()
.setTitle("User Removed!")
.setDescription(supportbot.RemovedUser.replace(/%user%/g, uMember.id))
.setDescription(msgconfig.Ticket.RemovedUser.replace(/%user%/g, uMember.id))
.setTimestamp()
.setColor(supportbot.GeneralColour);
.setColor(supportbot.Embed.Colours.General);
interaction.reply({ embeds: [Complete] });
TicketData.tickets[ticket].subUsers = TicketData.tickets[
ticket
+21 -13
View File
@@ -5,10 +5,18 @@ 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 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");
const { channel } = require("diagnostics_channel");
@@ -33,14 +41,14 @@ module.exports = new Command({
const { getChannel } = interaction.client;
const suggestChannel = await getChannel(
supportbot.SuggestionChannel,
supportbot.Suggestions.Channel,
interaction.guild
);
const NoChannel = new Discord.EmbedBuilder()
.setTitle("Missing Channel!")
.setDescription(supportbot.InvalidChannel)
.setColor(supportbot.ErrorColour);
.setDescription(msgconfig.Error.InvalidChannel)
.setColor(supportbot.Embed.Colours.Error);
if (!suggestChannel) return interaction.reply({ embeds: [NoChannel] });
@@ -54,23 +62,23 @@ module.exports = new Command({
.setThumbnail(interaction.user.displayAvatarURL())
.setFooter({
text: supportbot.EmbedFooter,
text: supportbot.Embed.Footer,
iconURL: interaction.user.displayAvatarURL(),
})
.setColor(supportbot.GeneralColour);
.setColor(supportbot.Embed.Colours.General);
const suggestionMsg = await suggestChannel.send({ embeds: [SuggestEmbed] });
if (supportbot.SuggestionUpvote && supportbot.SuggestionDownvote) {
await suggestionMsg.react(supportbot.SuggestionUpvote);
await suggestionMsg.react(supportbot.SuggestionDownvote);
if (supportbot.Suggestions.UpvoteEmoji && supportbot.Suggestions.DownvoteEmoji) {
await suggestionMsg.react(supportbot.Suggestions.UpvoteEmoji);
await suggestionMsg.react(supportbot.Suggestions.DownvoteEmoji);
if (supportbot.SuggestionThreads) {
if (supportbot.Suggestions.Threads.Enabled) {
await suggestionMsg.startThread({
name: `Suggestion-releated Thread`,
name: supportbot.Suggestions.Threads.Title,
autoArchiveDuration: 60,
type: Discord.ChannelType.GuildPublicThread,
reason: 'Suggestion-releated thread',
reason: supportbot.Suggestions.Threads.Reason,
})
}
@@ -82,7 +90,7 @@ module.exports = new Command({
.addFields(
{ name: "Sent to:", value: `<#${suggestChannel.id}>`},
)
.setColor(supportbot.SuccessColour);
.setColor(supportbot.Embed.Colours.Success);
return interaction.reply({
ephemeral: true,
+46 -34
View File
@@ -18,10 +18,18 @@ const {
} = 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 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");
const TicketNumberID = require("../Structures/TicketID.js");
@@ -55,31 +63,31 @@ module.exports = new Command({
if (
supportbot.MaxAllowedTickets &&
supportbot.Ticket.TicketsPerUser &&
TicketData.tickets.filter((t) => t.user === interaction.user.id && t.open)
.length >= supportbot.MaxAllowedTickets
.length >= supportbot.Ticket.TicketsPerUser
) {
return interaction.reply({
embeds: [
{
title: "Too Many Tickets!",
description: `You can't have more than ${supportbot.MaxAllowedTickets} open tickets!`,
color: supportbot.WarningColour,
description: `You can't have more than ${supportbot.Ticket.TicketsPerUser} open tickets!`,
color: supportbot.Embed.Colours.Warn,
},
],
ephemeral: true,
});
}
if (User.roles.cache.has(supportbot.TicketBlackListRole)) {
if (User.roles.cache.has(supportbot.Roles.ModRoles.Blacklisted)) {
return interaction.reply({
content: supportbot.TicketBlackListMessage,
content: msgconfig.Ticket.Blacklisted,
ephemeral: true,
})
};
if (User.roles.cache.has(supportbot.TicketMutedRole)) {
if (User.roles.cache.has(supportbot.Roles.ModRoles.Muted)) {
return interaction.reply({
content: supportbot.TicketMutedMessage,
content: msgconfig.Ticket.Muted,
ephemeral: true,
})
};
@@ -89,16 +97,16 @@ module.exports = new Command({
// Ticket Subject
const TicketSubject =
interaction.options?.getString("reason") || supportbot.Tickets.Messages.InvalidSubject;
interaction.options?.getString("reason") || msgconfig.Ticket.InvalidSubject;
const TicketExists = new EmbedBuilder()
.setTitle("Ticket Exists!")
.setDescription(supportbot.TicketExists);
.setDescription(msgconfig.Ticket.TicketExists);
if (
await interaction.guild.channels.cache.find(
(ticketChannel) =>
ticketChannel.name === `${supportbot.TicketPrefix}${ticketNumberID}`
ticketChannel.name === `${supportbot.Ticket.Channel}${ticketNumberID}`
)
) {
return await interaction.reply({
@@ -106,14 +114,18 @@ module.exports = new Command({
ephemeral: true,
});
}
const Staff = await getRole(supportbot.Staff, interaction.guild);
const Admin = await getRole(supportbot.Admin, interaction.guild);
const Staff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
const Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!Staff || !Admin)
return interaction.reply({
content:
"Some roles seem to be missing!\nPlease check for errors when starting the bot.",
ephemeral: true,
});
let TicketCategory = await getCategory(
supportbot.Departments[department].category,
interaction.guild
@@ -139,7 +151,7 @@ module.exports = new Command({
],
}
);
if (supportbot.AllowAllStaff) {
if (supportbot.Ticket.AllowAllStaff) {
await ticketChannel.permissionOverwrites.edit(Staff.id, {
ViewChannel: true,
});
@@ -168,40 +180,40 @@ module.exports = new Command({
const CreatedTicket = new EmbedBuilder()
.setDescription(
supportbot.TicketCreatedAlert.replace(
msgconfig.Ticket.TicketCreatedAlert.replace(
/%ticketauthor%/g,
interaction.user.id
)
.replace(/%ticketid%/g, ticketChannel.id)
.replace(/%ticketusername%/g, interaction.user.username)
)
.setColor(supportbot.GeneralColour);
.setColor(supportbot.Embed.Colours.General);
await interaction.reply({ embeds: [CreatedTicket], ephemeral: true });
if (supportbot.AllowTicketMentions) {
if (supportbot.Ticket.AllowMentions) {
await ticketChannel.send(`${interaction.user}`);
}
const TicketMessage = new EmbedBuilder()
.setTitle(
supportbot.Ticket_Title.replace(/%ticketauthor%/g, interaction.user.id)
msgconfig.Ticket.TicketTitle.replace(/%ticketauthor%/g, interaction.user.id)
.replace(/%ticketid%/g, ticketChannel.id)
.replace(/%ticketusername%/g, interaction.user.username)
)
.setDescription(
supportbot.TicketMessage.replace(/%ticketauthor%/g, interaction.user.id)
msgconfig.Ticket.TicketMessage.replace(/%ticketauthor%/g, interaction.user.id)
.replace(/%ticketid%/g, ticketChannel.id)
.replace(/%ticketusername%/g, interaction.user.username)
)
.setColor(supportbot.GeneralColour);
.setColor(supportbot.Embed.Colours.General);
if (supportbot.TicketSubject === "embed") {
if (supportbot.Ticket.TicketSubject === "embed") {
if (TicketSubject !== "No Reason Provided.") {
TicketMessage.addFields({ name: "Reason", value: TicketSubject });
}
}
if (supportbot.TicketSubject === "description") {
if (supportbot.Ticket.TicketSubject === "description") {
if (TicketSubject !== "No Reason Provided.") {
await ticketChannel.setTopic(
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
@@ -218,14 +230,14 @@ module.exports = new Command({
const CloseButton = new MessageButton()
.setCustomId("ticketclose")
.setLabel("Close")
.setStyle(supportbot.TicketCloseColour)
.setEmoji(supportbot.TicketCloseEmoji);
.setStyle(supportbot.Buttons.Tickets.CloseStyle)
.setEmoji(supportbot.Buttons.Tickets.CloseEmoji);
const LockButton = new MessageButton()
.setCustomId("ticketlock")
.setLabel("Lock")
.setStyle(supportbot.TicketLockColour)
.setEmoji(supportbot.TicketLockEmoji);
.setStyle(supportbot.Buttons.Tickets.LockStyle)
.setEmoji(supportbot.Buttons.Tickets.LockEmoji);
const row2 = new MessageActionRow().addComponents(CloseButton, LockButton);
if (!department) {
@@ -250,7 +262,7 @@ module.exports = new Command({
filter,
max: 1,
componentType: "BUTTON",
time: supportbot.Timeout * 60000,
time: supportbot.Ticket.Timeout * 60000,
});
} catch (e) {
if (e.code === "INTERACTION_COLLECTOR_ERROR") {
@@ -291,12 +303,12 @@ module.exports = new Command({
embeds: [
{
description: `> Thank for reaching out to the **${title} Department**. Please provide us information regarding your query.`,
color: supportbot.GeneralColour,
color: supportbot.Embed.Colours.General,
},
],
});
if (supportbot.AllowTicketMentions) {
if (supportbot.Ticket.AllowMentions) {
await ticketChannel.send("@here");
}
await collector.message.edit({
@@ -323,19 +335,19 @@ module.exports = new Command({
interaction.guild
);
await ticketChannel.setParent(TicketCat.id, { lockPermissions: false });
if (supportbot.AllowThanksForReachingOutMessage) {
if (supportbot.TicketAllowThanksForReachingOutMessage) {
await ticketChannel.send({
embeds: [
{
description: `> Thank for reaching out to the **${title} Department**. Please provide us information regarding your query.`,
color: supportbot.GeneralColour,
color: supportbot.Embed.Colours.General,
},
],
});
}
}
if (supportbot.AllowTicketMentions) {
await ticketChannel.send(supportbot.TicketRoleMention);
if (supportbot.Ticket.AllowMentions) {
await ticketChannel.send(supportbot.Ticket.RoleMention);
}
}
},
+20 -21
View File
@@ -5,12 +5,18 @@ 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 msgconfig = yaml.load(
fs.readFileSync("./Configs/messages.yml", "utf8")
)
const Command = require("../Structures/Command.js");
const translate = require("@vitalets/google-translate-api");
@@ -38,28 +44,21 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Translate.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check the error logs."
);
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
const NoPerms = new Discord.EmbedBuilder()
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
`${msgconfig.Error.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``
)
.setColor(supportbot.WarningColour);
.setColor(supportbot.Embed.Colours.Warn);
if (
!interaction.member.roles.cache.has(SupportStaff.id) &&
@@ -72,7 +71,7 @@ module.exports = new Command({
let url = "https://www.science.co.il/language/Codes.php"; // URL to all available language codes
let text = await interaction.options.getString("text"); // Grab the text to translate by the user
let translatelog = await getChannel(
supportbot.TranslateLogChannel,
supportbot.Translate.Log,
interaction.guild
); // Grab the set logging channel for translations
@@ -83,7 +82,7 @@ module.exports = new Command({
await interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setColor(supportbot.WarningColour)
.setColor(supportbot.Embed.Colours.Warn)
.setTitle("Valid Language Codes")
.setURL(url)
.setDescription(
@@ -99,7 +98,7 @@ module.exports = new Command({
// Embed containing language code, original text and translated text
let transembed = new Discord.EmbedBuilder()
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dynamic: true }) })
.setColor(supportbot.SuccessColour)
.setColor(supportbot.Embed.Colours.Success)
.setDescription(`**Translation to ${lang}**`)
.addFields(
{ name: "Original text", value: text },
+23 -24
View File
@@ -6,13 +6,19 @@ const moment = require("moment");
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")
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({
@@ -32,28 +38,21 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.UserInfo.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check the error logs."
);
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
)
.setColor(supportbot.WarningColour);
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
const NoPerms = new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${msgconfig.Error.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``
)
.setColor(supportbot.Embed.Colours.Warn);
if (
!interaction.member.roles.cache.has(SupportStaff.id) &&
@@ -67,7 +66,7 @@ module.exports = new Command({
const UserNotExist = new Discord.EmbedBuilder()
.setTitle("User Not Found!")
.setDescription(
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.UserInfoCommand} <@!User_ID> or @User\``
`${msgconfig.Error.UserNotFound}\n\nTry Again:\`/${cmdconfig.UserInfoCommand} <@!User_ID> or @User\``
)
.setColor(supportbot.ErrorColour);
@@ -121,7 +120,7 @@ module.exports = new Command({
{ name: "Highest Role:", value: `${member.roles.highest.id === interaction.guild.id ? "None" : member.roles.highest.toString()}`, inline: true },
{ name: "Roles:", value: `${member.roles.cache.map(r => r).join(" ").replace("@everyone", " ") || "None"}`, inline: false },
)
.setFooter({ text: supportbot.EmbedFooter })
.setFooter({ text: supportbot.Footer })
.setTimestamp();
// Send embed [userembed]
-181
View File
@@ -1,181 +0,0 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# SupportBot created by Emerald Development
# Installed with MIT License
#
# Discord Support: https://dsc.gg/emerald-dev
# Official Documentation: https://emeraldsrv.dev/wiki
# Third-Party Documentation: https://emeraldsrv.dev/third-party
SupportBot_Version: "v8.0 DEV-v1.2"
# -------------------------
# General
# -------------------------
General:
Name: "SupportBot"
Token: "BOT TOKEN"
# -------------------------
# Activity
# -------------------------
Activity:
Status: "SupportBot v8"
Type: "Watching"
# The Type can either be Playing, Watching, Listenin or Streaming.
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
# Set The Type to "Streaming" for a streaming status!
# -------------------------
# Embeds
# -------------------------
Embed:
Colours:
General: "#f74343"
Success: "#04b545"
Error: "#d12519"
Warn: "#fca117"
Footer: "SupportBot | Developed by Emerald Development"
# -------------------------
# Roles
# -------------------------
Roles:
AutoRole:
Enabled: true
Roles: "Member"
StaffMember:
Staff: "Staff"
Admin: "Admin"
ModRoles:
Muted: "Muted"
Blacklisted: "Blacklisted"
# ----------------------------
# System Messages
# ----------------------------
Welcome:
Enabled: true
Channel: "welcome"
Leave:
Enabled: true
Channel: "leave"
# ----------------------------
# Suggestions
# ----------------------------
Suggestions:
Channel: "suggestions"
UpvoteEmoji: "✅"
DownvoteEmoji: "❌"
Threads:
Enabled: true
Title: "Suggestion-releated Thread"
# -------------------------
# Tickets
# -------------------------
Ticket:
Channel: "ticket-" # The prefix for ticket channel names
TicketsPerUser: 2
RoleMention: "@here"
AllowMentions: true
DMTranscripts: true
# Set to true to allow the ticket to mention the author and the support team.
# Set false to dis-allow mentions within tickets.
TicketSubject: "description"
# "description" will display the ticket reason within the channel description
# "embed" will display the ticket reason within the ticket embed
AllowThanksForReachingOutMessage: true
# Set to true to allow the "Thanks for reaching out Message" to be sent when the ticket is created
Timeout: 5
AllowAllStaff: false
# Set to true to allow all staff to access the ticket
LockTicketCategory: "Archive"
Log:
TicketLog: "ticket-data"
TicketLog_Title: "Ticket Closed"
DisableTicketLogChannel: false
TranscriptLog: "ticket-data"
TranscriptTitle: "Ticket Transcript"
Close:
StaffOnly: true
# Set to false is anyone is able to close a ticket.
CloseConfirmation: true
Confirmation_Word: "confirm"
# -------------------------
# Departments
# -------------------------
Departments:
- title: "Support"
role: "SupportBot Staff"
color: "Secondary"
emoji: "1️⃣"
category: "Tickets"
- title: "Billing Support"
role: "SupportBot Staff"
color: "Secondary"
emoji: "2️⃣"
category: "Tickets"
- title: "Admin Team"
role: "SupportBot Admin"
color: "Secondary"
emoji: "3️⃣"
category: "Tickets"
# - title: "Other"
# role: "Staff"
# color: "Secondary"
# emoji: "3️⃣"
# category: "Tickets"
# -------------------------
# Buttons
# -------------------------
Buttons:
Tickets:
CloseEmoji: "❌"
CloseStyle: "Danger"
DeleteEmoji: "⛔"
DeleteStyle: "Danger"
LockEmoji: "🔒"
LockStyle: "Primary"
# Available Button Styles
# Primary - Blurple
# Secondary- Grey
# Danger - Red
# Success - Green
# -------------------------
# Misc
# -------------------------
Translate:
Log: "translations-log"
+2 -2
View File
@@ -61,14 +61,14 @@ Ticket:
RemovedUser: "> 👍 <@%user%> has been `Removed` from this ticket"
Blacklisted: "> :x: You are not allowed to open a ticket"
Mutede: "> :x: You are `Muted` and therefore not allowed to open any tickets"
Muted: "> :x: You are `Muted` and therefore not allowed to open any tickets"
InvalidSubject: "> No Reason Provided!"
TranscriptSavedMessage: "📝 **Transcript Saved!**"
TicketLockMessage: "❌ **Ticket Locked!**"
TicketDeleteMessage: "⚠ **Ticket Deleting!**"
ClosingText: "> :warning: You have requested to close your support ticket."
ClosingTicket: "> :warning: You have requested to close your support ticket."
Error:
IncorrectPerms: "> :x: **Err!** You do not have the correct permissions to use this command."
+275
View File
@@ -0,0 +1,275 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# SupportBot created by Emerald Development
# Installed with MIT License
#
# Discord Support: https://dsc.gg/emerald-dev
# Official Documentation: https://emeraldsrv.dev/wiki
# Third-Party Documentation: https://emeraldsrv.dev/third-party
SupportBot_Version: "v8.0 DEV-v1.2"
# -------------------------
# General Configuration
# -------------------------
General:
Name: "SupportBot"
Token:
Addons:
Enabled: true
# -------------------------
# Activity Configuration
# -------------------------
Activity:
Status: "SupportBot v8"
Type: "Watching"
# The Type can either be Playing, Watching, Listenin or Streaming.
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
# Set The Type to "Streaming" for a streaming status!
# -------------------------
# Embed Configuration
# -------------------------
Embed:
Colours:
General: "#f74343"
Success: "#04b545"
Error: "#d12519"
Warn: "#fca117"
Footer: "SupportBot | Developed by Emerald Development"
GeneralColour: "#f74343"
ErrorColour: "#d12519"
SuccessColour: "#04b545"
WarningColour: "#fca117"
EmbedFooter: "SupportBot | Developed by Emerald Development"
# -------------------------
# Role Configuration
# -------------------------
AutoRole: true
JoinRole: "SupportBot Member"
Staff: "SupportBot Staff"
Admin: "SupportBot Admin"
TicketBlackListRole: "Blacklisted"
TicketMutedRole: "Muted"
# ----------------------------
# Join/Leave Configuration
# ----------------------------
Welcome: true
# set to false to disable joining logs
WelcomeChannel: "join-leave-logs"
WelcomeColour: "#f74343"
WelcomeTitle: "User Joined!"
WelcomeMessage: "> %joined_user% has joined the server!"
# Available Placeholders:
# %joined_user% - Mentions the user who joined
EmbedWelcomeImage: true
EmbedWelcomeImageURL: "https://media.discordapp.net/attachments/958247876344025108/986777740738986094/unknown.png"
EmbedWelcomeThumbnail: "BOT"
# "USER" will display the user's profile picture.
# "BOT" will display the bot's profile picture.
# false to disable
Leave: true
# set to false to disable leaving logs
LeaveChannel: "join-leave-logs"
LeaveColour: "#f74343"
LeaveTitle: "User Left!"
LeaveMessage: "> %joined_user% has left the server!"
# Available Placeholders:
# %joined_user% - Mentions the user who joined
EmbedLeaveImage: true
EmbedLeaveImageURL: "https://cdn.discordapp.com/attachments/958247876344025108/986778170223120384/unknown.png"
EmbedLeaveThumbnail: false
# "USER" will display the user's profile picture.
# "BOT" will display the bot's profile picture.
# false to disable
# -------------------------
# Information Configuration
# -------------------------
InfoTitle: "Information"
InfoDesc: "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."
InfoButtonText: "Visit Site"
InfoURL: "https://emeraldsrv.dev"
InfoColour: "#f74343"
# ----------------------------
# Suggestions Configuration
# ----------------------------
SuggestionChannel: "suggestions"
SuggestionUpvote: "✅"
SuggestionDownvote: "❌"
SuggestionThreads: true
# set to false to disable threads being created from suggestions.
DisableSuggestions: false
# Set to true to disable the suggestions feature.
# -------------------------
# Translate Configuration
# -------------------------
TranslateLogChannel: "translations-log"
# -------------------------
# Tickets Configuration
# -------------------------
TicketPrefix: "ticket-" # The prefix for ticket channel names
TicketLog: "ticket-data"
TranscriptLog: "ticket-data"
DMTranscripts: true
TranscriptTitle: "Ticket Transcript"
TicketLog_Title: "Ticket Closed"
TicketBlackListMessage: "> :x: You are not allowed to open a ticket"
TicketMutedMessage: "> :x: You are `Muted` and therefore not allowed to open any tickets"
TicketRoleMention: "@here"
# To ping a role: <@ROLE_ID>
MaxAllowedTickets: 2
TicketSubject: "description"
# "description" will display the ticket reason within the channel description
# "embed" will display the ticket reason within the ticket embed
AllowTicketMentions: true
# Set to true to allow the ticket to mention the author and the support team.
# Set false to dis-allow mentions within tickets.
AllowThanksForReachingOutMessage: true
# Set to true to allow the "Thanks for reaching out Message" to be sent when the ticket is created
DisableTicketLogChannel: false
# Set to true to disable the requirement of the "TicketLog"
# Set to true to also disable the ticket logs to be sent in the "TicketLogs" channel
# --- Creation Config ---
# --- Start ---
# Available Placeholders:
# %ticketusername% - User who created the ticket.
# <@%ticketauthor%> - Tags the user who created the ticket.
# <#%ticketid%> - Mentions the ticket channel.
Ticket_Title: "Server Support | %ticketusername%"
TicketMessage: "> Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
NoTicketSubject: "> No Reason Provided!"
TicketCreatedAlert: "> :ticket: Ticked Created: <#%ticketid%>"
AddedUser: "> 👍 <@%user%> has been `Added` to the ticket"
RemovedUser: "> 👍 <@%user%> has been `Removed` from this ticket"
# -------------------------
# Tickets Categories
# -------------------------
Timeout: 5
# Set to true to allow all staff to access the ticket
AllowAllStaff: false
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been chosen.
Departments:
- title: "Support"
role: "SupportBot Staff"
color: "Secondary"
emoji: "1️⃣"
category: "Tickets"
- title: "Billing Support"
role: "SupportBot Staff"
color: "Secondary"
emoji: "2️⃣"
category: "Tickets"
- title: "Admin Team"
role: "SupportBot Admin"
color: "Secondary"
emoji: "3️⃣"
category: "Tickets"
# - title: "Other"
# role: "Staff"
# color: "Secondary"
# emoji: "3️⃣"
# category: "Tickets"
# Discord Button Colour Selection
# Primary - Blurple
# Secondary- Grey
# Danger - Red
# Success - Green
# --- Buttons Config ---
# --- Start ---
LockTicketCategory: "Archive"
TicketCloseEmoji: "❌"
TicketDeleteEmoji: "⛔"
TicketLockEmoji: "🔒"
TicketCloseColour: "Danger"
TicketDeleteColour: "Danger"
TicketLockColour: "Primary"
# Discord Button Colour Selection
# Primary - Blue
# Secondary - Grey
# Danger - Red
# Success - Green
TranscriptSavedMessage: "📝 **Transcript Saved!**"
TicketLockMessage: "❌ **Ticket Locked!**"
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
# --- Closing Config ---
# --- Start ---
StaffOnly: true
ClosingTicket: "> :warning: You have requested to close your support ticket."
ClosingConfirmation_Word: "confirm"
CloseConfirmation: true
# ---------------------------
# Error / Warning Messages
# ---------------------------
IncorrectPerms: "> :x: **Err!** You do not have the correct permissions to use this command."
InvalidChannel: "> :x: **Err!** Channel not found. Please create it!"
UserNotFound: "> :x: **Err!** This user doesn't exist, Are they in this server?"
NoValidTicket: "> :warning: You cannot execute this command here."
TicketExists: "> :warning: This ticket cannot be opened, It already exists!"
+90 -176
View File
@@ -12,17 +12,21 @@
# Third-Party Documentation: https://emeraldsrv.dev/third-party
SupportBot_Version: "v8.0 DEV-v1.2"
# Do not change the version number
# -------------------------
# General Configuration
# General
# -------------------------
General:
Name: "SupportBot"
Token: "BOT TOKEN"
Addons:
Enabled: false
# -------------------------
# Activity Configuration
# Activity
# -------------------------
Activity:
@@ -33,7 +37,7 @@ Activity:
# Set The Type to "Streaming" for a streaming status!
# -------------------------
# Embed Configuration
# Embeds
# -------------------------
Embed:
@@ -45,160 +49,89 @@ Embed:
Footer: "SupportBot | Developed by Emerald Development"
GeneralColour: "#f74343"
ErrorColour: "#d12519"
SuccessColour: "#04b545"
WarningColour: "#fca117"
EmbedFooter: "SupportBot | Developed by Emerald Development"
# -------------------------
# Role Configuration
# Roles
# -------------------------
AutoRole: true
JoinRole: "SupportBot Member"
Roles:
AutoRole:
Enabled: true
Role: "SupportBot Member"
Staff: "SupportBot Staff"
Admin: "SupportBot Admin"
TicketBlackListRole: "Blacklisted"
TicketMutedRole: "Muted"
StaffMember:
Staff: "SupportBot Staff"
Admin: "SupportBot Admin"
ModRoles:
Muted: "Muted"
Blacklisted: "Blacklisted"
# ----------------------------
# Join/Leave Configuration
# System Messages
# ----------------------------
Welcome: true
# set to false to disable joining logs
Welcome:
Enabled: true
Channel: "welcome"
WelcomeChannel: "join-leave-logs"
WelcomeColour: "#f74343"
WelcomeTitle: "User Joined!"
WelcomeMessage: "> %joined_user% has joined the server!"
# Available Placeholders:
# %joined_user% - Mentions the user who joined
EmbedWelcomeImage: true
EmbedWelcomeImageURL: "https://media.discordapp.net/attachments/958247876344025108/986777740738986094/unknown.png"
EmbedWelcomeThumbnail: "BOT"
# "USER" will display the user's profile picture.
# "BOT" will display the bot's profile picture.
# false to disable
Leave: true
# set to false to disable leaving logs
LeaveChannel: "join-leave-logs"
LeaveColour: "#f74343"
LeaveTitle: "User Left!"
LeaveMessage: "> %joined_user% has left the server!"
# Available Placeholders:
# %joined_user% - Mentions the user who joined
EmbedLeaveImage: true
EmbedLeaveImageURL: "https://cdn.discordapp.com/attachments/958247876344025108/986778170223120384/unknown.png"
EmbedLeaveThumbnail: false
# "USER" will display the user's profile picture.
# "BOT" will display the bot's profile picture.
# false to disable
# -------------------------
# Information Configuration
# -------------------------
InfoTitle: "Information"
InfoDesc: "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."
InfoButtonText: "Visit Site"
InfoURL: "https://emeraldsrv.dev"
InfoColour: "#f74343"
Leave:
Enabled: true
Channel: "leave"
# ----------------------------
# Suggestions Configuration
# Suggestions
# ----------------------------
SuggestionChannel: "suggestions"
SuggestionUpvote: "✅"
SuggestionDownvote: "❌"
SuggestionThreads: true
# set to false to disable threads being created from suggestions.
DisableSuggestions: false
# Set to true to disable the suggestions feature.
Suggestions:
Channel: "suggestions"
UpvoteEmoji: "✅"
DownvoteEmoji: "❌"
Threads:
Enabled: true
Title: "Suggestion-releated Thread"
Reason: "A thread releted to this suggestion"
# -------------------------
# Translate Configuration
# Tickets
# -------------------------
TranslateLogChannel: "translations-log"
Ticket:
Channel: "ticket-" # The prefix for ticket channel names
TicketsPerUser: 2
RoleMention: "@here"
AllowMentions: true
DMTranscripts: true
# Set to true to allow the ticket to mention the author and the support team.
# Set false to dis-allow mentions within tickets.
TicketSubject: "description"
# "description" will display the ticket reason within the channel description
# "embed" will display the ticket reason within the ticket embed
AllowThanksForReachingOutMessage: true
# Set to true to allow the "Thanks for reaching out Message" to be sent when the ticket is created
Timeout: 5
AllowAllStaff: false
# Set to true to allow all staff to access the ticket
LockTicketCategory: "Archive"
Log:
TicketLog: "ticket-data"
TicketLog_Title: "Ticket Closed"
DisableTicketLogChannel: false
TranscriptLog: "ticket-data"
TranscriptTitle: "Ticket Transcript"
Close:
StaffOnly: true
# Set to false is anyone is able to close a ticket.
CloseConfirmation: true
Confirmation_Word: "confirm"
# -------------------------
# Tickets Configuration
# Departments
# -------------------------
TicketPrefix: "ticket-" # The prefix for ticket channel names
TicketLog: "ticket-data"
TranscriptLog: "ticket-data"
DMTranscripts: true
TranscriptTitle: "Ticket Transcript"
TicketLog_Title: "Ticket Closed"
TicketBlackListMessage: "> :x: You are not allowed to open a ticket"
TicketMutedMessage: "> :x: You are `Muted` and therefore not allowed to open any tickets"
TicketRoleMention: "@here"
# To ping a role: <@ROLE_ID>
MaxAllowedTickets: 2
TicketSubject: "description"
# "description" will display the ticket reason within the channel description
# "embed" will display the ticket reason within the ticket embed
AllowTicketMentions: true
# Set to true to allow the ticket to mention the author and the support team.
# Set false to dis-allow mentions within tickets.
AllowThanksForReachingOutMessage: true
# Set to true to allow the "Thanks for reaching out Message" to be sent when the ticket is created
DisableTicketLogChannel: false
# Set to true to disable the requirement of the "TicketLog"
# Set to true to also disable the ticket logs to be sent in the "TicketLogs" channel
# --- Creation Config ---
# --- Start ---
# Available Placeholders:
# %ticketusername% - User who created the ticket.
# <@%ticketauthor%> - Tags the user who created the ticket.
# <#%ticketid%> - Mentions the ticket channel.
Ticket_Title: "Server Support | %ticketusername%"
TicketMessage: "> Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
NoTicketSubject: "> No Reason Provided!"
TicketCreatedAlert: "> :ticket: Ticked Created: <#%ticketid%>"
AddedUser: "> 👍 <@%user%> has been `Added` to the ticket"
RemovedUser: "> 👍 <@%user%> has been `Removed` from this ticket"
# -------------------------
# Tickets Categories
# -------------------------
Timeout: 5
# Set to true to allow all staff to access the ticket
AllowAllStaff: false
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been chosen.
Departments:
- title: "Support"
role: "SupportBot Staff"
@@ -224,49 +157,30 @@ Departments:
# emoji: "3️⃣"
# category: "Tickets"
# Discord Button Colour Selection
# -------------------------
# Buttons
# -------------------------
Buttons:
Tickets:
CloseEmoji: "❌"
CloseStyle: "Danger"
DeleteEmoji: "⛔"
DeleteStyle: "Danger"
LockEmoji: "🔒"
LockStyle: "Primary"
# Available Button Styles
# Primary - Blurple
# Secondary- Grey
# Danger - Red
# Success - Green
# --- Buttons Config ---
# --- Start ---
# -------------------------
# Misc
# -------------------------
LockTicketCategory: "Archive"
TicketCloseEmoji: "❌"
TicketDeleteEmoji: "⛔"
TicketLockEmoji: "🔒"
TicketCloseColour: "Danger"
TicketDeleteColour: "Danger"
TicketLockColour: "Primary"
# Discord Button Colour Selection
# Primary - Blue
# Secondary - Grey
# Danger - Red
# Success - Green
TranscriptSavedMessage: "📝 **Transcript Saved!**"
TicketLockMessage: "❌ **Ticket Locked!**"
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
# --- Closing Config ---
# --- Start ---
StaffOnly: true
ClosingTicket: "> :warning: You have requested to close your support ticket."
ClosingConfirmation_Word: "confirm"
CloseConfirmation: true
# ---------------------------
# Error / Warning Messages
# ---------------------------
IncorrectPerms: "> :x: **Err!** You do not have the correct permissions to use this command."
InvalidChannel: "> :x: **Err!** Channel not found. Please create it!"
UserNotFound: "> :x: **Err!** This user doesn't exist, Are they in this server?"
NoValidTicket: "> :warning: You cannot execute this command here."
TicketExists: "> :warning: This ticket cannot be opened, It already exists!"
Translate:
Log: "translations-log"
+1 -1
View File
@@ -1,4 +1,4 @@
{
"id": 2,
"id": 4,
"TicketPanelID": ""
}
+21 -12
View File
@@ -3,39 +3,48 @@ 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")
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")
);
module.exports = new Event("guildMemberAdd", async (client, member, interaction, guild) => {
if (supportbot.Welcome) {
const WelcomeChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.WelcomeChannel)
if (supportbot.Welcome.Enabled) {
const WelcomeChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.Welcome.Channel)
const WelcomeEmbed = new Discord.EmbedBuilder()
.setColor(supportbot.WelcomeColour)
.setTitle(supportbot.WelcomeTitle)
.setDescription(supportbot.WelcomeMessage.replace(/%joined_user%/g, member.user))
.setColor(msgconfig.Welcome.Embed.Colour)
.setTitle(msgconfig.Welcome.Embed.Title)
.setDescription(msgconfig.Welcome.Embed.Message.replace(/%joined_user%/g, member.user))
.setTimestamp();
if (supportbot.EmbedWelcomeThumbnail === "BOT") {
if (msgconfig.Welcome.Embed.Thumbnail === "BOT") {
WelcomeEmbed.setThumbnail(client.user.displayAvatarURL())
}
if (supportbot.EmbedWelcomeThumbnail === "USER") {
if (msgconfig.Welcome.Embed.Thumbnail === "USER") {
WelcomeEmbed.setThumbnail(member.user.displayAvatarURL())
}
if (supportbot.EmbedWelcomeImage) {
WelcomeEmbed.setImage(supportbot.EmbedWelcomeImageURL)
if (msgconfig.Welcome.Embed.ImageEnabled) {
WelcomeEmbed.setImage(msgconfig.Welcome.Embed.ImageURL)
}
WelcomeChannel.send({
embeds: [WelcomeEmbed]
})
if (supportbot.AutoRole) {
var role = member.guild.roles.cache.find(role => role.name === supportbot.JoinRole);
if (supportbot.Roles.AutoRole.Enabled) {
var role = member.guild.roles.cache.find(role => role.name === supportbot.Roles.AutoRole.Role);
member.roles.add(role);
}
+21 -12
View File
@@ -3,38 +3,47 @@ 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")
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")
);
module.exports = new Event("guildMemberRemove", async (client, member, interaction, guild) => {
if (supportbot.Leave) {
const LeaveChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.LeaveChannel)
if (supportbot.Leave.Enabled) {
const LeaveChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.Leave.Channel)
const LeaveEmbed = new Discord.EmbedBuilder()
.setColor(supportbot.LeaveColour)
.setTitle(supportbot.LeaveTitle)
.setDescription(supportbot.LeaveMessage.replace(/%joined_user%/g, member.user))
.setColor(msgconfig.Leave.Embed.Colour)
.setTitle(msgconfig.Leave.Embed.Title)
.setDescription(msgconfig.Leave.Embed.Message.replace(/%joined_user%/g, member.user))
.setTimestamp();
if (supportbot.EmbedLeaveThumbnail === "BOT") {
if (msgconfig.Leave.Embed.Thumbnail === "BOT") {
LeaveEmbed.setThumbnail(client.user.displayAvatarURL())
}
if (supportbot.EmbedLeaveThumbnail === "USER") {
if (msgconfig.Leave.Embed.Thumbnail === "USER") {
LeaveEmbed.setThumbnail(member.user.displayAvatarURL())
}
if (supportbot.EmbedLeaveImage) {
LeaveEmbed.setImage(supportbot.EmbedLeaveImageURL)
if (msgconfig.Leave.Embed.ImageEnabled) {
LeaveEmbed.setImage(msgconfig.Leave.Embed.ImageURL)
}
LeaveChannel.send({
embeds: [LeaveEmbed]
})
console.log(`\u001b[31m`, `[-]`, `\u001b[33m`, `${member.user.username} joined the server!`)
console.log(`\u001b[31m`, `[-]`, `\u001b[33m`, `${member.user.username} left the server!`)
}
});
+19 -11
View File
@@ -5,10 +5,18 @@ 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 cmdconfig = yaml.load(
fs.readFileSync("./Configs/commands.yml", "utf8")
);
const msgconfig = yaml.load(
fs.readFileSync("./Configs/messages.yml", "utf8")
);
const Event = require("../Structures/Event.js");
@@ -22,7 +30,7 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
const NotValid = new Discord.EmbedBuilder()
.setDescription(`:x: \`Invalid Command\` `)
.setColor(supportbot.ErrorColour);
.setColor(supportbot.Embed.Colours.Error);
if (!command)
return interaction.reply({
@@ -35,7 +43,7 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
.setDescription(
"> :x: `Invalid Permissions` Do you have the correct permissions to execute this command?"
)
.setColor(supportbot.ErrorColour);
.setColor(supportbot.Embed.Colours.Error);
if (!permission)
return interaction.reply({
@@ -67,14 +75,14 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
}
}
if (interaction.customId === "ticketlock") {
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
if (interaction.channel.name.startsWith(supportbot.Ticket.Channel)) {
interaction.message.fetch();
let Admin =
interaction.guild.roles.cache.find(
(AdminUser) => AdminUser.name === supportbot.Admin
(AdminUser) => AdminUser.name === supportbot.Roles.StaffMember.Admin
) ||
interaction.guild.roles.cache.find(
(AdminUser) => AdminUser.id === supportbot.Admin
(AdminUser) => AdminUser.id === supportbot.Roles.StaffMember.Admin
);
if (!interaction.member.roles.cache.has(Admin.id)) {
return await interaction.reply({
@@ -86,10 +94,10 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
let parent =
interaction.guild.channels.cache.find(
(c) => c.name === supportbot.LockTicketCategory
(c) => c.name === supportbot.Ticket.LockTicketCategory
) ||
interaction.guild.channels.cache.find(
(c) => c.id === supportbot.LockTicketCategory
(c) => c.id === supportbot.Ticket.LockTicketCategory
);
if (parent) {
await interaction.channel.setParent(parent.id);
@@ -112,8 +120,8 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
const ticketDeleteButton = new Discord.ButtonBuilder()
.setCustomId("ticketclose")
.setLabel("Close")
.setStyle(supportbot.TicketDeleteColour)
.setEmoji(supportbot.TicketDeleteEmoji);
.setStyle(supportbot.Buttons.Tickets.DeleteStyle)
.setEmoji(supportbot.Buttons.Tickets.DeleteEmoji);
const row = new Discord.ActionRowBuilder().addComponents(
ticketDeleteButton
@@ -121,7 +129,7 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
const ArchiveEmbed = new Discord.EmbedBuilder()
.setTitle("Archived")
.setDescription(`Archived ${interaction.channel.name}`)
.setColor(supportbot.SuccessColour);
.setColor(supportbot.Embed.Colours.Success);
interaction.reply({ embeds: [ArchiveEmbed] });
interaction.message.edit({ components: [row] });
+33 -22
View File
@@ -5,6 +5,7 @@ const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
@@ -12,6 +13,14 @@ const panelconfig = yaml.load(
fs.readFileSync("./Configs/ticket-panel.yml", "utf8")
);
const cmdconfig = yaml.load(
fs.readFileSync("./Configs/commands.yml", "utf8")
);
const msgconfig = yaml.load(
fs.readFileSync("./Configs/messages.yml", "utf8")
);
const Event = require("../Structures/Event.js");
module.exports = new Event("ready", async (client, interaction) => {
@@ -88,37 +97,39 @@ module.exports = new Event("ready", async (client, interaction) => {
console.log(`\u001b[32m`, `――――――――――――――――――――――――――――――――――――――――――――`);
const roles = [
supportbot.Admin,
supportbot.Staff,
supportbot.TicketBlackListRole,
supportbot.TicketMutedRole
supportbot.Roles.StaffMember.Admin,
supportbot.Roles.StaffMember.Staff,
supportbot.Roles.ModRoles.Blacklisted,
supportbot.Roles.ModRoles.Muted
];
supportbot.Departments.forEach((department) => roles.push(department.role));
if (supportbot.AutoRole) roles.push(supportbot.JoinRole);
const channels = [
supportbot.SuggestionChannel,
supportbot.TicketLog,
supportbot.TranscriptLog,
panelconfig.Channel,
supportbot.WelcomeChannel,
supportbot.LeaveChannel,
supportbot.TranslateLogChannel
];
if (supportbot.Roles.AutoRole.Role) roles.push(supportbot.Roles.AutoRole.Role);
// const channels = [
// supportbot.Suggestions.Channel,
// supportbot.Ticket.Log.TicketLog,
// supportbot.Ticket.Log.TranscriptLog,
// panelconfig.Channel,
// supportbot.Welcome.Channel,
// supportbot.Leave.Channel,
// supportbot.Translate.Log
// ];
//const categories = [supportbot.TicketCategory];
const missingC = [];
const missingR = [];
const missingCat = [];
for (let c of channels) {
if ((c === supportbot.SuggestionChannel && supportbot.DisableSuggestionsChannel) || c === supportbot.TicketLog && supportbot.DisableTicketLogChannel) {
continue;
}
const find = await getChannel(c, client.guilds.cache.first());
if (!find) missingC.push(c);
}
// for (let c of channels) {
// if ((c === supportbot.Suggestion.Channel && cmdconfig.Suggestion.Enabled) || c === supportbot.Ticket.Log.TicketLog && supportbot.Ticket.Log.DisableTicketLogChannel) {
// continue;
// }
// const find = await getChannel(c, client.guilds.cache.first());
// if (!find) missingC.push(c);
// }
for (let r of roles) {
const find = await getRole(r, client.guilds.cache.first());
if (!find) missingR.push(r);
@@ -184,7 +195,7 @@ module.exports = new Event("ready", async (client, interaction) => {
.setTitle(panelconfig.PanelTitle)
.setColor(panelconfig.PanelColour)
.setFooter({
text: supportbot.EmbedFooter,
text: supportbot.Embed.Footer,
iconURL: interaction.user.displayAvatarURL(),
});
+26 -22
View File
@@ -91,16 +91,6 @@ class Client extends Discord.Client {
const commandFiles = tempCommandFiles;
const addonFiles = fs
.readdirSync("./Addons")
.filter((file) => file.endsWith(".js"));
const addons = addonFiles.map((file) => {
let addon = require(`../Addons/${file}`);
addon.name = file.split(".")[0];
return addon;
});
const commands = commandFiles.map((file) => require(`../Commands/${file}`));
// Commands
@@ -112,19 +102,31 @@ class Client extends Discord.Client {
});
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
// Addons
console.log(" ");
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
addons.forEach((addon) => {
console.log(
`\u001b[32m`,
`[ADDON]`,
`\u001b[37;1m`,
`${addon.name}`,
`\u001b[32;1m`,
"Loaded"
);
if (supportbot.General.Addons.Enabled) {
const addonFiles = fs
.readdirSync("./Addons")
.filter((file) => file.endsWith(".js"));
const addons = addonFiles.map((file) => {
let addon = require(`../Addons/${file}`);
addon.name = file.split(".")[0];
return addon;
});
// Addons
console.log(" ");
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
addons.forEach((addon) => {
console.log(
`\u001b[32m`,
`[ADDON]`,
`\u001b[37;1m`,
`${addon.name}`,
`\u001b[32;1m`,
"Loaded"
);
addon.commands?.forEach((command) => {
this.commands.set(command.name, command);
});
@@ -135,6 +137,8 @@ class Client extends Discord.Client {
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
}
// Slash Commands
this.once("ready", async () => {