diff --git a/commands/botSay.js b/commands/botSay.js old mode 100755 new mode 100644 index 5ef749c..8fe0e76 --- a/commands/botSay.js +++ b/commands/botSay.js @@ -48,4 +48,4 @@ module.exports = { } -}; +}; \ No newline at end of file diff --git a/commands/help.js b/commands/help.js index 526db0f..78a8f58 100644 --- a/commands/help.js +++ b/commands/help.js @@ -33,12 +33,13 @@ module.exports = { staffCommands += `**${supportbot.Prefix}${supportbot.RemoveUser} ** ${supportbot.RemoveUserDesc}\n` staffCommands += `**${supportbot.Prefix}${supportbot.BotSay}** ${supportbot.BotSayDesc}\n` staffCommands += `**${supportbot.Prefix}${supportbot.PurgeMessage}** ${supportbot.PurgeDesc}\n` + staffCommands += `**${supportbot.Prefix}${supportbot.ChatLog}** ${supportbot.ChatLogDesc}\n` let adminCommands = ""; adminCommands += `**${supportbot.Prefix}${supportbot.AnnounceCommand}** ${supportbot.AnnounceDesc} \`Admin Only\`\n` adminCommands += `**${supportbot.Prefix}${supportbot.BanUser}** ${supportbot.BanDesc} \`Admin Only\` \n` adminCommands += `**${supportbot.Prefix}${supportbot.KickUser}** ${supportbot.KickDesc} \`Admin Only\` \n` - adminCommands += `**${supportbot.Prefix}${supportbot.BlacklistUser}** ${supportbot.BlacklistDesc} \`Admin Only\` \n` + adminCommands += `**${supportbot.Prefix}${supportbot.BlacklistUser}** ${supportbot.BlacklistDesc} \`Admin Only\` \n` const HelpEmbed1 = new Discord.MessageEmbed() .setTitle(supportbot.Bot_Name) diff --git a/commands/suggest.js b/commands/suggest.js index afffe65..473f49a 100755 --- a/commands/suggest.js +++ b/commands/suggest.js @@ -40,10 +40,20 @@ module.exports = { .setColor(supportbot.EmbedColour) .setFooter(supportbot.EmbedFooter) - .setTitle(supportbot.SuggestionTitle) - .setDescription(`\`\`\`${suggestion}\`\`\``) + .addField(supportbot.SuggestionTitle, suggestion, true) + .addField("From", `<@${message.author.id}>`, true) - .addFields( { name: "From", value: `<@${message.author.id}>`, inline: false }, ) + if (supportbot.SuggestionMessage_Icon === "BOT") { + SuggestionMessage.setThumbnail(bot.user.displayAvatarURL()) + } + + if (supportbot.SuggestionMessage_Icon === "USER") { + SuggestionMessage.setThumbnail(message.author.displayAvatarURL()) + } + + if (supportbot.SuggestionMessage_Icon === "CUSTOM") { + SuggestionMessage.setThumbnail(supportbot.SuggestionIcon_URL) + } locateChannel.send({ embed: SuggestionMessage }).then(async function(msg) { msg.react(supportbot.SuggestReact_1).then(() => msg.react(supportbot.SuggestReact_2)); diff --git a/commands/ticket.js b/commands/ticket.js index dbeb1d7..1638b22 100644 --- a/commands/ticket.js +++ b/commands/ticket.js @@ -208,7 +208,7 @@ module.exports = { .setColor(supportbot.ErrorColour); const TicketLogs = new Discord.MessageEmbed() - .setTitle("Ticket Log") + .setTitle(supportbot.TicketLog_Title) .setThumbnail(supportbot.Ticket_Thumbnail) .addFields( { name: 'Ticket', value: `<#${channel.id}>` }, diff --git a/commands/transcript.js b/commands/transcript.js new file mode 100644 index 0000000..b71abdf --- /dev/null +++ b/commands/transcript.js @@ -0,0 +1,66 @@ +// SupportBot, Created by Emerald Services +// Announce + +const Discord = require("discord.js"); +const fs = require("fs"); + +const yaml = require('js-yaml'); +const { execute } = require("./help"); +const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); + +module.exports = { + name: supportbot.ChatLog, + description: supportbot.ChatLogDesc, + + execute(message, args) { + if (supportbot.DeleteMessages) message.delete(); + + let name = message.channel.name; + + message.channel.messages.fetch({ limit: 100 }).then( msgs => { + let html = ''; + + msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp ); + html += `--- Channel Transcript ---
`; + html += `Server Name: ${message.guild.name}
`; + html += `Channel: ${name}
`; + html += `Message: ${msgs.size} Messages


`; + + msgs.forEach( msg => { + if ( msg.content ) { + html += `User: ${msg.author.tag}
`; + html += `Message: ${msg.content}
`; + html += `-----

`; + } + }); + + const TranscriptSavedEmbed = new Discord.MessageEmbed() + .setDescription(supportbot.ChatLogSavedMessage) + .setColor(supportbot.SuccessColour) + message.channel.send({embed: TranscriptSavedEmbed}) + + const errornochannel = new Discord.MessageEmbed() + .setTitle("SupportBot Error!") + .setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.TicketLog}\`\n\nError Code: \`SB-03\``) + .setColor(supportbot.ErrorColour); + + const ChatLogs = new Discord.MessageEmbed() + .setTitle(supportbot.ChatLog_Title) + .setThumbnail(supportbot.ChatLog_Thumbnail) + .addFields( + { name: 'Channel', value: `<#${message.channel.id}>` }, + { name: 'User', value: `<@${message.author.id}>` }, + ) + .setColor(supportbot.EmbedColour) + .setFooter(supportbot.EmbedFooter) + + let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === supportbot.ChatLogChannel) || message.guild.channels.cache.find(LocateChannel => LocateChannel.id === supportbot.ChatLogChannel) + + if(!locateChannel) return message.channel.send({ embed: errornochannel }); + + locateChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) ); + locateChannel.send({ embed: ChatLogs }); + + }) + } +} \ No newline at end of file diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index e2d7ae6..c3f1e72 100755 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -36,6 +36,10 @@ module.exports = async (bot, member) => { GuildAddMember.setThumbnail(member.user.displayAvatarURL()) } + if (supportbot.SystemMessage_Icon === "CUSTOM") { + SuggestionMessage.setThumbnail(supportbot.SystemMessageIcon_URL) + } + if (supportbot.SystemMessage_EmbedFooter) { GuildAddMember.setFooter(supportbot.EmbedFooter) diff --git a/supportbot-config.yml b/supportbot-config.yml index 83f31a1..9068f01 100755 --- a/supportbot-config.yml +++ b/supportbot-config.yml @@ -78,6 +78,7 @@ TicketLog: "ticket-logs" TranscriptLog: "transcripts" TranscriptTitle: "Ticket Transcript" +TicketLog_Title: "Ticket Log" TicketBlackListMessage: "You are not allowed to open a ticket" TicketSubject: "description" @@ -187,6 +188,8 @@ SystemMessage_Type: "embed" SystemMessage_Icon: "USER" # USER - This will display the user's icon of who joins. # BOT - This will display the bot's icon when a someone joins. +# CUSTOM - This will allow you to use a custom image, set this below! +SystemMessageIcon_URL: "https://imgur.com/example.png" Welcome_Title: "User Joined!" WelcomeMessage: "Hello %member%, Welcome to %guildname%!" @@ -220,6 +223,12 @@ SuggestionStarter: "What would you like to suggest?" SuggestReact_1: 👍 SuggestReact_2: 👎 +SuggestionMessage_Icon: "USER" +# USER - This will display the user's icon of who joins. +# BOT - This will display the bot's icon when a someone joins. +# CUSTOM - This will allow you to use a custom image, set this below! +SuggestionIcon_URL: "https://imgur.com/example.png" + # ---------------------------- # Announcement Configuration # ---------------------------- @@ -234,6 +243,12 @@ AnnouncementStarter: "What would you like to announce?" # Moderation Configuration # -------------------------- +ChatLog_Title: "Chat Log" +ChatLogChannel: "chat-logs" +ChatLogColour: "#1BA30C" +ChatLog_Thumbnail: "https://cdn.iconscout.com/icon/free/png-256/chat-2639493-2187526.png" +ChatLogSavedMessage: "📝 **Channel Transcript Saved!**" + BanTitle: "User Banned!" DaysBannedFor: 7 BanLogColour: "#D911B4" @@ -272,6 +287,7 @@ RenameTicket: "rename" # --- Staff/Admin Commands --- +ChatLog: "transcript" BotSay: "say" PurgeMessage: "purge" @@ -286,6 +302,8 @@ BlacklistUser: "blacklist" # --- Command Messages --- +BotSayDesc: "Say something with the bot" +ChatLogDesc: "Get a transcript of a channel" NewTicketDesc: "Create a new support ticket" AnnounceDesc: "Create a server announcement" CloseTicketDesc: "Close your support ticket" @@ -295,7 +313,6 @@ HelpDesc: "Get a list of all the commands" RemoveUserDesc: "Remove a user from a support ticket" AddUserDesc: "Add a user to a support ticket" SuggestionDesc: "Create a server suggestion" -BotSayDesc: "Say something with the bot" BanDesc: "Ban a member from this server." KickDesc: "Kick a member from this server." PurgeDesc: "Purge messages from the chat."