Whats New?
  - Ability to add as many departments as you need (Don't go to crazy 😂 )
  - Merged Sypher's Translate & UserInfo Addon into Features

------------

  - Add a role automatically when a user joins the server
  - Announce a welcome message with full cusomtization
  - Announce a leave message with full cusomtization
  - Added "ephermal" to majority messages.

Install modules use - npm install
This commit is contained in:
ItzEmerald committed 2022-06-16 02:31:58 +01:00
1 parent 6bf4e5f4bb
commit da7b6d487c
16 files changed
+4597 -55

No files matched your search

Vendored
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -45,7 +45,7 @@ module.exports = new Command({
!interaction.member.roles.cache.has(SupportStaff.id) &&
!interaction.member.roles.cache.has(Admin.id)
)
return interaction.reply({ embeds: [NoPerms] });
return interaction.reply({ ephemeral: true, embeds: [NoPerms] });
let TicketData = await JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
@@ -58,7 +58,7 @@ module.exports = new Command({
.setTitle("No Ticket Found!")
.setDescription(supportbot.NoValidTicket)
.setColor(supportbot.WarningColour);
return interaction.reply({ embeds: [Exists] });
return interaction.reply({ ephemeral: true, embeds: [Exists] });
}
let uMember = interaction.options.getUser("user");
+5 -8
View File
@@ -31,6 +31,8 @@ module.exports = new Command({
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.SuggestCommand}** ${cmdconfig.SuggestCommandDesc}\n`;
let ticketCommands = "";
ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
@@ -39,6 +41,8 @@ module.exports = new 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`;
const HelpEmbed1 = new Discord.MessageEmbed()
.setTitle(supportbot.Name + " Commands")
@@ -74,16 +78,9 @@ module.exports = new Command({
});
}
if (supportbot.SendHelpPage === "dm") {
interaction.user.send({
embeds: [HelpEmbed1],
});
}
if (supportbot.SendHelpPage === "channel") {
interaction.reply({
ephemeral: true,
embeds: [HelpEmbed1],
});
}
},
});
+2 -2
View File
@@ -57,7 +57,7 @@ module.exports = new Command({
.setTitle("No Ticket Found!")
.setDescription(supportbot.NoValidTicket)
.setColor(supportbot.WarningColour);
return interaction.reply({ embeds: [Exists] });
return interaction.reply({ ephemeral: true, embeds: [Exists] });
}
let uMember = interaction.options.getUser("user");
@@ -68,7 +68,7 @@ module.exports = new Command({
)
.setColor(supportbot.ErrorColour);
if (!uMember) return interaction.reply({ embeds: [UserNotExist] });
if (!uMember) return interaction.reply({ ephemeral: true, embeds: [UserNotExist] });
await interaction.channel.permissionOverwrites.edit(uMember.id, {
VIEW_CHANNEL: false,
+1 -1
View File
@@ -65,6 +65,6 @@ module.exports = new Command({
.addField("Sent to:", `<#${suggestChannel.id}>`)
.setColor(supportbot.SuccessColour);
return interaction.reply({ embeds: [Submitted] });
return interaction.reply({ ephemeral: true, mbeds: [Submitted] });
},
});
+108
View File
@@ -0,0 +1,108 @@
// SupportBot | Emerald Services
// Ticket Add Command
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 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
options: [
{
type: "STRING",
name: "language",
description: "A 2 letter language code",
required: true,
},
{
type: "STRING",
name: "text",
description: "The text to translate",
required: true,
}, // The input text for the translation
],
permissions: ["SEND_MESSAGES"], // The permission the user/role at least requires
async run(interaction) {
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check the error logs."
);
const NoPerms = new Discord.MessageEmbed()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
)
.setColor(supportbot.WarningColour);
if (
!interaction.member.roles.cache.has(SupportStaff.id) &&
!interaction.member.roles.cache.has(Admin.id)
)
return interaction.reply({ embeds: [NoPerms] });
const { getChannel } = interaction.client;
let lang = interaction.options.getString("language"); // Grab choice of language code by user
let url = "https://www.science.co.il/language/Codes.php"; // URL to all available language codes
let text = await interaction.options.getString("text"); // Grab the text to translate by the user
let translatelog = await getChannel(
supportbot.TranslateLogChannel,
interaction.guild
); // Grab the set logging channel for translations
// Return message if user has provided an invalid language code
const result = await translate(text, { to: lang }).catch(async (err) => {
if (err && err.code == 400) {
await interaction.reply({
embeds: [
new Discord.MessageEmbed()
.setColor(supportbot.WarningColour)
.setTitle("Valid Language Codes")
.setURL(url)
.setDescription(
"Click the title to see which 2 letter language codes are valid."
),
],
ephemeral: true,
});
}
});
if (!result) return;
// Embed containing language code, original text and translated text
let transembed = new Discord.MessageEmbed()
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dynamic: true }) })
.setColor(supportbot.SuccessColour)
.setDescription(`**Translation to ${lang}**`)
.addFields(
{ name: "Original text", value: text },
{ name: "Translated text", value: result.text },
)
.setFooter({ text: `Author: ${interaction.user.id}` })
.setTimestamp();
// Send embed [transembed] with translated message to channel
await interaction.reply({ embeds: [transembed] });
// Send embed [transembed] to logging channel
await translatelog.send({ embeds: [transembed] });
},
})
+127
View File
@@ -0,0 +1,127 @@
// SupportBot | Emerald Services
// User Info Command
const fs = require("fs");
const moment = require("moment");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const cmdconfig = yaml.load(
fs.readFileSync("./Configs/commands.yml", "utf8")
);
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.UserInfoCommand, // Name of command
description: cmdconfig.UserInfoCommandDesc, // Description of command
options: [
{
type: "USER",
name: "user",
description: "The user you want to get info about.",
required: true,
}, // The user input
],
permissions: ["SEND_MESSAGES"], // The permission the user/role at least requires
async run(interaction) {
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
let Admin = await getRole(supportbot.Admin, interaction.guild);
if (!SupportStaff || !Admin)
return interaction.reply(
"Some roles seem to be missing!\nPlease check the error logs."
);
const NoPerms = new Discord.MessageEmbed()
.setTitle("Invalid Permissions!")
.setDescription(
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
)
.setColor(supportbot.WarningColour);
if (
!interaction.member.roles.cache.has(SupportStaff.id) &&
!interaction.member.roles.cache.has(Admin.id)
)
return interaction.reply({ embeds: [NoPerms] });
let user = await interaction.options.getUser("user") || interaction.author; // Grab the mentioned user
let member = await interaction.guild.members.cache.get(user.id) // Check for user and his ID
const UserNotExist = new Discord.MessageEmbed()
.setTitle("User Not Found!")
.setDescription(
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.UserInfoCommand} <@!User_ID> or @User\``
)
.setColor(supportbot.ErrorColour);
if (!user) return interaction.reply({ embeds: [UserNotExist] });
// Flags a user/bot can have
const flags = {
DISCORD_EMPLOYEE: 'Discord Employee',
DISCORD_PARTNER: 'Discord Partner',
BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)',
BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)',
HYPESQUAD_EVENTS: 'HypeSquad Events',
HOUSE_BRAVERY: 'House of Bravery',
HOUSE_BRILLIANCE: 'House of Brilliance',
HOUSE_BALANCE: 'House of Balance',
EARLY_SUPPORTER: 'Early Supporter',
TEAM_USER: 'Team User',
SYSTEM: 'System',
VERIFIED_BOT: 'Verified Bot',
VERIFIED_DEVELOPER: 'Verified Bot Developer'
};
// Status message with icon
let status = {
online: "🟢Online",
idle: "🟡Idle",
dnd: "🔴Do Not Disturb",
offline: "⚫Offline"
};
const userFlags = user.flags.toArray();
// Embed containing the userinfo
let userembed = new Discord.MessageEmbed()
.setTitle(`User Info for User: ${user.tag}`)
.setThumbnail(member.displayAvatarURL({ dynamic: true, size: 512 }))
.setColor(member.roles.highest.hexColor)
.addFields(
{ name: "Name:", value: `${user.tag}\n<@${member.id}>`, inline: true },
{ name: "ID:", value: `${member.id}`, inline: true },
{ name: "Is Bot:", value: user.bot ? "Yes" : "No", inline: true },
{ name: "House/Badge:", value: `${userFlags.length ? userFlags.map(flag => flags[flag]).join("\n") : "None"}`, inline: true },
{ name: "Current Status:", value: `${status[member.presence ? member.presence.status : "offline"]}`, inline: true },
{ name: "Avatar URL:", value: `[Click Here](${member.displayAvatarURL()})`, inline: true },
{ name: "\u200b", value: "\u200b", inline: false}
)
.addFields(
{ name: "Creation Date:", value: `${moment(user.createdAt).format("MMMM Do YYYY, h:mm:ss a")}\n> ${moment(user.createdAt).startOf("day").fromNow()}`, inline: true },
{ name: "Joined Date:", value: `${moment(member.joinedAt).format("MMMM Do YYYY, h:mm:ss a")}\n> ${moment(member.joinedAt).startOf("day").fromNow()}`, inline: true },
{ name: "Roles Total:", value: `${member.roles.cache.size -1}`, inline: false },
{ name: "Highest Role:", value: `${member.roles.highest.id === interaction.guild.id ? "None" : member.roles.highest.toString()}`, inline: true },
{ name: "Roles:", value: `${member.roles.cache.map(r => r).join(" ").replace("@everyone", " ") || "None"}`, inline: false },
)
.setFooter({ text: supportbot.EmbedFooter })
.setTimestamp();
// Send embed [userembed]
await interaction.reply({ embeds: [userembed] }).catch((err) => console.error("An error has occured: ", err));
},
})
/**
* @INFO
* UserInfo command by Sypher#3415 | 321332200668790786
* @INFO
* Solely created for SupportBot | https://github.com/Emerald-Services/SupportBot/
**/
+7 -1
View File
@@ -14,6 +14,7 @@
# Command Name Configuration
# -------------------------------
Blacklist: "blacklist"
TicketAdd: "add"
TicketRemove: "remove"
OpenTicket: "ticket"
@@ -22,14 +23,18 @@ InfoCommand: "info"
PingCommand: "ping"
HelpCommand: "help"
EmbedCommand: "embed"
SuggestCommand: "suggest"
SuggestCommand: "suggestion"
TranslateCommand: "translate"
UserInfoCommand: "userinfo"
# ---------------------------------------
# Command Description Configuration
# ---------------------------------------
BlacklistDesc: "Blacklist a user from creating Tickets."
TicketAddDesc: "Add a user to a support ticket."
TicketRemoveDesc: "Remove a user from a support ticket."
TranslateCommandDesc: "Translates the language provided, along with the abbreviation (2 char) long language code"
OpenTicketDesc: "Open a new support ticket."
CloseTicketDesc: "Close your support ticket."
InfoCommandDesc: "Get information about the brand."
@@ -37,3 +42,4 @@ PingCommandDesc: "Pong!"
HelpCommandDesc: "Get a list of all the commands."
EmbedCommandDesc: "Send a message as an embed."
SuggestCommandDesc: "Suggest a feature for the server."
UserInfoCommandDesc: "Get info about a user."
+67 -21
View File
@@ -10,14 +10,14 @@
# Discord Support: https://emeraldsrv.dev/discord
# Community Resources: https://emeraldsrv.dev/resources
SupportBot_Version: "7.5"
SupportBot_Version: "BETA 7.6"
# -------------------------
# General Configuration
# -------------------------
Name: "SupportBot"
Token: "BOT_TOKEN"
Token: "TOKEN_HERE"
# -------------------------
# Activity Configuration
@@ -53,23 +53,52 @@ InfoButtonText: "Visit Site"
InfoURL: "https://emeraldsrv.dev"
InfoColour: "#f74343"
# -------------------------
# Help Configuration
# -------------------------
SendHelpPage: "channel" # Set to channel or dm
# -------------------------
# Role Configuration
# -------------------------
AutoRole: true
AutoRole_Role: "Member"
JoinRole: "Verified Member"
Staff: "Staff"
Admin: "Admin"
TicketBlackListRole: "Blacklisted"
# ----------------------------
# Join/Leave Configuration
# ----------------------------
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
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
# ----------------------------
# Suggestions Configuration
# ----------------------------
@@ -78,6 +107,12 @@ SuggestionChannel: "suggestions"
SuggestionUpvote: "✅"
SuggestionDownvote: "❌"
# -------------------------
# Translate Configuration
# -------------------------
TranslateLogChannel: "translations-log"
# -------------------------
# Tickets Configuration
# -------------------------
@@ -85,8 +120,8 @@ SuggestionDownvote: "❌"
TicketCategory: "Tickets" # Only for tickets without a category
TicketPrefix: "ticket-" # The prefix for ticket channel names
TicketLog: "ticket-logs"
TranscriptLog: "transcripts"
TicketLog: "ticket-data"
TranscriptLog: "ticket-data"
DMTranscripts: true
TranscriptTitle: "Ticket Transcript"
@@ -158,21 +193,32 @@ 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: "General Support"
role: "Support"
color: "PRIMARY"
- title: "Support"
role: "Staff"
color: "SECONDARY"
emoji: "1️⃣"
category: "Tickets"
category: "Billing Support"
- title: "Billing Support"
role: "Support"
color: "PRIMARY"
role: "Staff"
color: "SECONDARY"
emoji: "2️⃣"
category: "Billing"
category: "Admin Team"
- title: "Admin Team"
role: "Admin"
color: "PRIMARY"
color: "SECONDARY"
emoji: "3️⃣"
category: "Tickets"
category: "Admin Support"
# - title: "Other"
# role: "Staff"
# color: "SECONDARY"
# emoji: "3️⃣"
# category: "Tickets"
# Discord Button Colour Selection
# PRIMARY - Blurple
# SECONDARY - Grey
# DANGER - Red
# SUCCESS - Green
# --- Closing Config ---
# --- Start ---
@@ -180,7 +226,7 @@ Departments:
StaffOnly: true
ClosingTicket: ":warning: You have requested to close your support ticket."
ClosingConfirmation_Word: "confirm"
CloseConfirmation: false
CloseConfirmation: true
# ---------------------------
# Error / Warning Messages
+5 -5
View File
@@ -20,9 +20,9 @@ TicketPanel: true
# Ticket Panel Message Configuration
# ----------------------------------------
Channel: "create-ticket"
Channel: "▣┃ticket-creation"
ButtonEmoji: "📩"
ButtonLabel: "Open Ticket"
ButtonLabel: "Create Ticket"
ButtonColour: "SUCCESS"
# Colour Options:
# -> PRIMARY - Purple
@@ -33,9 +33,9 @@ ButtonColour: "SUCCESS"
PanelTitle: "Need Help? Create a Support Ticket."
TicketPanel_Description: true
TicketPanel_Thumbnail: false
TicketPanel_Image: false
TicketPanel_Thumbnail: true
TicketPanel_Image: true
PanelMessage: "Click the button to open a new support ticket."
PanelThumbnail: "https://i.imgur.com/ieeZejl.png"
PanelImage: "https://i.imgur.com/5NkcmDq.png"
PanelImage: "https://i.imgur.com/5NkcmDq.png"
+1 -1
View File
@@ -1 +1 @@
{"id":0,"TicketPanelID":"947337678720999458"}
{"id":0,"TicketPanelID":"986745633761292329"}
+21 -11
View File
@@ -8,25 +8,35 @@ const supportbot = yaml.load(
);
module.exports = new Event("guildMemberAdd", async (client, member, interaction, guild) => {
const WelcomeChannel = interaction.guild.channels.get(supportbot.WelcomeChannel)
const WelcomeChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.WelcomeChannel)
const WelcomeEmbed = new Discord.MessageEmbed()
.setColor(supportbot.WelcomeColour)
.setTitle(supportbot.WelcomeTitle)
.setDescription(supportbot.WelcomeMessage.replace(/%joined_user%/g, member.user))
.setThumbnail(member.user.displayAvatarURL())
.setTimestamp();
member.guild.channels.cache.get(
supportbot.WelcomeChannel).send({
embeds: [WelcomeEmbed]
if (supportbot.EmbedWelcomeThumbnail === "BOT") {
WelcomeEmbed.setThumbnail(client.user.displayAvatarURL())
}
})
if (supportbot.EmbedWelcomeThumbnail === "USER") {
WelcomeEmbed.setThumbnail(member.user.displayAvatarURL())
}
if (supportbot.EmbedWelcomeImage) {
WelcomeEmbed.setImage(supportbot.EmbedWelcomeImageURL)
}
const WelcomeMsg = await WelcomeChannel.send({
embeds: [WelcomeEmbed]
});
WelcomeChannel.send({
embeds: [WelcomeEmbed]
})
});
if (supportbot.AutoRole) {
var role = member.guild.roles.cache.find(role => role.name === supportbot.JoinRole);
member.roles.add(role);
}
console.log(`\u001b[32m`, `[+]`, `\u001b[33m`, `${member.user.username} joined the server!`)
});
+38
View File
@@ -0,0 +1,38 @@
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")
);
module.exports = new Event("guildMemberRemove", async (client, member, interaction, guild) => {
const LeaveChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.LeaveChannel)
const LeaveEmbed = new Discord.MessageEmbed()
.setColor(supportbot.LeaveColour)
.setTitle(supportbot.LeaveTitle)
.setDescription(supportbot.LeaveMessage.replace(/%joined_user%/g, member.user))
.setTimestamp();
if (supportbot.EmbedLeaveThumbnail === "BOT") {
LeaveEmbed.setThumbnail(client.user.displayAvatarURL())
}
if (supportbot.EmbedLeaveThumbnail === "USER") {
LeaveEmbed.setThumbnail(member.user.displayAvatarURL())
}
if (supportbot.EmbedLeaveImage) {
LeaveEmbed.setImage(supportbot.EmbedLeaveImageURL)
}
LeaveChannel.send({
embeds: [LeaveEmbed]
})
console.log(`\u001b[31m`, `[-]`, `\u001b[33m`, `${member.user.username} joined the server!`)
});
+4 -1
View File
@@ -90,12 +90,15 @@ module.exports = new Event("ready", async (client, interaction) => {
if (supportbot.TicketDepartments) {
supportbot.Departments.forEach((department) => roles.push(department.role));
}
if (supportbot.AutoRole) roles.push(supportbot.AutoRole_Role);
if (supportbot.AutoRole) roles.push(supportbot.JoinRole);
const channels = [
supportbot.SuggestionChannel,
supportbot.TicketLog,
supportbot.TranscriptLog,
panelconfig.Channel,
supportbot.WelcomeChannel,
supportbot.LeaveChannel,
supportbot.TranslateLogChannel
];
const categories = [supportbot.TicketCategory];
+4205 -1
View File
File diff suppressed because it is too large. Load diff
+4 -1
View File
@@ -18,7 +18,10 @@
},
"homepage": "https://github.com/Emerald-Services/SupportBot#readme",
"dependencies": {
"@vitalets/google-translate-api": "^8.0.0",
"discord.js": "^13.6.0",
"js-yaml": "^4.1.0"
"js-yaml": "^4.1.0",
"moment": "^2.29.3",
"translate": "^1.4.1"
}
}