v8.0 New configuration files
This commit is contained in:
1 parent
4eadef8b65
commit
c911cb4423
21 files changed
+725
-657
No files matched your search
+21
-12
@@ -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
@@ -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
@@ -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
@@ -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(),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user