8.0 Dev 1.2

Reworked configuration files & completed upgrade to V14
This commit is contained in:
ItzEmerald committed 2022-08-11 19:19:29 +01:00
1 parent 4e081358ff
commit 4eadef8b65
13 files changed
+373 -79

No files matched your search

-8
View File
@@ -29,14 +29,6 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.TicketAdd.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
-8
View File
@@ -28,14 +28,6 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.CloseTicket.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole, getChannel } = interaction.client;
if (supportbot.StaffOnly) {
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
+1 -7
View File
@@ -20,49 +20,43 @@ module.exports = new Command({
{
name: "title",
description: "Embed Title",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: true,
},
{
name: "message",
description: "Embed Message",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: true,
},
{
name: "color",
description: "Embed HEX Color",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: false,
},
{
name: "fieldtitle",
description: "Add an additional Embed Field",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: false,
},
{
name: "fieldcontent",
description: "Add an additional Embed Field",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: false,
},
{
name: "thumbnail",
description: "Embed Thumbnail URL",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: false,
},
{
name: "image",
description: "Embed Image URL",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: false,
},
+3 -3
View File
@@ -60,7 +60,7 @@ module.exports = new Command({
const HelpEmbed1 = new Discord.EmbedBuilder()
.setTitle(supportbot.General.Name + " Commands")
.setThumbnail(interaction.user.displayAvatarURL())
.setColor(supportbot.GeneralColour)
.setColor(supportbot.Embed.Colours.General)
.addFields(
{
name: "🖥️ General Commands\n",
@@ -74,9 +74,9 @@ module.exports = new Command({
}
)
.setColor(supportbot.GeneralColour)
.setColor(supportbot.Embed.Colours.General)
.setFooter({
text: supportbot.EmbedFooter,
text: supportbot.Embed.Footer,
iconURL: interaction.user.displayAvatarURL(),
});
+12 -15
View File
@@ -11,6 +11,7 @@ const supportbot = yaml.load(
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
const { channel } = require("diagnostics_channel");
module.exports = new Command({
name: cmdconfig.Suggestion.Command,
@@ -20,7 +21,6 @@ module.exports = new Command({
{
name: "suggestion",
description: "Create a Suggestion",
type: "STRING",
type: Discord.ApplicationCommandOptionType.String,
required: true,
},
@@ -30,15 +30,8 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Suggestion.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getChannel } = interaction.client;
const suggestChannel = await getChannel(
supportbot.SuggestionChannel,
interaction.guild
@@ -54,8 +47,11 @@ module.exports = new Command({
let suggestion = interaction.options.getString("suggestion");
const SuggestEmbed = new Discord.EmbedBuilder()
.addField("Suggestion", suggestion, true)
.addField("From", `<@${interaction.user.id}>`)
.addFields(
{ name: "Suggestion", value: suggestion, inline: true},
{ name: "From", value: `<@${interaction.user.id}>`},
)
.setThumbnail(interaction.user.displayAvatarURL())
.setFooter({
text: supportbot.EmbedFooter,
@@ -64,6 +60,7 @@ module.exports = new Command({
.setColor(supportbot.GeneralColour);
const suggestionMsg = await suggestChannel.send({ embeds: [SuggestEmbed] });
if (supportbot.SuggestionUpvote && supportbot.SuggestionDownvote) {
await suggestionMsg.react(supportbot.SuggestionUpvote);
await suggestionMsg.react(supportbot.SuggestionDownvote);
@@ -72,7 +69,7 @@ module.exports = new Command({
await suggestionMsg.startThread({
name: `Suggestion-releated Thread`,
autoArchiveDuration: 60,
type: 'GUILD_PUBLIC_THREAD',
type: Discord.ChannelType.GuildPublicThread,
reason: 'Suggestion-releated thread',
})
@@ -81,10 +78,10 @@ module.exports = new Command({
const Submitted = new Discord.EmbedBuilder()
.setTitle("Suggestion Submitted!")
.setDescription(
`:white_check_mark: You have successfully submitted a suggestion.`
.setDescription(`:white_check_mark: You have successfully submitted a suggestion.`)
.addFields(
{ name: "Sent to:", value: `<#${suggestChannel.id}>`},
)
.addField("Sent to:", `<#${suggestChannel.id}>`)
.setColor(supportbot.SuccessColour);
return interaction.reply({
+18 -18
View File
@@ -11,7 +11,10 @@ const {
ApplicationCommandOptionType,
ApplicationCommandType,
ButtonStyle,
InteractionType
InteractionType,
DiscordAPIError,
ChannelType,
InteractionCollector
} = require("discord.js");
const yaml = require("js-yaml");
@@ -40,13 +43,7 @@ module.exports = new Command({
async run(interaction) {
let disableCommand = true;
if (cmdconfig.OpenTicket.Enabled === false) {
if (interaction.type === InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
let department = interaction.customId?.split("-")[1] || null;
let TicketData = await JSON.parse(
@@ -55,6 +52,8 @@ module.exports = new Command({
const { getRole, getCategory } = interaction.client;
let User = interaction.guild.members.cache.get(interaction.user.id);
if (
supportbot.MaxAllowedTickets &&
TicketData.tickets.filter((t) => t.user === interaction.user.id && t.open)
@@ -77,6 +76,7 @@ module.exports = new Command({
ephemeral: true,
})
};
if (User.roles.cache.has(supportbot.TicketMutedRole)) {
return interaction.reply({
content: supportbot.TicketMutedMessage,
@@ -89,7 +89,7 @@ module.exports = new Command({
// Ticket Subject
const TicketSubject =
interaction.options?.getString("reason") || supportbot.NoTicketSubject;
interaction.options?.getString("reason") || supportbot.Tickets.Messages.InvalidSubject;
const TicketExists = new EmbedBuilder()
.setTitle("Ticket Exists!")
@@ -121,32 +121,32 @@ module.exports = new Command({
const ticketChannel = await interaction.guild.channels.create(
`${supportbot.TicketPrefix}${ticketNumberID}`,
{
type: "GUILD_TEXT",
type: ChannelType.GuildText,
parent: TicketCategory.id,
permissionOverwrites: [
{
id: Admin.id,
allow: [Permissions.FLAGS.VIEW_CHANNEL],
allow: [PermissionsBitField.Flags.ViewChannel],
},
{
id: interaction.user.id,
allow: [Permissions.FLAGS.VIEW_CHANNEL],
allow: [PermissionsBitField.Flags.ViewChannel],
},
{
id: interaction.guild.id,
deny: [Permissions.FLAGS.VIEW_CHANNEL],
deny: [PermissionsBitField.Flags.ViewChannel],
},
],
}
);
if (supportbot.AllowAllStaff) {
await ticketChannel.permissionOverwrites.edit(Staff.id, {
VIEW_CHANNEL: true,
ViewChannel: true,
});
}
if (!department) {
await ticketChannel.permissionOverwrites.edit(interaction.user.id, {
SEND_MESSAGES: false,
SendMessages: false,
});
}
await TicketData.tickets.push({
@@ -281,10 +281,10 @@ module.exports = new Command({
let title = supportbot.Departments[num].title;
await ticketChannel.permissionOverwrites.edit(role.id, {
VIEW_CHANNEL: true,
ViewChannel: true,
});
await ticketChannel.permissionOverwrites.edit(interaction.user.id, {
SEND_MESSAGES: true,
SendMessages: true,
});
await collector.reply({
@@ -316,7 +316,7 @@ module.exports = new Command({
);
let title = supportbot.Departments[department].title;
await ticketChannel.permissionOverwrites.edit(role.id, {
VIEW_CHANNEL: true,
ViewChannel: true,
});
let TicketCat = await getCategory(
supportbot.Departments[department].category,
+181
View File
@@ -0,0 +1,181 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# 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"
+13 -12
View File
@@ -16,66 +16,67 @@
Help:
Command: "help"
Description: "Get a list of all the commands."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
Info:
Command: "info"
Description: "Get information about the **ServerName**."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
TicketAdd:
Command: "add"
Description: "Add a user to a ticket."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: false
TicketRemove:
Command: "remove"
Description: "Remove a user from a ticket."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
OpenTicket:
Command: "ticket"
Description: "Create a support ticket."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
CloseTicket:
Command: "close"
Description: "Close a support ticket"
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
Suggestion:
Command: "suggest"
Description: "Create a suggestion."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
Embed:
Command: "embed"
Description: "Build a discord embed."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
Translate:
Command: "translate"
Description: "Translate something to english"
Permission: ["SEND_MESSAGES"]
Enabled: true
Permission: ["SendMessages"]
Enabled: false
UserInfo:
Command: "userinfo"
Description: "Get info about a user."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
Ping:
Command: "ping"
Description: "Pong."
Permission: ["SEND_MESSAGES"]
Permission: ["SendMessages"]
Enabled: true
# ---------------------------------------
+83
View File
@@ -0,0 +1,83 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# SupportBot created by Emerald Services
# 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
#
# Messages Configuration
Info:
Title: "About Us"
Description: "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."
Button: "Visit Site"
URL: "https://emeraldsrv.dev"
Colour: "#f74343"
Welcome:
Embed:
Colour: "#f74343"
Title: "Welcome to ServerName"
Message: "> :smile: %joined_user% has just landed!"
Thumbnail: "BOT"
ImageEnabled: false
ImageURL: "https://animagelink.png/"
Leave:
Embed:
Colour: "#f74343"
Title: "Goodbye!"
Message: "> :slight_frown: %joined_user% has recently dropped out!"
Thumbnail: "BOT"
ImageEnabled: false
ImageURL: "https://animagelink.png/"
Ticket:
# Available Placeholders:
# %ticketusername% - User who created the ticket.
# <@%ticketauthor%> - Tags the user who created the ticket.
# <#%ticketid%> - Mentions the ticket channel.
TicketTitle: "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."
TicketThumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
TicketCreatedAlert: "> :ticket: Ticked Created: <#%ticketid%>"
# Available Placeholders:
# <@%user%> - Tags the user who was added to the ticket.
AddedUser: "> 👍 <@%user%> has been `Added` to the ticket"
RemovedUser: "> 👍 <@%user%> has been `Removed` from this ticket"
Blacklisted: "> :x: You are not allowed to open a ticket"
Mutede: "> :x: You are `Muted` and therefore not allowed to open any tickets"
InvalidSubject: "> No Reason Provided!"
TranscriptSavedMessage: "📝 **Transcript Saved!**"
TicketLockMessage: "❌ **Ticket Locked!**"
TicketDeleteMessage: "⚠ **Ticket Deleting!**"
ClosingText: "> :warning: You have requested to close your support ticket."
Error:
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!"
+11 -2
View File
@@ -11,7 +11,7 @@
# Official Documentation: https://emeraldsrv.dev/wiki
# Third-Party Documentation: https://emeraldsrv.dev/third-party
SupportBot_Version: "v8.0 DEV-v1.1"
SupportBot_Version: "v8.0 DEV-v1.2"
# -------------------------
# General Configuration
@@ -19,7 +19,7 @@ SupportBot_Version: "v8.0 DEV-v1.1"
General:
Name: "SupportBot"
Token: ""
Token: "BOT TOKEN"
# -------------------------
# Activity Configuration
@@ -36,6 +36,15 @@ Activity:
# Embed Configuration
# -------------------------
Embed:
Colours:
General: "#f74343"
Success: "#04b545"
Error: "#d12519"
Warn: "#fca117"
Footer: "SupportBot | Developed by Emerald Development"
GeneralColour: "#f74343"
ErrorColour: "#d12519"
SuccessColour: "#04b545"
+1 -1
View File
@@ -20,7 +20,7 @@ TicketPanel: true
# Ticket Panel Message Configuration
# ----------------------------------------
Channel: "ticket-creation"
Channel: "create-ticket"
PanelTitle: "Need Help? Create a Support Ticket."
PanelColour: "#f74343"
+1 -1
View File
@@ -1,4 +1,4 @@
{
"id": 4,
"id": 2,
"TicketPanelID": ""
}
+49 -4
View File
@@ -7,10 +7,15 @@ const Discord = require("discord.js");
const { GatewayIntentBits, Partials } = 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")
);
class Client extends Discord.Client {
constructor() {
super({ intents: [GatewayIntentBits.Guilds], partials: [Partials.Channel] });
@@ -20,7 +25,7 @@ class Client extends Discord.Client {
async getChannel(channel, guild) {
return guild.channels.cache.find(
(c) =>
(c.type === "GUILD_TEXT" || c.type === "GUILD_NEWS") &&
(c.type === Discord.ChannelType.GuildText || c.type === Discord.ChannelType.GuildNews) &&
(c.id === channel || c.name.toLowerCase() === channel.toLowerCase())
);
}
@@ -32,7 +37,7 @@ class Client extends Discord.Client {
async getCategory(category, guild) {
return guild.channels.cache.find(
(c) =>
c.type === "GUILD_CATEGORY" &&
c.type === Discord.ChannelType.GuildCategory &&
(c.id === category || c.name.toLowerCase() === category.toLowerCase())
);
}
@@ -40,10 +45,50 @@ class Client extends Discord.Client {
async start(token) {
var tempCommandFiles = fs.readdirSync("./Commands").filter((file) => file.endsWith(".js"));
if (supportbot.DisableSuggestions) {
if (cmdconfig.Suggestion.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "suggest.js");
}
if (cmdconfig.Help.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "help.js");
}
if (cmdconfig.Info.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "info.js");
}
if (cmdconfig.TicketAdd.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "add.js");
}
if (cmdconfig.TicketRemove.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "remove.js");
}
if (cmdconfig.OpenTicket.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "ticket.js");
}
if (cmdconfig.CloseTicket.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "close.js");
}
if (cmdconfig.Embed.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "embed.js");
}
if (cmdconfig.Translate.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "translate.js");
}
if (cmdconfig.UserInfo.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "userinfo.js");
}
if (cmdconfig.Ping.Enabled === false) {
tempCommandFiles = tempCommandFiles.filter(item => item !== "Ping.js");
}
const commandFiles = tempCommandFiles;
const addonFiles = fs