v8.0-Dev-1.1

This commit is contained in:
ItzEmerald committed 2022-07-23 07:50:12 +01:00
1 parent 209ec0b435
commit 4e081358ff
17 files changed
+256 -99

No files matched your search

Vendored
BIN
View File
Binary file not shown.
+13 -3
View File
@@ -13,8 +13,8 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.TicketAdd,
description: cmdconfig.TicketAddDesc,
name: cmdconfig.TicketAdd.Command,
description: cmdconfig.TicketAdd.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
@@ -24,9 +24,19 @@ module.exports = new Command({
required: true,
},
],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.TicketAdd.Permission,
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);
+13 -3
View File
@@ -13,8 +13,8 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.CloseTicket,
description: cmdconfig.CloseTicketDesc,
name: cmdconfig.CloseTicket.Command,
description: cmdconfig.CloseTicket.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
@@ -23,9 +23,19 @@ module.exports = new Command({
type: Discord.ApplicationCommandOptionType.String,
},
],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.CloseTicket.Permission,
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);
+13 -3
View File
@@ -13,8 +13,8 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.EmbedCommand,
description: cmdconfig.EmbedCommandDesc,
name: cmdconfig.Embed.Command,
description: cmdconfig.Embed.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
@@ -67,9 +67,19 @@ module.exports = new Command({
required: false,
},
],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.Embed.Permission,
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Embed.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
+23 -14
View File
@@ -13,13 +13,23 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.HelpCommand,
description: cmdconfig.HelpCommandDesc,
name: cmdconfig.Help.Command,
description: cmdconfig.Help.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.Help.Permission,
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Help.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
@@ -29,24 +39,23 @@ module.exports = new Command({
);
let botCommands = "";
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
botCommands += `**/${cmdconfig.UserInfoCommand}** ${cmdconfig.UserInfoCommandDesc}\n`;
botCommands += ` \`${cmdconfig.Help.Command}\` `;
botCommands += `\`${cmdconfig.Ping.Command}\` `;
botCommands += `\`${cmdconfig.Info.Command}\` `;
if (supportbot.DisableSuggestions === false) {
botCommands += `**/${cmdconfig.SuggestCommand}** ${cmdconfig.SuggestCommandDesc}\n`;
botCommands += `\`${cmdconfig.Suggestion.Command}\` `;
}
let ticketCommands = "";
ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`;
ticketCommands += ` \`${cmdconfig.OpenTicket.Command}\` `;
ticketCommands += `\`${cmdconfig.CloseTicket.Command}\` `;
let staffCommands = "";
staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`;
staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`;
staffCommands += `**/${cmdconfig.UserInfoCommand}** ${cmdconfig.UserInfoCommandDesc}\n`;
staffCommands += `**/${cmdconfig.TranslateCommand}** ${cmdconfig.TranslateCommandDesc}\n`;
staffCommands += ` \`${cmdconfig.TicketAdd.Command}\` `;
staffCommands += `\`${cmdconfig.TicketRemove.Command}\` `;
staffCommands += `\`${cmdconfig.UserInfo.Command}\` `;
staffCommands += `\`${cmdconfig.Translate.Command}\` `;
const HelpEmbed1 = new Discord.EmbedBuilder()
.setTitle(supportbot.General.Name + " Commands")
+26 -17
View File
@@ -13,28 +13,37 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.InfoCommand,
description: cmdconfig.InfoCommandDesc,
name: cmdconfig.Info.Command,
description: cmdconfig.Info.Description,
options: [],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.Info.Permission,
async run(interaction) {
const InfoButton = new Discord.ButtonBuilder()
.setLabel(supportbot.InfoButtonText)
.setURL(supportbot.InfoURL)
.setStyle("Link");
if (cmdconfig.Info.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const inforow = new Discord.ActionRowBuilder().addComponents(InfoButton);
const InfoButton = new Discord.ButtonBuilder()
.setLabel(supportbot.InfoButtonText)
.setURL(supportbot.InfoURL)
.setStyle("Link");
const InfoEmbed = new Discord.EmbedBuilder()
.setURL(supportbot.InfoURL)
.setTitle(supportbot.InfoTitle)
.setDescription(supportbot.InfoDesc)
.setColor(supportbot.InfoColour)
const inforow = new Discord.ActionRowBuilder().addComponents(InfoButton);
const InfoEmbed = new Discord.EmbedBuilder()
.setURL(supportbot.InfoURL)
.setTitle(supportbot.InfoTitle)
.setDescription(supportbot.InfoDesc)
.setColor(supportbot.InfoColour)
interaction.reply({
embeds: [InfoEmbed],
components: [inforow],
});
interaction.reply({
embeds: [InfoEmbed],
components: [inforow],
});
},
});
+13 -3
View File
@@ -13,12 +13,22 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.PingCommand,
description: cmdconfig.PingCommandDesc,
name: cmdconfig.Ping.Command,
description: cmdconfig.Ping.Description,
options: [],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.Ping.Permission,
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Ping.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const PingEmbed = new Discord.EmbedBuilder()
.setDescription(
`:ping_pong: **Ping:** \`${interaction.client.ws.ping} ms\``
+13 -3
View File
@@ -13,8 +13,8 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.TicketRemove,
description: cmdconfig.TicketRemoveDesc,
name: cmdconfig.TicketRemove.Command,
description: cmdconfig.TicketRemove.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
@@ -25,9 +25,19 @@ module.exports = new Command({
required: true,
},
],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.TicketRemove.Permission,
async run(interaction) {
let disableCommand = true;
if (cmdconfig.TicketRemove.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let Staff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
+13 -3
View File
@@ -13,8 +13,8 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.SuggestCommand,
description: cmdconfig.SuggestCommandDesc,
name: cmdconfig.Suggestion.Command,
description: cmdconfig.Suggestion.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
@@ -25,9 +25,19 @@ module.exports = new Command({
required: true,
},
],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.Suggestion.Permission,
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,
+15 -10
View File
@@ -4,13 +4,14 @@
const fs = require("fs");
const {
MessageEmbed,
EmbedBuilder,
Permissions,
MessageButton,
MessageActionRow,
ApplicationCommandOptionType,
ApplicationCommandType,
ButtonStyle
ButtonStyle,
InteractionType
} = require("discord.js");
const yaml = require("js-yaml");
@@ -23,8 +24,8 @@ const Command = require("../Structures/Command.js");
const TicketNumberID = require("../Structures/TicketID.js");
module.exports = new Command({
name: cmdconfig.OpenTicket,
description: cmdconfig.OpenTicketDesc,
name: cmdconfig.OpenTicket.Command,
description: cmdconfig.OpenTicket.Description,
type: ApplicationCommandType.ChatInput,
options: [
{
@@ -34,15 +35,19 @@ module.exports = new Command({
},
],
permissions: ["SEND_MESSAGES"],
permissions: cmdconfig.OpenTicket.Permission,
async run(interaction) {
let disableCommand = true;
if (interaction.isCommand() && disableCommand)
if (cmdconfig.OpenTicket.Enabled === false) {
if (interaction.type === InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: "This command is disabled",
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
let department = interaction.customId?.split("-")[1] || null;
let TicketData = await JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
@@ -86,7 +91,7 @@ module.exports = new Command({
const TicketSubject =
interaction.options?.getString("reason") || supportbot.NoTicketSubject;
const TicketExists = new MessageEmbed()
const TicketExists = new EmbedBuilder()
.setTitle("Ticket Exists!")
.setDescription(supportbot.TicketExists);
@@ -161,7 +166,7 @@ module.exports = new Command({
}
);
const CreatedTicket = new MessageEmbed()
const CreatedTicket = new EmbedBuilder()
.setDescription(
supportbot.TicketCreatedAlert.replace(
/%ticketauthor%/g,
@@ -177,7 +182,7 @@ module.exports = new Command({
await ticketChannel.send(`${interaction.user}`);
}
const TicketMessage = new MessageEmbed()
const TicketMessage = new EmbedBuilder()
.setTitle(
supportbot.Ticket_Title.replace(/%ticketauthor%/g, interaction.user.id)
.replace(/%ticketid%/g, ticketChannel.id)
+12 -3
View File
@@ -16,8 +16,8 @@ const Command = require("../Structures/Command.js");
const translate = require("@vitalets/google-translate-api");
module.exports = new Command({
name: cmdconfig.TranslateCommand, // Name of command
description: cmdconfig.TranslateCommandDesc, // Description of command
name: cmdconfig.Translate.Command,
description: cmdconfig.Translate.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
@@ -33,9 +33,18 @@ module.exports = new Command({
required: true,
}, // The input text for the translation
],
permissions: ["SEND_MESSAGES"], // The permission the user/role at least requires
permissions: cmdconfig.Translate.Permission, // The permission the user/role at least requires
async run(interaction) {
let disableCommand = true;
if (cmdconfig.Translate.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
+13 -3
View File
@@ -16,8 +16,8 @@ const cmdconfig = yaml.load(
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.UserInfoCommand, // Name of command
description: cmdconfig.UserInfoCommandDesc, // Description of command
name: cmdconfig.UserInfo.Command,
description: cmdconfig.UserInfo.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
@@ -27,9 +27,19 @@ module.exports = new Command({
required: true,
}, // The user input
],
permissions: ["SEND_MESSAGES"], // The permission the user/role at least requires
permissions: cmdconfig.UserInfo.Permission,
async run(interaction) {
let disableCommand = true;
if (cmdconfig.UserInfo.Enabled === false) {
if (interaction.type === Discord.InteractionType.ApplicationCommand && disableCommand)
return interaction.reply({
content: ":x: This command is `disabled`",
ephemeral: true,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
+68 -17
View File
@@ -7,25 +7,76 @@
# SupportBot created by Emerald Services
# Installed with MIT License
#
# Discord Support: https://emeraldsrv.dev/discord
# Community Resources: https://emeraldsrv.dev/resources
# Discord Support: https://dsc.gg/emerald-dev
# Official Documentation: https://emeraldsrv.dev/wiki
# Third-Party Documentation: https://emeraldsrv.dev/third-party
#
# Command Configuration
# -------------------------------
# Command Name Configuration
# -------------------------------
Help:
Command: "help"
Description: "Get a list of all the commands."
Permission: ["SEND_MESSAGES"]
Enabled: true
Blacklist: "blacklist"
TicketAdd: "add"
TicketRemove: "remove"
OpenTicket: "ticket"
CloseTicket: "close"
InfoCommand: "info"
PingCommand: "ping"
HelpCommand: "help"
EmbedCommand: "embed"
SuggestCommand: "suggest"
TranslateCommand: "translate"
UserInfoCommand: "userinfo"
Info:
Command: "info"
Description: "Get information about the **ServerName**."
Permission: ["SEND_MESSAGES"]
Enabled: true
TicketAdd:
Command: "add"
Description: "Add a user to a ticket."
Permission: ["SEND_MESSAGES"]
Enabled: false
TicketRemove:
Command: "remove"
Description: "Remove a user from a ticket."
Permission: ["SEND_MESSAGES"]
Enabled: true
OpenTicket:
Command: "ticket"
Description: "Create a support ticket."
Permission: ["SEND_MESSAGES"]
Enabled: true
CloseTicket:
Command: "close"
Description: "Close a support ticket"
Permission: ["SEND_MESSAGES"]
Suggestion:
Command: "suggest"
Description: "Create a suggestion."
Permission: ["SEND_MESSAGES"]
Enabled: true
Embed:
Command: "embed"
Description: "Build a discord embed."
Permission: ["SEND_MESSAGES"]
Enabled: true
Translate:
Command: "translate"
Description: "Translate something to english"
Permission: ["SEND_MESSAGES"]
Enabled: true
UserInfo:
Command: "userinfo"
Description: "Get info about a user."
Permission: ["SEND_MESSAGES"]
Enabled: true
Ping:
Command: "ping"
Description: "Pong."
Permission: ["SEND_MESSAGES"]
Enabled: true
# ---------------------------------------
# Command Description Configuration
+9 -9
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.0"
SupportBot_Version: "v8.0 DEV-v1.1"
# -------------------------
# General Configuration
@@ -19,18 +19,18 @@ SupportBot_Version: "v8.0 DEV-v1.0"
General:
Name: "SupportBot"
Token: "BOT_TOKEN"
Token: ""
# -------------------------
# Activity Configuration
# -------------------------
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!
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
@@ -260,4 +260,4 @@ IncorrectPerms: "> :x: **Err!** You do not have the correct permissions to use t
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!"
TicketExists: "> :warning: This ticket cannot be opened, It already exists!"
+4 -1
View File
@@ -1 +1,4 @@
{"id":0,"TicketPanelID":""}
{
"id": 4,
"TicketPanelID": ""
}
+2 -2
View File
@@ -49,7 +49,7 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
interaction.customId.includes("department-")
) {
try {
const cmd = client.commands.get(cmdconfig.OpenTicket);
const cmd = client.commands.get(cmdconfig.OpenTicket.Command);
if (!cmd) return;
cmd.run(interaction);
} catch (error) {
@@ -59,7 +59,7 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
if (interaction.customId === "ticketclose") {
try {
const cmd = client.commands.get(cmdconfig.CloseTicket);
const cmd = client.commands.get(cmdconfig.CloseTicket.Command);
if (!cmd) return;
cmd.run(interaction);
} catch (error) {
+6 -5
View File
@@ -16,9 +16,9 @@ const Event = require("../Structures/Event.js");
module.exports = new Event("ready", async (client, interaction) => {
const { getRole, getChannel, getCategory } = client;
client.user.setActivity(supportbot.Activity, {
type: supportbot.Type,
url: supportbot.StreamingURL,
client.user.setActivity(supportbot.Activity.Status, {
type: supportbot.Activity.Type,
url: supportbot.Activity.StreamingURL,
});
console.log(`\u001b[32m`, `――――――――――――――――――――――――――――――――――――――――――――`);
@@ -90,8 +90,8 @@ module.exports = new Event("ready", async (client, interaction) => {
const roles = [
supportbot.Admin,
supportbot.Staff,
supportbot?.TicketBlackListRole,
supportbot?.TicketMutedRole
supportbot.TicketBlackListRole,
supportbot.TicketMutedRole
];
supportbot.Departments.forEach((department) => roles.push(department.role));
@@ -111,6 +111,7 @@ module.exports = new Event("ready", async (client, interaction) => {
const missingC = [];
const missingR = [];
const missingCat = [];
for (let c of channels) {
if ((c === supportbot.SuggestionChannel && supportbot.DisableSuggestionsChannel) || c === supportbot.TicketLog && supportbot.DisableTicketLogChannel) {
continue;