From fd5fc8294c33c7bfe16305f7501259f7d0268d86 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sat, 22 May 2021 23:13:16 +0200 Subject: [PATCH 01/24] update help.js Fixxed a bug with staffcommands show --- commands/help.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/help.js b/commands/help.js index 18e290a..5db5217 100644 --- a/commands/help.js +++ b/commands/help.js @@ -12,14 +12,16 @@ module.exports = { description: supportbot.HelpDesc, execute(message, args) { - if (supportbot.DeleteMessages == "true") message.delete(); + if (supportbot.DeleteMessages === "true") 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}!`); if (supportbot.helpmenu_withkey = "true") { let generalCommands = ""; 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.PingCommand}** ${supportbot.PingDesc}\n`; @@ -49,7 +51,7 @@ module.exports = { .setColor(supportbot.EmbedColour) .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( { name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false }, ) From 4399dfe6b8467a76cd0f69c0c4c85b6a739bb879 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sat, 22 May 2021 23:38:32 +0200 Subject: [PATCH 02/24] Fixxed a copy error replaced reactionUser with user cause reactionUser was defined in the ticket command --- commands/blacklistUser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/blacklistUser.js b/commands/blacklistUser.js index 72eda28..a2c7866 100644 --- a/commands/blacklistUser.js +++ b/commands/blacklistUser.js @@ -70,7 +70,7 @@ module.exports = { .setDescription(`${user} is already blacklisted`) .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({ embed: embed4 }) From 0a82c62a4e4559cdc4fd515335a7bc4512b6462f Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sat, 22 May 2021 23:41:39 +0200 Subject: [PATCH 03/24] boolean changes workin on suggestion #67 from pat2381 --- supportbot-config.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/supportbot-config.yml b/supportbot-config.yml index 9104f4d..9b2a0a9 100755 --- a/supportbot-config.yml +++ b/supportbot-config.yml @@ -24,7 +24,7 @@ StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME" ActivityType: "PLAYING" # Activity status can either be PLAYING, WATCHING, LISTENING or STREAMING. -DeleteMessages: "true" +DeleteMessages: true # Embed Configuration @@ -37,7 +37,7 @@ WarningColour: "#fca117" # 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. AutoRole_Role: "Member" LockdownRole: "@everyone" @@ -55,9 +55,9 @@ TranscriptLog: "transcripts" 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. -AllowTicketMentions: "true" -# Set to "true" to allow the ticket to mention the author and the support team. -# Set to "false" to dis-allow mentions within tickets. +AllowTicketMentions: true +# Set to true to allow the ticket to mention the author and the support team. +# Set to false to dis-allow mentions within tickets. # Ticket Panel (Ticket Reaction Create) @@ -86,15 +86,15 @@ RemovedUser: "👍 <@%user%> has been removed from this ticket" ClosingTicket: ":warning: You have requested to close your support ticket." 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. # Ticket Department Configuration -TicketDepartments: "true" +TicketDepartments: true # 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. DepartmentEmoji_1: "🙋" @@ -114,7 +114,7 @@ DepartmentRole_3: "Support" # System Message Configuration -SystemMessages: "true" +SystemMessages: true SystemMessage_Channel: "system-messages" SystemMessage_Type: "embed" @@ -129,7 +129,7 @@ Leave_Title: "User Left!" LeaveMessage: "Goodbye %member%, Thank you for visting %guildname%!" # %member% define the user who left and %guildnamne% defines the server name. -SystemMessage_EmbedFooter: "false" +SystemMessage_EmbedFooter: false # LINKS Configuration From 8209dfa26ce81c78e41e0336248af632095141b4 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:38:55 +0200 Subject: [PATCH 04/24] Update addUser.js ID Support, Boolean Changes --- commands/addUser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/addUser.js b/commands/addUser.js index 52f0555..e830cf9 100755 --- a/commands/addUser.js +++ b/commands/addUser.js @@ -12,11 +12,11 @@ module.exports = { description: supportbot.AddUserDesc, 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}!`); - let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) - let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) + 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) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin) const NoPerms = new Discord.MessageEmbed() .setTitle("Invalid Permissions!") From e81684d322d9df727e128e9d220480104c6f04b2 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:03 +0200 Subject: [PATCH 05/24] Update announce.js ID Support, Boolean Changes --- commands/announce.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/announce.js b/commands/announce.js index 953e614..3e03976 100755 --- a/commands/announce.js +++ b/commands/announce.js @@ -14,9 +14,9 @@ module.exports = { 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}!`); @@ -27,7 +27,7 @@ module.exports = { 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() .setTitle("Invalid Permissions!") From bd33669dba5c7f4504d37a8c767d6d9440df6f01 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:08 +0200 Subject: [PATCH 06/24] Update ban.js ID Support, Boolean Changes --- commands/ban.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/ban.js b/commands/ban.js index ced6931..a80fc7a 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -13,9 +13,9 @@ module.exports = { description: supportbot.BanDesc, 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}!`); @@ -27,7 +27,7 @@ module.exports = { if (!message.member.roles.cache.has(SupportStaff.id)) 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() .setTitle("Invalid Channel") From 48426102293a6591281dcb878dd4b34b2fc23ab4 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:13 +0200 Subject: [PATCH 07/24] Update blacklistUser.js ID Support, Boolean Changes --- commands/blacklistUser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/blacklistUser.js b/commands/blacklistUser.js index a2c7866..ca2eb06 100644 --- a/commands/blacklistUser.js +++ b/commands/blacklistUser.js @@ -13,9 +13,9 @@ module.exports = { description: supportbot.BlacklistDesc, 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}!`); @@ -28,7 +28,7 @@ module.exports = { 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]); From c27f16f753ec4d039d425653c5b3440e310fb93f Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:18 +0200 Subject: [PATCH 08/24] Update botSay.js ID Support, Boolean Changes --- commands/botSay.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/botSay.js b/commands/botSay.js index 9d59134..be74da2 100755 --- a/commands/botSay.js +++ b/commands/botSay.js @@ -13,9 +13,9 @@ module.exports = { description: supportbot.BotSayDesc, 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}!`); From c5dd8823f6876374c6c141602513ad43abc1b1a6 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:24 +0200 Subject: [PATCH 09/24] Update close.js ID Support, Boolean Changes --- commands/close.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/close.js b/commands/close.js index 64340ab..f7100a0 100755 --- a/commands/close.js +++ b/commands/close.js @@ -13,7 +13,7 @@ module.exports = { description: supportbot.CloseTicketDesc, 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}!`); @@ -28,7 +28,7 @@ module.exports = { } - if (supportbot.CloseConfirmation === "true") { + if (supportbot.CloseConfirmation) { const CloseTicketRequest = new Discord.MessageEmbed() .setTitle(`**${supportbot.ClosingTicket}**`) .setDescription(`Please confirm by repeating the following word.. \`${supportbot.ClosingConfirmation_Word}\` `) @@ -42,7 +42,7 @@ module.exports = { }).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 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 reason = args.join(" ") || "No Reason Provided."; From cd17b0a6d77847a0561ba2b56b5c93b2e60c8cd4 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:31 +0200 Subject: [PATCH 10/24] Update help.js ID Support, Boolean Changes --- commands/help.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/help.js b/commands/help.js index 5db5217..51efee6 100644 --- a/commands/help.js +++ b/commands/help.js @@ -12,13 +12,13 @@ module.exports = { description: supportbot.HelpDesc, 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}!`); - if (supportbot.helpmenu_withkey = "true") { + if (supportbot.HelpMenu_WithKey) { let generalCommands = ""; generalCommands += `**${supportbot.Prefix}${supportbot.HelpCommand}** ${supportbot.HelpDesc}\n`; generalCommands += `**${supportbot.Prefix}${supportbot.LinksCommand}** ${supportbot.LinksDesc}\n`; From 57ea2e25bd268d41d10196b441b75c9945b061ec Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:36 +0200 Subject: [PATCH 11/24] Update kick.js ID Support, Boolean Changes --- commands/kick.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/kick.js b/commands/kick.js index c3b056b..1932a7e 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -13,9 +13,9 @@ module.exports = { description: supportbot.KickDesc, 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}!`); @@ -27,7 +27,7 @@ module.exports = { if (!message.member.roles.cache.has(SupportStaff.id)) 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() .setTitle("Invalid Channel") From 96c1d80844c81caa9d975a20f07c677ea47763b6 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:42 +0200 Subject: [PATCH 12/24] Update links.js ID Support, Boolean Changes --- commands/links.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/links.js b/commands/links.js index 703214d..653eee4 100755 --- a/commands/links.js +++ b/commands/links.js @@ -13,7 +13,7 @@ module.exports = { description: supportbot.LinksDesc, 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}!`); From af481a2ec82acc55c337985d98ed522cb899cac4 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:39:58 +0200 Subject: [PATCH 13/24] Update newticket.js ID Support, Boolean Changes Fixxed everyone permissions on ticket creation --- commands/newticket.js | 66 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/commands/newticket.js b/commands/newticket.js index 2951de8..a75ce76 100755 --- a/commands/newticket.js +++ b/commands/newticket.js @@ -18,8 +18,8 @@ module.exports = { description: supportbot.NewTicketDesc, execute(message, args) { - if (!message.channel.name === supportbot.ReactionChannel) { - if (supportbot.DeleteMessages == "true") message.delete(); + if (!message.channel.name === supportbot.ReactionChannel || !message.channel.id === supportbot.ReactionChannel) { + if (supportbot.DeleteMessages) message.delete(); } let reactionUser = message.guild.members.cache.get(message.author.id) @@ -50,21 +50,21 @@ module.exports = { message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`, { type: "text", + permissionOverwrites: [ + { + id: message.guild.roles.everyone, + deny: ['VIEW_CHANNEL'], + } + ] }).then(SupportTicket => { let AllUsers = message.guild.roles.cache.find(everyone => everyone.name === '@everyone') - let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) - let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) + 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) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin) - let DeptRole1 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_1}`) - let DeptRole2 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_2}`) - let DeptRole3 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_3}`) - - SupportTicket.updateOverwrite(AllUsers, { - VIEW_CHANNEL: false, - READ_MESSAGES: false, - SEND_MESSAGES: false, - }) + 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}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_2}`) + 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(message.author, { VIEW_CHANNEL: true, @@ -84,20 +84,22 @@ module.exports = { SEND_MESSAGES: true, }) + SupportTicket.updateOverwrite(AllUsers, { + VIEW_CHANNEL: false + }) + + + // 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) { 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 - if (supportbot.AllowTicketMentions === "true") { + if (supportbot.AllowTicketMentions) { 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}**` }) } @@ -134,7 +136,7 @@ module.exports = { reacted[ticketNumberID] = false; - if (supportbot.TicketDepartments === "true") { + if (supportbot.TicketDepartments) { await msg.react(Emoji_1); await msg.react(Emoji_2); 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(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, }) } - if (supportbot.AllowStaff === "false") { + if (!supportbot.AllowStaff) { SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, }) } @@ -160,7 +162,7 @@ module.exports = { .setColor(supportbot.EmbedColour) SupportTicket.send({ embed: Department1 }); - if (supportbot.AllowTicketMentions === "true") { + if (supportbot.AllowTicketMentions) { SupportTicket.send(`@here`) } @@ -171,11 +173,11 @@ module.exports = { SupportTicket.updateOverwrite(Admins, { 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, }) } - if (supportbot.AllowStaff === "false") { + if (!supportbot.AllowStaff) { SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, }) } @@ -184,7 +186,7 @@ module.exports = { .setColor(supportbot.EmbedColour) SupportTicket.send({ embed: Department2 }); - if (supportbot.AllowTicketMentions === "true") { + if (supportbot.AllowTicketMentions) { SupportTicket.send(`@here`) } @@ -196,11 +198,11 @@ module.exports = { SupportTicket.updateOverwrite(DeptRole3, { VIEW_CHANNEL: true, 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, }) } - if (supportbot.AllowStaff === "false") { + if (!supportbot.AllowStaff) { SupportTicket.updateOverwrite(SupportStaff, { VIEW_CHANNEL: false, READ_MESSAGES: true, SEND_MESSAGES: true, }) } @@ -209,7 +211,7 @@ module.exports = { .setColor(supportbot.EmbedColour) SupportTicket.send({ embed: Department3 }); - if (supportbot.AllowTicketMentions === "true") { + if (supportbot.AllowTicketMentions) { 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() .setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, SupportTicket.id).replace(/%ticketusername%/g, message.author.username)) .setColor(supportbot.EmbedColour) @@ -269,7 +271,7 @@ module.exports = { .setColor(supportbot.EmbedColour) .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 }); From 14df15caebcda1abeb87d12abf757349554715fd Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:40:03 +0200 Subject: [PATCH 14/24] Update ping.js ID Support, Boolean Changes --- commands/ping.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/ping.js b/commands/ping.js index 9f3e45a..b3a26f8 100755 --- a/commands/ping.js +++ b/commands/ping.js @@ -12,7 +12,7 @@ module.exports = { description: supportbot.PingDesc, 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}!`) From 2e1253c54e5b69d80cacc1c9f56217bef628eb69 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:40:10 +0200 Subject: [PATCH 15/24] Update purge.js ID Support, Boolean Changes --- commands/purge.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/purge.js b/commands/purge.js index b483103..82a160a 100644 --- a/commands/purge.js +++ b/commands/purge.js @@ -13,9 +13,9 @@ module.exports = { description: supportbot.PurgeDesc, 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}!`); @@ -27,7 +27,7 @@ module.exports = { if (!message.member.roles.cache.has(SupportStaff.id)) 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() .setTitle("Invalid Channel") From 0385de3882e5b32f70b62c04b59ef96460893340 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:40:16 +0200 Subject: [PATCH 16/24] Update removeUser.js ID Support, Boolean Changes --- commands/removeUser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/removeUser.js b/commands/removeUser.js index 5a83022..39d18bd 100755 --- a/commands/removeUser.js +++ b/commands/removeUser.js @@ -12,12 +12,12 @@ module.exports = { description: supportbot.RemoveUserDesc, 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}!`); - let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) - let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) + 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) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin) const NoPerms = new Discord.MessageEmbed() .setTitle("Invalid Permissions!") From 4f25cfa0dd291b4897cc512e14f76ed0dbaf00dc Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:40:20 +0200 Subject: [PATCH 17/24] Update suggest.js ID Support, Boolean Changes --- commands/suggest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/suggest.js b/commands/suggest.js index f512c68..ee0d5c0 100755 --- a/commands/suggest.js +++ b/commands/suggest.js @@ -12,9 +12,9 @@ module.exports = { description: supportbot.SuggestionDesc, 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}!`); From 2cc316aafb4d4331a9165f9d3fe63bab8249169d Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:40:28 +0200 Subject: [PATCH 18/24] Update guildMemberAdd.js ID Support, Boolean Changes --- events/guildMemberAdd.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index 71b37ac..e2d7ae6 100755 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -9,15 +9,15 @@ const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')) module.exports = async (bot, member) => { - if (supportbot.SystemMessages === "true") { - const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) + if (supportbot.SystemMessages) { + const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) || member.guild.channels.cache.get(supportbot.SystemMessage_Channel) if (!SystemChannel) return; console.log(`[${supportbot.Bot_Name}]: ${member.user.username} has joined ${member.guild.name}!`) 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); @@ -37,7 +37,7 @@ module.exports = async (bot, member) => { } - if (supportbot.SystemMessage_EmbedFooter === "true") { + if (supportbot.SystemMessage_EmbedFooter) { GuildAddMember.setFooter(supportbot.EmbedFooter) } From e6d63db3a944a9a52b017a9d22b0ff31faec2914 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:40:32 +0200 Subject: [PATCH 19/24] Update guildMemberRemove.js ID Support, Boolean Changes --- events/guildMemberRemove.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index 15d1f72..ef5d09a 100755 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -9,8 +9,8 @@ const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')) module.exports = async (bot, member) => { - if (supportbot.SystemMessages === "true") { - const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) + if (supportbot.SystemMessages) { + const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) || member.guild.channels.cache.get(supportbot.SystemMessage_Channel) if (!SystemChannel) return; From 2c5ebd86204f294a8093db4badef1507773e34b9 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:40:37 +0200 Subject: [PATCH 20/24] Update messageReactionAdd.js ID Support, Boolean Changes --- events/messageReactionAdd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/events/messageReactionAdd.js b/events/messageReactionAdd.js index 553b9d4..9760c36 100644 --- a/events/messageReactionAdd.js +++ b/events/messageReactionAdd.js @@ -17,7 +17,7 @@ module.exports = async (client, reaction, user) => { channel: reaction.message.channel } - if (supportbot.ReactionTickets === true) { + if (supportbot.ReactionTickets) { if (reaction.message.id === tickets.ReactionMessage_ID) { if (reaction.emoji.name == supportbot.ReactionEmoji || reaction.emoji.id == supportbot.ReactionEmoji) { await reaction.users.remove(user.id) From 9e63e0ff0910d781f5bf6d26a0bdd3fe4d54af86 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:41:05 +0200 Subject: [PATCH 21/24] Create raw.js Added Raw-Event, probably fixxed the ticketreaction isnt 100% workin --- events/raw.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 events/raw.js diff --git a/events/raw.js b/events/raw.js new file mode 100644 index 0000000..400b0b5 --- /dev/null +++ b/events/raw.js @@ -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)); + } + }); +} \ No newline at end of file From aff7ff1451eff58570ae446cb451a0da5bd1ab21 Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:41:15 +0200 Subject: [PATCH 22/24] Update ready.js ID Support, Boolean Changes --- events/ready.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/events/ready.js b/events/ready.js index 1b60513..f1fc6fa 100644 --- a/events/ready.js +++ b/events/ready.js @@ -20,8 +20,8 @@ module.exports = async (bot) => { console.log(`\u001b[37m`, `${supportbot.Bot_Name} has successfully connected to discord`) console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`) - if (supportbot.ReactionTickets === true) { - let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel) + if (supportbot.ReactionTickets) { + let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel) || bot.channels.cache.find(channel => channel.id === supportbot.ReactionChannel) if (!chan1) { 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) .setFooter(supportbot.EmbedFooter); - if (supportbot.ReactionPanel_Description === true) { + if (supportbot.ReactionPanel_Description) { embed.setDescription(supportbot.ReactionDescription) } - if (supportbot.ReactionPanel_Thumbnail === true) { + if (supportbot.ReactionPanel_Thumbnail) { embed.setThumbnail(supportbot.ReactionThumbnail) } - if (supportbot.ReactionPanel_Image === true) { + if (supportbot.ReactionPanel_Image) { embed.setImage(supportbot.ReactionImage) } - bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel).send({ + chan1.send({ embed: embed }).then(r => { let data = { From 92a3745ce1350bd06c7ee235527c89ff4c9e59dd Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:44:00 +0200 Subject: [PATCH 23/24] Update supportbot-config.yml Added HelpMenu_WithKey Option. Boolean Changes --- supportbot-config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/supportbot-config.yml b/supportbot-config.yml index 9b2a0a9..39c909f 100755 --- a/supportbot-config.yml +++ b/supportbot-config.yml @@ -35,6 +35,10 @@ ErrorColour: "#d12519" SuccessColour: "#04b545" WarningColour: "#fca117" +# Help Menu Configuration, Do Not Change. + +HelpMenu_WithKey: true + # Role Configuration AutoRole: true @@ -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!" 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." -TicketExists: ":warning: This ticket cannot be opened, It already exists!" +TicketExists: ":warning: This ticket cannot be opened, It already exists!" \ No newline at end of file From 10f8821b3bc11d525d9655f267a7cab47179ba3c Mon Sep 17 00:00:00 2001 From: DuAnti7423 <82730507+DuAnti7423@users.noreply.github.com> Date: Sun, 23 May 2021 10:45:00 +0200 Subject: [PATCH 24/24] Random Stuff idk why github thinks i changed something --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b431e5..47ddf98 100755 --- a/package.json +++ b/package.json @@ -23,4 +23,4 @@ "url": "https://github.com/1tzemerald/SupportBot/issues" }, "homepage": "https://emeraldsrv.dev" -} +} \ No newline at end of file