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
+722 -654

No files matched your search

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