Merge pull request #68 from DuAnti7423/master

Boolean Changes, help menu fix, raw Event, ID Support added
This commit is contained in:
ItzEmerald authored and GitHub committed 2021-05-24 12:48:25 +01:00
commit 72bfacae75
21 files changed
+128 -94

No files matched your search

+3 -3
View File
@@ -12,11 +12,11 @@ module.exports = {
description: supportbot.AddUserDesc, description: supportbot.AddUserDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.AddUser}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.AddUser}!`);
let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
const NoPerms = new Discord.MessageEmbed() const NoPerms = new Discord.MessageEmbed()
.setTitle("Invalid Permissions!") .setTitle("Invalid Permissions!")
+3 -3
View File
@@ -14,9 +14,9 @@ module.exports = {
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let locateChannel = message.guild.channels.cache.find(AnnouncementChannel => AnnouncementChannel.name === supportbot.AnnouncementChannel); let locateChannel = message.guild.channels.cache.find(AnnouncementChannel => AnnouncementChannel.name === supportbot.AnnouncementChannel) || message.guild.channels.cache.find(AnnouncementChannel => AnnouncementChannel.id === supportbot.AnnouncementChannel)
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.AnnounceCommand}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.AnnounceCommand}!`);
@@ -27,7 +27,7 @@ module.exports = {
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embed: errornochannel });
let Admins = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin); let Admins = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
const NoPerms = new Discord.MessageEmbed() const NoPerms = new Discord.MessageEmbed()
.setTitle("Invalid Permissions!") .setTitle("Invalid Permissions!")
+3 -3
View File
@@ -13,9 +13,9 @@ module.exports = {
description: supportbot.BanDesc, description: supportbot.BanDesc,
execute(message, args, member) { execute(message, args, member) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin); let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BanUser}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BanUser}!`);
@@ -27,7 +27,7 @@ module.exports = {
if (!message.member.roles.cache.has(SupportStaff.id)) if (!message.member.roles.cache.has(SupportStaff.id))
return message.channel.send({ embed: NoPerms }); return message.channel.send({ embed: NoPerms });
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel); let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
const errornochannel = new Discord.MessageEmbed() const errornochannel = new Discord.MessageEmbed()
.setTitle("Invalid Channel") .setTitle("Invalid Channel")
+4 -4
View File
@@ -13,9 +13,9 @@ module.exports = {
description: supportbot.BlacklistDesc, description: supportbot.BlacklistDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin); let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BlacklistUser}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BlacklistUser}!`);
@@ -28,7 +28,7 @@ module.exports = {
return message.channel.send({ embed: NoPerms }); return message.channel.send({ embed: NoPerms });
} }
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel); let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]); const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
@@ -70,7 +70,7 @@ module.exports = {
.setDescription(`${user} is already blacklisted`) .setDescription(`${user} is already blacklisted`)
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
if(user.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || reactionUser.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) { if(user.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || user.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) {
return message.channel.send({ return message.channel.send({
embed: embed4 embed: embed4
}) })
+2 -2
View File
@@ -13,9 +13,9 @@ module.exports = {
description: supportbot.BotSayDesc, description: supportbot.BotSayDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff); let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Staff)
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BotSay}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BotSay}!`);
+5 -5
View File
@@ -13,7 +13,7 @@ module.exports = {
description: supportbot.CloseTicketDesc, description: supportbot.CloseTicketDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.CloseTicket}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.CloseTicket}!`);
@@ -28,7 +28,7 @@ module.exports = {
} }
if (supportbot.CloseConfirmation === "true") { if (supportbot.CloseConfirmation) {
const CloseTicketRequest = new Discord.MessageEmbed() const CloseTicketRequest = new Discord.MessageEmbed()
.setTitle(`**${supportbot.ClosingTicket}**`) .setTitle(`**${supportbot.ClosingTicket}**`)
.setDescription(`Please confirm by repeating the following word.. \`${supportbot.ClosingConfirmation_Word}\` `) .setDescription(`Please confirm by repeating the following word.. \`${supportbot.ClosingConfirmation_Word}\` `)
@@ -42,7 +42,7 @@ module.exports = {
}).then( collected => { }).then( collected => {
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog); let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
let user = message.author; let user = message.author;
let reason = args.join(" ") || "No Reason Provided."; let reason = args.join(" ") || "No Reason Provided.";
@@ -94,9 +94,9 @@ module.exports = {
} }
if (supportbot.CloseConfirmation === "false") { if (!supportbot.CloseConfirmation) {
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog); let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
let user = message.author; let user = message.author;
let reason = args.join(" ") || "No Reason Provided."; let reason = args.join(" ") || "No Reason Provided.";
+6 -4
View File
@@ -12,14 +12,16 @@ module.exports = {
description: supportbot.HelpDesc, description: supportbot.HelpDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin);
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.HelpCommand}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.HelpCommand}!`);
if (supportbot.helpmenu_withkey = "true") { if (supportbot.HelpMenu_WithKey) {
let generalCommands = ""; let generalCommands = "";
generalCommands += `**${supportbot.Prefix}${supportbot.HelpCommand}** ${supportbot.HelpDesc}\n`; generalCommands += `**${supportbot.Prefix}${supportbot.HelpCommand}** ${supportbot.HelpDesc}\n`;
generalCommands += `**${supportbot.Prefix}${supportbot.LinksCommand}** ${supportbot.LinkDesc}\n`; generalCommands += `**${supportbot.Prefix}${supportbot.LinksCommand}** ${supportbot.LinksDesc}\n`;
generalCommands += `**${supportbot.Prefix}${supportbot.SuggestCommand}** ${supportbot.SuggestionDesc}\n`; generalCommands += `**${supportbot.Prefix}${supportbot.SuggestCommand}** ${supportbot.SuggestionDesc}\n`;
generalCommands += `**${supportbot.Prefix}${supportbot.PingCommand}** ${supportbot.PingDesc}\n`; generalCommands += `**${supportbot.Prefix}${supportbot.PingCommand}** ${supportbot.PingDesc}\n`;
@@ -49,7 +51,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL()); .setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL());
if (message.member.roles.cache.some(role => role.name === supportbot.Staff || supportbot.Admin)) { if (message.member.roles.cache.has(SupportStaff.id)) {
HelpEmbed1.addFields( HelpEmbed1.addFields(
{ name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false }, { name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false },
) )
+3 -3
View File
@@ -13,9 +13,9 @@ module.exports = {
description: supportbot.KickDesc, description: supportbot.KickDesc,
execute(message, args, member) { execute(message, args, member) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin); let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BanUser}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.BanUser}!`);
@@ -27,7 +27,7 @@ module.exports = {
if (!message.member.roles.cache.has(SupportStaff.id)) if (!message.member.roles.cache.has(SupportStaff.id))
return message.channel.send({ embed: NoPerms }); return message.channel.send({ embed: NoPerms });
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel); let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
const errornochannel = new Discord.MessageEmbed() const errornochannel = new Discord.MessageEmbed()
.setTitle("Invalid Channel") .setTitle("Invalid Channel")
+1 -1
View File
@@ -13,7 +13,7 @@ module.exports = {
description: supportbot.LinksDesc, description: supportbot.LinksDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.LinksCommand}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.LinksCommand}!`);
+34 -32
View File
@@ -18,8 +18,8 @@ module.exports = {
description: supportbot.NewTicketDesc, description: supportbot.NewTicketDesc,
execute(message, args) { execute(message, args) {
if (!message.channel.name === supportbot.ReactionChannel) { if (!message.channel.name === supportbot.ReactionChannel || !message.channel.id === supportbot.ReactionChannel) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
} }
let reactionUser = message.guild.members.cache.get(message.author.id) let reactionUser = message.guild.members.cache.get(message.author.id)
@@ -50,21 +50,21 @@ module.exports = {
message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`, { message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`, {
type: "text", type: "text",
permissionOverwrites: [
{
id: message.guild.roles.everyone,
deny: ['VIEW_CHANNEL'],
}
]
}).then(SupportTicket => { }).then(SupportTicket => {
let AllUsers = message.guild.roles.cache.find(everyone => everyone.name === '@everyone') let AllUsers = message.guild.roles.cache.find(everyone => everyone.name === '@everyone')
let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
let DeptRole1 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_1}`) let DeptRole1 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_1}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_1}`)
let DeptRole2 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_2}`) let DeptRole2 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_2}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_2}`)
let DeptRole3 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_3}`) let DeptRole3 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_3}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_3}`)
SupportTicket.updateOverwrite(AllUsers, {
VIEW_CHANNEL: false,
READ_MESSAGES: false,
SEND_MESSAGES: false,
})
SupportTicket.updateOverwrite(message.author, { SupportTicket.updateOverwrite(message.author, {
VIEW_CHANNEL: true, VIEW_CHANNEL: true,
@@ -84,20 +84,22 @@ module.exports = {
SEND_MESSAGES: true, SEND_MESSAGES: true,
}) })
SupportTicket.updateOverwrite(AllUsers, {
VIEW_CHANNEL: false
})
// Ticket Category // Ticket Category
let TicketCategory = message.guild.channels.cache.find(category => category.name === supportbot.TicketCategory) let TicketCategory = message.guild.channels.cache.find(category => category.name === supportbot.TicketCategory) || message.guild.channels.cache.find(category => category.id === supportbot.TicketCategory)
if (TicketCategory) { if (TicketCategory) {
SupportTicket.setParent(TicketCategory.id) SupportTicket.setParent(TicketCategory.id)
} else {
if (message.guild.channels.cache.get(supportbot.TicketCategory)) {
SupportTicket.setParent(message.guild.channels.cache.get(supportbot.TicketCategory).id);
}
} }
// Ticket Created, Message Sent // Ticket Created, Message Sent
if (supportbot.AllowTicketMentions === "true") { if (supportbot.AllowTicketMentions) {
SupportTicket.send(`<@${message.author.id}>`) SupportTicket.send(`<@${message.author.id}>`)
} }
@@ -122,7 +124,7 @@ module.exports = {
} }
if (supportbot.TicketDepartments === "true") { if (supportbot.TicketDepartments) {
TicketMessage.addFields({ name: 'Departments', value: `${supportbot.DepartmentEmoji_1} **${supportbot.DepartmentTitle_1}**\n${supportbot.DepartmentEmoji_2} **${supportbot.DepartmentTitle_2}**\n${supportbot.DepartmentEmoji_3} **${supportbot.DepartmentTitle_3}**` }) TicketMessage.addFields({ name: 'Departments', value: `${supportbot.DepartmentEmoji_1} **${supportbot.DepartmentTitle_1}**\n${supportbot.DepartmentEmoji_2} **${supportbot.DepartmentTitle_2}**\n${supportbot.DepartmentEmoji_3} **${supportbot.DepartmentTitle_3}**` })
} }
@@ -134,7 +136,7 @@ module.exports = {
reacted[ticketNumberID] = false; reacted[ticketNumberID] = false;
if (supportbot.TicketDepartments === "true") { if (supportbot.TicketDepartments) {
await msg.react(Emoji_1); await msg.react(Emoji_1);
await msg.react(Emoji_2); await msg.react(Emoji_2);
await msg.react(Emoji_3); await msg.react(Emoji_3);
@@ -147,11 +149,11 @@ module.exports = {
SupportTicket.updateOverwrite(Admins, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(Admins, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
SupportTicket.updateOverwrite(DeptRole1, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(DeptRole1, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
if (supportbot.AllowStaff === "true") { if (supportbot.AllowStaff) {
SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
} }
if (supportbot.AllowStaff === "false") { if (!supportbot.AllowStaff) {
SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, })
} }
@@ -160,7 +162,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
SupportTicket.send({ embed: Department1 }); SupportTicket.send({ embed: Department1 });
if (supportbot.AllowTicketMentions === "true") { if (supportbot.AllowTicketMentions) {
SupportTicket.send(`@here`) SupportTicket.send(`@here`)
} }
@@ -171,11 +173,11 @@ module.exports = {
SupportTicket.updateOverwrite(Admins, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(Admins, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
SupportTicket.updateOverwrite(DeptRole2, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(DeptRole2, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
if (supportbot.AllowStaff === "true") { if (supportbot.AllowStaff) {
SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
} }
if (supportbot.AllowStaff === "false") { if (!supportbot.AllowStaff) {
SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, })
} }
@@ -184,7 +186,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
SupportTicket.send({ embed: Department2 }); SupportTicket.send({ embed: Department2 });
if (supportbot.AllowTicketMentions === "true") { if (supportbot.AllowTicketMentions) {
SupportTicket.send(`@here`) SupportTicket.send(`@here`)
} }
@@ -196,11 +198,11 @@ module.exports = {
SupportTicket.updateOverwrite(DeptRole3, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(DeptRole3, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, })
if (supportbot.AllowStaff === "true") { if (supportbot.AllowStaff) {
SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: true, READ_MESSAGES: true, SEND_MESSAGES: true, })
} }
if (supportbot.AllowStaff === "false") { if (!supportbot.AllowStaff) {
SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, }) SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, })
} }
@@ -209,7 +211,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
SupportTicket.send({ embed: Department3 }); SupportTicket.send({ embed: Department3 });
if (supportbot.AllowTicketMentions === "true") { if (supportbot.AllowTicketMentions) {
SupportTicket.send(`@here`) SupportTicket.send(`@here`)
} }
@@ -234,7 +236,7 @@ module.exports = {
}); });
if (message.channel.name === supportbot.ReactionChannel) { if (message.channel.name === supportbot.ReactionChannel || message.channel.id === supportbot.ReactionChannel) {
const CreatedTicket = new Discord.MessageEmbed() const CreatedTicket = new Discord.MessageEmbed()
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, SupportTicket.id).replace(/%ticketusername%/g, message.author.username)) .setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, SupportTicket.id).replace(/%ticketusername%/g, message.author.username))
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
@@ -269,7 +271,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
.setFooter(supportbot.EmbedFooter) .setFooter(supportbot.EmbedFooter)
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === supportbot.TicketLog) let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === supportbot.TicketLog) || message.guild.channels.cache.find(LocateChannel => LocateChannel.id === supportbot.TicketLog)
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embed: errornochannel });
+1 -1
View File
@@ -12,7 +12,7 @@ module.exports = {
description: supportbot.PingDesc, description: supportbot.PingDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.PingCommand}!`) console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.PingCommand}!`)
+3 -3
View File
@@ -13,9 +13,9 @@ module.exports = {
description: supportbot.PurgeDesc, description: supportbot.PurgeDesc,
execute(message, args, member) { execute(message, args, member) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff); let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Staff)
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.PurgeMessage}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.PurgeMessage}!`);
@@ -27,7 +27,7 @@ module.exports = {
if (!message.member.roles.cache.has(SupportStaff.id)) if (!message.member.roles.cache.has(SupportStaff.id))
return message.channel.send({ embed: NoPerms }); return message.channel.send({ embed: NoPerms });
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel); let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
const errornochannel = new Discord.MessageEmbed() const errornochannel = new Discord.MessageEmbed()
.setTitle("Invalid Channel") .setTitle("Invalid Channel")
+3 -3
View File
@@ -12,12 +12,12 @@ module.exports = {
description: supportbot.RemoveUserDesc, description: supportbot.RemoveUserDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.RemoveUser}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.RemoveUser}!`);
let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
const NoPerms = new Discord.MessageEmbed() const NoPerms = new Discord.MessageEmbed()
.setTitle("Invalid Permissions!") .setTitle("Invalid Permissions!")
+2 -2
View File
@@ -12,9 +12,9 @@ module.exports = {
description: supportbot.SuggestionDesc, description: supportbot.SuggestionDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages == "true") message.delete(); if (supportbot.DeleteMessages) message.delete();
let locateChannel = message.guild.channels.cache.find(SuggestionChannel => SuggestionChannel.name === supportbot.SuggestionChannel); let locateChannel = message.guild.channels.cache.find(SuggestionChannel => SuggestionChannel.name === supportbot.SuggestionChannel) || message.guild.channels.cache.find(SuggestionChannel => SuggestionChannel.id === supportbot.SuggestionChannel)
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.SuggestCommand}!`); console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.SuggestCommand}!`);
+4 -4
View File
@@ -9,15 +9,15 @@ const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'))
module.exports = async (bot, member) => { module.exports = async (bot, member) => {
if (supportbot.SystemMessages === "true") { if (supportbot.SystemMessages) {
const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) || member.guild.channels.cache.get(supportbot.SystemMessage_Channel)
if (!SystemChannel) return; if (!SystemChannel) return;
console.log(`[${supportbot.Bot_Name}]: ${member.user.username} has joined ${member.guild.name}!`) console.log(`[${supportbot.Bot_Name}]: ${member.user.username} has joined ${member.guild.name}!`)
console.log(supportbot.AutoRole_Role) console.log(supportbot.AutoRole_Role)
const role = member.guild.roles.cache.find(role => role.name === supportbot.AutoRole_Role) const role = member.guild.roles.cache.find(role => role.name === supportbot.AutoRole_Role) || member.guild.roles.cache.find(role => role.id === supportbot.AutoRole_Role)
member.roles.add(role).catch(console.error); member.roles.add(role).catch(console.error);
@@ -37,7 +37,7 @@ module.exports = async (bot, member) => {
} }
if (supportbot.SystemMessage_EmbedFooter === "true") { if (supportbot.SystemMessage_EmbedFooter) {
GuildAddMember.setFooter(supportbot.EmbedFooter) GuildAddMember.setFooter(supportbot.EmbedFooter)
} }
+2 -2
View File
@@ -9,8 +9,8 @@ const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'))
module.exports = async (bot, member) => { module.exports = async (bot, member) => {
if (supportbot.SystemMessages === "true") { if (supportbot.SystemMessages) {
const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) || member.guild.channels.cache.get(supportbot.SystemMessage_Channel)
if (!SystemChannel) return; if (!SystemChannel) return;
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = async (client, reaction, user) => {
channel: reaction.message.channel channel: reaction.message.channel
} }
if (supportbot.ReactionTickets === true) { if (supportbot.ReactionTickets) {
if (reaction.message.id === tickets.ReactionMessage_ID) { if (reaction.message.id === tickets.ReactionMessage_ID) {
if (reaction.emoji.name == supportbot.ReactionEmoji || reaction.emoji.id == supportbot.ReactionEmoji) { if (reaction.emoji.name == supportbot.ReactionEmoji || reaction.emoji.id == supportbot.ReactionEmoji) {
await reaction.users.remove(user.id) await reaction.users.remove(user.id)
+26
View File
@@ -0,0 +1,26 @@
const Discord = require("discord.js");
const fs = require("fs");
const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
module.exports = async (bot, message, packet) => {
if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
const channel = bot.channels.cache.get(packet.d.channel_id);
if (channel.messages.has(packet.d.message_id)) return;
channel.messages.fetch(packet.d.message_id).then(message => {
const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
const reaction = message.reactions.get(emoji);
if (reaction) reaction.users.set(packet.d.user_id, bot.users.get(packet.d.user_id));
if (packet.t === 'MESSAGE_REACTION_ADD') {
bot.emit('messageReactionAdd', reaction, bot.users.get(packet.d.user_id));
}
if (packet.t === 'MESSAGE_REACTION_REMOVE') {
bot.emit('messageReactionRemove', reaction, bot.users.get(packet.d.user_id));
}
});
}
+6 -6
View File
@@ -20,8 +20,8 @@ module.exports = async (bot) => {
console.log(`\u001b[37m`, `${supportbot.Bot_Name} has successfully connected to discord`) console.log(`\u001b[37m`, `${supportbot.Bot_Name} has successfully connected to discord`)
console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`) console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
if (supportbot.ReactionTickets === true) { if (supportbot.ReactionTickets) {
let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel) let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel) || bot.channels.cache.find(channel => channel.id === supportbot.ReactionChannel)
if (!chan1) { if (!chan1) {
console.log('\u001b[33m', "[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!") console.log('\u001b[33m', "[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!")
@@ -34,19 +34,19 @@ module.exports = async (bot) => {
.setColor(supportbot.SuccessColour) .setColor(supportbot.SuccessColour)
.setFooter(supportbot.EmbedFooter); .setFooter(supportbot.EmbedFooter);
if (supportbot.ReactionPanel_Description === true) { if (supportbot.ReactionPanel_Description) {
embed.setDescription(supportbot.ReactionDescription) embed.setDescription(supportbot.ReactionDescription)
} }
if (supportbot.ReactionPanel_Thumbnail === true) { if (supportbot.ReactionPanel_Thumbnail) {
embed.setThumbnail(supportbot.ReactionThumbnail) embed.setThumbnail(supportbot.ReactionThumbnail)
} }
if (supportbot.ReactionPanel_Image === true) { if (supportbot.ReactionPanel_Image) {
embed.setImage(supportbot.ReactionImage) embed.setImage(supportbot.ReactionImage)
} }
bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel).send({ chan1.send({
embed: embed embed: embed
}).then(r => { }).then(r => {
let data = { let data = {
+1 -1
View File
@@ -23,4 +23,4 @@
"url": "https://github.com/1tzemerald/SupportBot/issues" "url": "https://github.com/1tzemerald/SupportBot/issues"
}, },
"homepage": "https://emeraldsrv.dev" "homepage": "https://emeraldsrv.dev"
} }
+15 -11
View File
@@ -24,7 +24,7 @@ StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
ActivityType: "PLAYING" ActivityType: "PLAYING"
# Activity status can either be PLAYING, WATCHING, LISTENING or STREAMING. # Activity status can either be PLAYING, WATCHING, LISTENING or STREAMING.
DeleteMessages: "true" DeleteMessages: true
# Embed Configuration # Embed Configuration
@@ -35,9 +35,13 @@ ErrorColour: "#d12519"
SuccessColour: "#04b545" SuccessColour: "#04b545"
WarningColour: "#fca117" WarningColour: "#fca117"
# Help Menu Configuration, Do Not Change.
HelpMenu_WithKey: true
# Role Configuration # Role Configuration
AutoRole: "true" AutoRole: true
# By setting "AutoRole to 'true' the bot will automatically apply the role below when members joins. Set to 'false' to disable this feature. # By setting "AutoRole to 'true' the bot will automatically apply the role below when members joins. Set to 'false' to disable this feature.
AutoRole_Role: "Member" AutoRole_Role: "Member"
LockdownRole: "@everyone" LockdownRole: "@everyone"
@@ -55,9 +59,9 @@ TranscriptLog: "transcripts"
TicketSubject: "description" TicketSubject: "description"
# TicketSubject: "description" means that the subject (reason) of the ticket will be displayed upon the channel description if set to "embed" it will be displayed within the embed. # TicketSubject: "description" means that the subject (reason) of the ticket will be displayed upon the channel description if set to "embed" it will be displayed within the embed.
AllowTicketMentions: "true" AllowTicketMentions: true
# Set to "true" to allow the ticket to mention the author and the support team. # Set to true to allow the ticket to mention the author and the support team.
# Set to "false" to dis-allow mentions within tickets. # Set to false to dis-allow mentions within tickets.
# Ticket Panel (Ticket Reaction Create) # Ticket Panel (Ticket Reaction Create)
@@ -86,15 +90,15 @@ RemovedUser: "👍 <@%user%> has been removed from this ticket"
ClosingTicket: ":warning: You have requested to close your support ticket." ClosingTicket: ":warning: You have requested to close your support ticket."
ClosingConfirmation_Word: "confirm" ClosingConfirmation_Word: "confirm"
CloseConfirmation: "true" CloseConfirmation: true
# CloseConfirmation to true will make users confirm that they want to close a their ticket, settings to false will just close the ticket. # CloseConfirmation to true will make users confirm that they want to close a their ticket, settings to false will just close the ticket.
# Ticket Department Configuration # Ticket Department Configuration
TicketDepartments: "true" TicketDepartments: true
# This option enable or disable the ticket departments. If set false Ticket Departments will not work # This option enable or disable the ticket departments. If set false Ticket Departments will not work
AllowStaff: "true" AllowStaff: true
# AllowStaff is an option to whether or not you want the users with the "Staff" role to be able to view inside tickets. If set false "Staff" will not view tickets. # AllowStaff is an option to whether or not you want the users with the "Staff" role to be able to view inside tickets. If set false "Staff" will not view tickets.
DepartmentEmoji_1: "🙋" DepartmentEmoji_1: "🙋"
@@ -114,7 +118,7 @@ DepartmentRole_3: "Support"
# System Message Configuration # System Message Configuration
SystemMessages: "true" SystemMessages: true
SystemMessage_Channel: "system-messages" SystemMessage_Channel: "system-messages"
SystemMessage_Type: "embed" SystemMessage_Type: "embed"
@@ -129,7 +133,7 @@ Leave_Title: "User Left!"
LeaveMessage: "Goodbye %member%, Thank you for visting %guildname%!" LeaveMessage: "Goodbye %member%, Thank you for visting %guildname%!"
# %member% define the user who left and %guildnamne% defines the server name. # %member% define the user who left and %guildnamne% defines the server name.
SystemMessage_EmbedFooter: "false" SystemMessage_EmbedFooter: false
# LINKS Configuration # LINKS Configuration
@@ -227,4 +231,4 @@ IncorrectPerms: ":x: **Err!** You do not have the correct permissions to use thi
InvalidChannel: ":x: **Err!** Channel not found. Please create it!" InvalidChannel: ":x: **Err!** Channel not found. Please create it!"
UserNotFound: ":x: **Err!** This user doesn't exist, Are they in this server?" UserNotFound: ":x: **Err!** This user doesn't exist, Are they in this server?"
NoValidTicket: ":warning: You cannot execute this command here. This command is used when closing a ticket." NoValidTicket: ":warning: You cannot execute this command here. This command is used when closing a ticket."
TicketExists: ":warning: This ticket cannot be opened, It already exists!" TicketExists: ":warning: This ticket cannot be opened, It already exists!"