From 500c01dd1f621ea1d788e2b1a66e7cfa89df9488 Mon Sep 17 00:00:00 2001 From: Joseph Gonzalo Date: Wed, 24 Jul 2019 16:52:30 -0600 Subject: [PATCH] Add files via upload --- commands/add.js | 15 ++++++++++ commands/announce.js | 63 ++++++++++++++++++++++++++++++++++++++++++ commands/close.js | 15 ++++++++++ commands/forceclose.js | 14 ++++++++++ commands/help.js | 23 +++++++++++---- commands/links.js | 14 ++++++++++ commands/lockchat.js | 14 ++++++++++ commands/ping.js | 14 ++++++++++ commands/poll.js | 14 ++++++++++ commands/remove.js | 14 ++++++++++ commands/rename.js | 14 ++++++++++ commands/report.js | 15 ++++++++++ commands/say.js | 22 +++++++++++---- commands/suggest.js | 28 +++++++++++++++---- commands/ticket.js | 59 +++++++++++++++++++++++++++++++++++---- commands/unlock.js | 14 ++++++++++ 16 files changed, 331 insertions(+), 21 deletions(-) create mode 100644 commands/announce.js diff --git a/commands/add.js b/commands/add.js index cdc9d2b..048174f 100644 --- a/commands/add.js +++ b/commands/add.js @@ -53,6 +53,21 @@ const useradded = new Discord.RichEmbed() message.channel.send({embed: useradded}); console.log(`\x1b[36m`, `${message.author} has successfully added ${rUser} to ${message.channel}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Add_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + + } exports.help = { diff --git a/commands/announce.js b/commands/announce.js new file mode 100644 index 0000000..c123337 --- /dev/null +++ b/commands/announce.js @@ -0,0 +1,63 @@ +// SupportBot +// Command: Say + +const Discord = require("discord.js"); +const bot = new Discord.Client() + +bot.settings = require("../settings.json"); + +exports.run = (bot, message, args) => { + message.delete(); + + let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`) + + const rolemissing = new Discord.RichEmbed() + .setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) + .setColor(bot.settings.colour) + if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)}) + + const donothaverole = new Discord.RichEmbed() + .setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) + .setColor(bot.settings.colour) + if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole) + + const embed = new Discord.RichEmbed() + .setTitle(`${bot.settings.Announcement_Title}`) + .setDescription(args.join(" ")) + .setTimestamp() + .setColor(bot.settings.colour) + .setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL) + + let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Announcement_Channel}`) + if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Announcement_Channel}**`) + + ac.send(embed) + ac.send(`${bot.settings.Annuoncement_Tag_Role}`) + + const SuggestionSuccessEmbed = new Discord.RichEmbed() + .setDescription(`:white_check_mark: You have successfully created an announcement. <#${ac.id}>`) + .setColor(bot.settings.colour) + message.channel.send(SuggestionSuccessEmbed); + + console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Announcement_Command}`) + + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Announcement_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + + +} + +exports.help = { + name: bot.settings.Announcement_Command, +} \ No newline at end of file diff --git a/commands/close.js b/commands/close.js index 3fdf545..fd71d83 100644 --- a/commands/close.js +++ b/commands/close.js @@ -36,6 +36,21 @@ message.channel.send({embed: close1}).then(m => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Close_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Close_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + + } exports.help = { diff --git a/commands/forceclose.js b/commands/forceclose.js index 8c23a0d..6b77c55 100644 --- a/commands/forceclose.js +++ b/commands/forceclose.js @@ -29,6 +29,20 @@ message.channel.delete(); console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Forceclose_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Forceclose_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/help.js b/commands/help.js index 7fce35a..a3f64ac 100644 --- a/commands/help.js +++ b/commands/help.js @@ -12,16 +12,15 @@ exports.run = (bot, message, args) => { let userCommands = ""; userCommands += `**${bot.settings.prefix}${bot.settings.Link_Command}**: Get some important links!\n`; userCommands += `**${bot.settings.prefix}${bot.settings.Ping_Command}**: Check the bots ping. Pong!\n`; - userCommands += `**${bot.settings.prefix}${bot.settings.Ticket_Command} **: Create a support ticket\n`; + userCommands += `**${bot.settings.prefix}${bot.settings.Ticket_Command} **: Create a support ticket\n`; userCommands += `**${bot.settings.prefix}${bot.settings.Close_Command}**: Close your support ticket\n`; - userCommands += `**${bot.settings.prefix}${bot.settings.Report_Command} **: Report a user\n`; userCommands += `**${bot.settings.prefix}${bot.settings.Suggest_Command} **: Create a server suggestion\n`; let supportCommands = ""; - supportCommands += `**${bot.settings.prefix}${bot.settings.Add_Command} **: Adds a user to a ticket\n`; + supportCommands += `**${bot.settings.prefix}${bot.settings.Add_Command} **: Adds a user to a ticket\n`; supportCommands += `**${bot.settings.prefix}${bot.settings.Remove_Command} **: Removes a user from a ticket\n`; supportCommands += `**${bot.settings.prefix}${bot.settings.Forceclose_Command}**: Forceclose a support ticket\n`; - supportCommands += `**${bot.settings.prefix}${bot.settings.Rename_Command}**: Rename a support ticket\n`; + supportCommands += `**${bot.settings.prefix}${bot.settings.Rename_Command}**: Rename a support ticket\n`; let staffCommands = ""; staffCommands += `**${bot.settings.prefix}${bot.settings.Say_Command} **: Create a bot announcement\n`; @@ -40,8 +39,22 @@ exports.run = (bot, message, args) => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Help_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Help_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via settings.json`); + + CommandLog.send(CMDLog); + } exports.help = { name: bot.settings.Help_Command, -} +} \ No newline at end of file diff --git a/commands/links.js b/commands/links.js index 1ec9507..471a61d 100644 --- a/commands/links.js +++ b/commands/links.js @@ -27,6 +27,20 @@ exports.run = ( bot, message, args ) => { console.log( `\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Link_Command}` ) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Link_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/lockchat.js b/commands/lockchat.js index 6e787d7..2c8733e 100644 --- a/commands/lockchat.js +++ b/commands/lockchat.js @@ -31,6 +31,20 @@ exports.run = async(bot, message, args) => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Lockchat_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Lockchat_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/ping.js b/commands/ping.js index 444ffcf..c4aac6b 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -16,6 +16,20 @@ exports.run = (bot, message, args) => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ping_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Ping_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/poll.js b/commands/poll.js index bf1ec49..f14b6f3 100644 --- a/commands/poll.js +++ b/commands/poll.js @@ -39,6 +39,20 @@ exports.run = (bot, message, args) => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Poll_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Close_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/remove.js b/commands/remove.js index 8dd3451..1ea6bd9 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -53,6 +53,20 @@ const useradded = new Discord.RichEmbed() message.channel.send({embed: useradded}); console.log(`\x1b[36m`, `${message.author} has successfully removed ${rUser} from ${message.channel}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Remove_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/rename.js b/commands/rename.js index d7f7bc0..883e52e 100644 --- a/commands/rename.js +++ b/commands/rename.js @@ -42,6 +42,20 @@ exports.run = (bot, message, args) => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Rename_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Rename_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/report.js b/commands/report.js index 7c659f8..bde1bfa 100644 --- a/commands/report.js +++ b/commands/report.js @@ -48,6 +48,21 @@ exports.run = (bot, message, args) => { } else { rc.send(embed); console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Report_Command}`); + + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Report_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } } } diff --git a/commands/say.js b/commands/say.js index 41810d4..20c5877 100644 --- a/commands/say.js +++ b/commands/say.js @@ -26,15 +26,25 @@ exports.run = (bot, message, args) => { .setDescription(args.join(" ")) .setTimestamp() .setColor(bot.settings.colour) -.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL) - - let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Announcement_Channel}`) - if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Announcement_Channel}**`) - - ac.send(embed) + .setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL) + + message.channel.send(embed); console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Say_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Say_Command, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/suggest.js b/commands/suggest.js index 87c8d11..ee05bb1 100644 --- a/commands/suggest.js +++ b/commands/suggest.js @@ -10,13 +10,12 @@ exports.run = async(bot, message, args) => { message.delete(); const SuggestionEmbed = new Discord.RichEmbed() - .setAuthor(`${bot.settings.Suggestion_Title} ` + message.author.username, message.author.displayAvatarURL) - .setThumbnail(message.guild.iconURL) - .setDescription(args.join(" ")) - .setFooter(`${bot.settings.footer}`, bot.user.avatarURL) + .setTitle(`${bot.settings.Suggestion_Title}`) + .setDescription(`\`\`\`${args.join(" ")}\`\`\`\nFrom <@${message.author.id}>`) + .setFooter(`${bot.settings.footer}`, message.author.avatarURL) .setTimestamp(new Date()) .setColor(bot.settings.colour); - + let sc = message.guild.channels.find(SuggestionChannel => SuggestionChannel.name === `${bot.settings.Suggestion_Channel}`); if(!sc) return message.channel.send(`:x: Error! Could not find the suggestion channel **${bot.settings.Suggestion_Channel}**`); @@ -26,8 +25,27 @@ exports.run = async(bot, message, args) => { msg.react(bot.settings.suggestyes).then(() => msg.react(bot.settings.suggestno)); }); + const SuggestionSuccessEmbed = new Discord.RichEmbed() + .setDescription(`:white_check_mark: You have successfully created your suggestion. <#${sc.id}>`) + .setColor(bot.settings.colour) + message.channel.send(SuggestionSuccessEmbed); + console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Suggest_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Suggest_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**`); + + CommandLog.send(CMDLog); + } exports.help = { diff --git a/commands/ticket.js b/commands/ticket.js index 392fafa..f4c35c0 100644 --- a/commands/ticket.js +++ b/commands/ticket.js @@ -6,18 +6,47 @@ const bot = new Discord.Client() bot.settings = require("../settings.json"); -exports.run = async(bot, message, args) => { +exports.run = (bot, message, args) => { message.delete(); const ID = Math.floor(Math.random() * 10) + 2000; - const subject = args.join(" ") || "No Subject."; + const subject = args.join(" ") || `${bot.settings.Default_Ticket_Reason}`; + + // Ticket Reactions + const reactembed = new Discord.RichEmbed() + .setColor(bot.settings.colour) + .setDescription(`${bot.settings.Ticket_React_Message}`); + message.channel.send(reactembed) + .then(function(msg) { + + msg.react('✅').then(() => msg.react('❎')); + + const filter = (reaction, user) => { + return ['✅', '❎'].includes(reaction.emoji.name) && user.id !== msg.author.id; + }; + + msg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] }) + .then(collected => { + const reaction = collected.first(); + + if (reaction.emoji.name === '❎') { + + const successEmbed = new Discord.RichEmbed() + .setDescription(`:tickets: <@${message.author.id}> You have canceled your support request.`) + .setColor(bot.settings.colour); + message.channel.send(successEmbed); + } + + if (reaction.emoji.name === '✅') { const alreadyopen = new Discord.RichEmbed() .setDescription(`:x: Cannot create a ticket because **ticket-${message.author.username}** already exists.`) .setColor(bot.settings.colour) if (message.guild.channels.find(TicketChannel => TicketChannel.name === 'ticket-' + message.author.username)) return message.channel.send(alreadyopen); - message.guild.createChannel(`ticket-${message.author.username}`, 'text').then(TicketChannel => { - + message.guild.createChannel(`ticket-${message.author.username}`, { + type: 'text', + }).then(TicketChannel => { + // Roles let staff = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.support}`) let everyone = message.guild.roles.find(everyoneRole => everyoneRole.name === `@everyone`) @@ -78,7 +107,27 @@ exports.run = async(bot, message, args) => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ticket_Command}`) -} + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.Ticket_Command, true) + .addField(`Channel`, message.channel, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + + } + + }) + + }) + + }; exports.help = { name: bot.settings.Ticket_Command, diff --git a/commands/unlock.js b/commands/unlock.js index 93b52f2..0cc48a5 100644 --- a/commands/unlock.js +++ b/commands/unlock.js @@ -31,6 +31,20 @@ exports.run = async(bot, message, args) => { console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.UnLockchat_Command}`) + const CMDLog = new Discord.RichEmbed() + .setTitle(bot.settings.Commands_Log_Title) + .addField(`User`, `<@${message.author.id}>`) + .addField(`Command`, bot.settings.UnLockchat_Command, true) + .addField(`Executed At`, message.createdAt, true) + .setColor(bot.settings.colour) + .setFooter(bot.settings.footer) + + let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); + if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); + + CommandLog.send(CMDLog); + + } exports.help = {