Compare commits

..
2 Commits
Author SHA1 Message Date
ItzEmerald 19a12f6c8f SupportBot 7.2 2021-09-11 15:29:21 +01:00
Xiled Emerald 79a498d1d6 Update transcript.js 2021-08-07 16:19:13 +01:00
22 changed files with 565 additions and 347 deletions

No files matched your search

+4 -4
View File
@@ -28,7 +28,7 @@ module.exports = {
.setTitle("No Ticket Found!") .setTitle("No Ticket Found!")
.setDescription(`${supportbot.NoValidTicket}`) .setDescription(`${supportbot.NoValidTicket}`)
.setColor(supportbot.WarningColour); .setColor(supportbot.WarningColour);
message.channel.send({ embed: Exists }); message.channel.send({ embeds: [Exists] });
return; return;
} }
@@ -39,7 +39,7 @@ module.exports = {
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.AddUser} <user#0000>\``) .setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.AddUser} <user#0000>\``)
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
if (!rUser) return message.channel.send({ embed: UserNotExist }); if (!rUser) return message.channel.send({ embeds: [UserNotExist] });
message.channel.updateOverwrite(rUser, { message.channel.updateOverwrite(rUser, {
VIEW_CHANNEL: true, VIEW_CHANNEL: true,
@@ -53,10 +53,10 @@ module.exports = {
.setDescription(supportbot.AddedUser.replace(/%user%/g, rUser.id)) .setDescription(supportbot.AddedUser.replace(/%user%/g, rUser.id))
.setTimestamp() .setTimestamp()
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ embed: Complete }); message.channel.send({ embeds: [Complete] });
} else { } else {
return message.channel.send({ embed: NoPerms }); return message.channel.send({ embeds: [NoPerms] });
} }
+4 -4
View File
@@ -23,7 +23,7 @@ module.exports = {
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.AnnouncementChannel}`) .setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.AnnouncementChannel}`)
.setColor(supportbot.ErrorColour); .setColor(supportbot.ErrorColour);
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
let Admins = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin) let Admins = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
@@ -33,13 +33,13 @@ module.exports = {
.setColor(supportbot.WarningColour) .setColor(supportbot.WarningColour)
if (!message.member.roles.cache.has(Admins.id)) if (!message.member.roles.cache.has(Admins.id))
return message.channel.send({ embed: NoPerms }); return message.channel.send({ embeds: [NoPerms] });
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setDescription(`> **${supportbot.AnnouncementStarter}**`) .setDescription(`> **${supportbot.AnnouncementStarter}**`)
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
let announcement = [] let announcement = []
message.channel.awaitMessages(response => response.content.length > 2, { message.channel.awaitMessages(response => response.content.length > 2, {
@@ -61,7 +61,7 @@ module.exports = {
const AnnouncementComplete = new Discord.MessageEmbed() const AnnouncementComplete = new Discord.MessageEmbed()
.setColor(supportbot.SuccessColour) .setColor(supportbot.SuccessColour)
.setDescription(`:white_check_mark: You have successfully created an announcement. <#${locateChannel.id}>`) .setDescription(`:white_check_mark: You have successfully created an announcement. <#${locateChannel.id}>`)
message.channel.send({ embed: AnnouncementComplete }) message.channel.send({ embeds: [AnnouncementComplete] })
}) })
}); });
+8 -8
View File
@@ -23,7 +23,7 @@ module.exports = {
.setColor(supportbot.WarningColour) .setColor(supportbot.WarningColour)
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({ embeds: [NoPerms] });
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel) let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
@@ -32,7 +32,7 @@ module.exports = {
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``) .setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
.setColor(supportbot.ErrorColour); .setColor(supportbot.ErrorColour);
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
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]);
@@ -41,7 +41,7 @@ module.exports = {
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
if (!args[0]) return message.channel.send({ if (!args[0]) return message.channel.send({
embed: embed1 embeds: [embed1]
}); });
const embed2 = new Discord.MessageEmbed() const embed2 = new Discord.MessageEmbed()
@@ -49,7 +49,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if (!user) return message.channel.send({ if (!user) return message.channel.send({
embed: embed2 embeds: [embed2]
}) })
const embed3 = new Discord.MessageEmbed() const embed3 = new Discord.MessageEmbed()
@@ -57,7 +57,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if(!user.bannable) return message.channel.send({ if(!user.bannable) return message.channel.send({
embed: embed3 embeds: [embed3]
}); });
const embed4 = new Discord.MessageEmbed() const embed4 = new Discord.MessageEmbed()
@@ -65,7 +65,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if(user.id === message.author.id) return message.channel.send({ if(user.id === message.author.id) return message.channel.send({
embed: embed4 embeds: [embed4]
}); });
let reason = args.slice(1).join(" "); let reason = args.slice(1).join(" ");
@@ -77,7 +77,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
user.ban({ days: supportbot.DaysBannedFor, reason: `${reason}` }).catch(err => { user.ban({ days: supportbot.DaysBannedFor, reason: `${reason}` }).catch(err => {
message.channel.send({ embed: embed5 }) message.channel.send({ embeds: [embed5] })
console.log(err) console.log(err)
}) })
@@ -99,7 +99,7 @@ module.exports = {
.setColor(supportbot.BanLogColour) .setColor(supportbot.BanLogColour)
.setTimestamp() .setTimestamp()
locateChannel.send({ embed: logEmbed }) locateChannel.send({ embeds: [logEmbed] })
+8 -8
View File
@@ -23,7 +23,7 @@ module.exports = {
.setColor(supportbot.WarningColour) .setColor(supportbot.WarningColour)
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({ embeds: [NoPerms] });
} }
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel) let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
@@ -35,14 +35,14 @@ module.exports = {
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``) .setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
.setColor(supportbot.ErrorColour); .setColor(supportbot.ErrorColour);
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
const embed1 = new Discord.MessageEmbed() const embed1 = new Discord.MessageEmbed()
.setDescription("> :x: Please mention or write an ID\n\n`Try Again!`") .setDescription("> :x: Please mention or write an ID\n\n`Try Again!`")
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
if (!args[0]) return message.channel.send({ if (!args[0]) return message.channel.send({
embed: embed1 embeds: [embed1]
}); });
const embed2 = new Discord.MessageEmbed() const embed2 = new Discord.MessageEmbed()
@@ -50,7 +50,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if (!user) return message.channel.send({ if (!user) return message.channel.send({
embed: embed2 embeds: [embed2]
}); });
let role = message.guild.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || message.guild.roles.cache.find(role => role.id === supportbot.TicketBlackListRole) let role = message.guild.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || message.guild.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)
@@ -61,7 +61,7 @@ module.exports = {
if (!role) return message.channel.send({ if (!role) return message.channel.send({
embed: embed3 embeds: [embed3]
}); });
const embed4 = new Discord.MessageEmbed() const embed4 = new Discord.MessageEmbed()
@@ -70,7 +70,7 @@ module.exports = {
if(user.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || user.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 embeds: [embed4]
}) })
}; };
@@ -81,7 +81,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ message.channel.send({
embed: embed5 embeds: [embed5]
}); });
const logEmbed = new Discord.MessageEmbed() const logEmbed = new Discord.MessageEmbed()
@@ -93,7 +93,7 @@ module.exports = {
.setColor(supportbot.BlacklistColour) .setColor(supportbot.BlacklistColour)
.setTimestamp() .setTimestamp()
locateChannel.send({ embed: logEmbed }); locateChannel.send({ embeds: [logEmbed] });
} }
+3 -3
View File
@@ -23,13 +23,13 @@ module.exports = {
.setColor(supportbot.WarningColour) .setColor(supportbot.WarningColour)
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({ embeds: [NoPerms] });
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setDescription(`> **What would you like me to say!**`) .setDescription(`> **What would you like me to say!**`)
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
let announcement = [] let announcement = []
message.channel.awaitMessages(response => response.content.length > 2, { message.channel.awaitMessages(response => response.content.length > 2, {
@@ -43,7 +43,7 @@ module.exports = {
.setDescription(announcement) .setDescription(announcement)
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ embed: AnnouncementEmbed }) message.channel.send({ embeds: [AnnouncementEmbed] })
}) })
} }
+25 -9
View File
@@ -73,13 +73,22 @@ module.exports = {
} }
}); });
logChannel.send(logEmbed).catch(err => { logChannel.send({embeds: [logEmbed]}).catch(err => {
message.reply(err) message.reply(err)
}) })
logChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) );
message.channel.delete(); let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
logChannel.send({embeds: [logEmbed], files: [file]}).catch(err => {
message.reply(err)
})
message.channel.delete().catch(error => {
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
console.error('Failed to delete the message:', error);
}
});
}) })
}) })
@@ -87,7 +96,7 @@ module.exports = {
}) })
}).catch( () => { }).catch( () => {
m.edit('The request to close the ticket has timed out.').then( m2 => m2.delete( 3000 ) ); interaction.m.edit({content: 'The request to close the ticket has timed out.'}).then(m2 => setTimeout(() => channel.delete(3000)) );
}); });
} }
@@ -127,21 +136,28 @@ module.exports = {
} }
}); });
logChannel.send(logEmbed).catch(err => { logChannel.send({embeds: [logEmbed]}).catch(err => {
message.reply(err) message.reply(err)
}) })
logChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) ); let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
logChannel.send({embeds: [logEmbed], files: [file]}).catch(err => {
message.reply(err)
})
message.channel.delete(); message.channel.delete().catch(error => {
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
console.error('Failed to delete the message:', error);
}
});
}) })
}).catch( () => { }).catch( () => {
m.edit('The request to close the ticket has timed out.').then( m2 => m2.delete( 3000 ) ); interaction.m.edit({content: 'The request to close the ticket has timed out.'}).then(m2 => setTimeout(() => channel.delete(3000)) );
}); });
} }
} }
}; };
+3 -2
View File
@@ -11,6 +11,7 @@ module.exports = {
name: supportbot.HelpCommand, name: supportbot.HelpCommand,
description: supportbot.HelpDesc, description: supportbot.HelpDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages) message.delete(); if (supportbot.DeleteMessages) message.delete();
@@ -67,13 +68,13 @@ module.exports = {
if (supportbot.SendHelpPage === "dm") { if (supportbot.SendHelpPage === "dm") {
message.author.send({ message.author.send({
embed: HelpEmbed1 embeds: [HelpEmbed1]
}); });
} }
if (supportbot.SendHelpPage === "channel") { if (supportbot.SendHelpPage === "channel") {
message.channel.send({ message.channel.send({
embed: HelpEmbed1 embeds: [HelpEmbed1]
}); });
} }
+9 -9
View File
@@ -23,7 +23,7 @@ module.exports = {
.setColor(supportbot.WarningColour) .setColor(supportbot.WarningColour)
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({ embeds: [NoPerms] });
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel) let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
@@ -32,7 +32,7 @@ module.exports = {
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``) .setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
.setColor(supportbot.ErrorColour); .setColor(supportbot.ErrorColour);
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
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]);
@@ -41,7 +41,7 @@ module.exports = {
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
if (!args[0]) return message.channel.send({ if (!args[0]) return message.channel.send({
embed: embed1 embeds: [embed1]
}); });
const embed2 = new Discord.MessageEmbed() const embed2 = new Discord.MessageEmbed()
@@ -49,7 +49,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if (!user) return message.channel.send({ if (!user) return message.channel.send({
embed: embed2 embeds: [embed2]
}) })
const embed3 = new Discord.MessageEmbed() const embed3 = new Discord.MessageEmbed()
@@ -57,7 +57,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if(!user.kickable) return message.channel.send({ if(!user.kickable) return message.channel.send({
embed: embed3 embeds: [embed3]
}); });
const embed4 = new Discord.MessageEmbed() const embed4 = new Discord.MessageEmbed()
@@ -65,7 +65,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
if(user.id === message.author.id) return message.channel.send({ if(user.id === message.author.id) return message.channel.send({
embed: embed4 embeds: [embed4]
}); });
let reason = args.slice(1).join(" "); let reason = args.slice(1).join(" ");
@@ -77,7 +77,7 @@ module.exports = {
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
user.kick({ reason: `${reason}` }).catch(err => { user.kick({ reason: `${reason}` }).catch(err => {
message.channel.send({ embed: embed5 }) message.channel.send({ embeds: [embed5] })
console.log(err) console.log(err)
}) })
@@ -87,7 +87,7 @@ module.exports = {
.setColor(supportbot.SuccessColour) .setColor(supportbot.SuccessColour)
message.channel.send({ message.channel.send({
embed: successEmbed embeds: [successEmbed]
}) })
const logEmbed = new Discord.MessageEmbed() const logEmbed = new Discord.MessageEmbed()
@@ -100,7 +100,7 @@ module.exports = {
.setColor(supportbot.KickLogColour) .setColor(supportbot.KickLogColour)
.setTimestamp() .setTimestamp()
locateChannel.send({ embed: logEmbed }) locateChannel.send({ embeds: [logEmbed] })
+1 -1
View File
@@ -28,7 +28,7 @@ module.exports = {
LinksEmbed.addField(supportbot.LinksTitle, links) LinksEmbed.addField(supportbot.LinksTitle, links)
message.channel.send({ embed: LinksEmbed }); message.channel.send({ embeds: [LinksEmbed] });
} }
}; };
+1 -1
View File
@@ -20,6 +20,6 @@ module.exports = {
.setDescription(`🏓 **Pong!** \`${Date.now() - message.createdTimestamp}ms\``) .setDescription(`🏓 **Pong!** \`${Date.now() - message.createdTimestamp}ms\``)
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ embed: PingCommandEmbed }); message.channel.send({ embeds: [PingCommandEmbed] });
} }
}; };
+6 -6
View File
@@ -23,7 +23,7 @@ module.exports = {
.setColor(supportbot.WarningColour) .setColor(supportbot.WarningColour)
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({ embeds: [NoPerms] });
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel) let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
@@ -32,14 +32,14 @@ module.exports = {
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``) .setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
.setColor(supportbot.ErrorColour); .setColor(supportbot.ErrorColour);
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
const embed1 = new Discord.MessageEmbed() const embed1 = new Discord.MessageEmbed()
.setDescription(`> :thinking: **Hmm!** Please enter a valid number of message to purge!\n\n\`${supportbot.Prefix}${supportbot.PurgeMessage} <message count>\` `) .setDescription(`> :thinking: **Hmm!** Please enter a valid number of message to purge!\n\n\`${supportbot.Prefix}${supportbot.PurgeMessage} <message count>\` `)
.setColor(supportbot.WarningColour) .setColor(supportbot.WarningColour)
if (!args[0]) return message.channel.send({ if (!args[0]) return message.channel.send({
embed: embed1 embeds: [embed1]
}); });
const messagePrune = parseInt(args[0]) const messagePrune = parseInt(args[0])
@@ -49,7 +49,7 @@ module.exports = {
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
if (isNaN(messagePrune)) return message.reply({ if (isNaN(messagePrune)) return message.reply({
embed: embed2 embeds: [embed2]
}) })
message.channel.bulkDelete(messagePrune).then(() => { message.channel.bulkDelete(messagePrune).then(() => {
@@ -58,7 +58,7 @@ module.exports = {
.setDescription(`> :recycle: \`${args[0]} messages\` **have been purged!** `) .setDescription(`> :recycle: \`${args[0]} messages\` **have been purged!** `)
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
message.channel.send({ message.channel.send({
embed: embed3 embeds: [embed3]
}) })
}) })
@@ -71,7 +71,7 @@ module.exports = {
.setColor(supportbot.PruneColour) .setColor(supportbot.PruneColour)
.setTimestamp() .setTimestamp()
locateChannel.send({ embed: logEmbed }) locateChannel.send({ embeds: [logEmbed] })
+4 -4
View File
@@ -28,7 +28,7 @@ module.exports = {
.setTitle("No Ticket Found!") .setTitle("No Ticket Found!")
.setDescription(`${supportbot.NoValidTicket}`) .setDescription(`${supportbot.NoValidTicket}`)
.setColor(supportbot.WarningColour); .setColor(supportbot.WarningColour);
message.channel.send({ embed: Exists }); message.channel.send({ embeds: [Exists] });
return; return;
} }
@@ -39,7 +39,7 @@ module.exports = {
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.RemoveUser} <user#0000>\``) .setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.RemoveUser} <user#0000>\``)
.setColor(supportbot.ErrorColour) .setColor(supportbot.ErrorColour)
if (!rUser) return message.channel.send({ embed: UserNotExist }); if (!rUser) return message.channel.send({ embeds: [UserNotExist] });
message.channel.updateOverwrite(rUser, { message.channel.updateOverwrite(rUser, {
VIEW_CHANNEL: false, VIEW_CHANNEL: false,
@@ -53,9 +53,9 @@ module.exports = {
.setDescription(supportbot.RemovedUser.replace(/%user%/g, rUser.id)) .setDescription(supportbot.RemovedUser.replace(/%user%/g, rUser.id))
.setTimestamp() .setTimestamp()
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ embed: Complete }); message.channel.send({ embeds: [Complete] });
} else { } else {
return message.channel.send({ embed: NoPerms }); return message.channel.send({ embeds: [NoPerms] });
} }
} }
+4 -4
View File
@@ -21,12 +21,12 @@ module.exports = {
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.SuggestionChannel}\``) .setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.SuggestionChannel}\``)
.setColor(supportbot.ErrorColour); .setColor(supportbot.ErrorColour);
if(!locateChannel) return message.channel.send({ embed: errornochannel }); if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setDescription(`> **${supportbot.SuggestionStarter}**`) .setDescription(`> **${supportbot.SuggestionStarter}**`)
.setColor(supportbot.EmbedColour) .setColor(supportbot.EmbedColour)
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
let suggestion = [] let suggestion = []
message.channel.awaitMessages(response => response.content.length > 2, { message.channel.awaitMessages(response => response.content.length > 2, {
@@ -55,14 +55,14 @@ module.exports = {
SuggestionMessage.setThumbnail(supportbot.SuggestionIcon_URL) SuggestionMessage.setThumbnail(supportbot.SuggestionIcon_URL)
} }
locateChannel.send({ embed: SuggestionMessage }).then(async function(msg) { locateChannel.send({ embeds: [SuggestionMessage] }).then(async function(msg) {
msg.react(supportbot.SuggestReact_1).then(() => msg.react(supportbot.SuggestReact_2)); msg.react(supportbot.SuggestReact_1).then(() => msg.react(supportbot.SuggestReact_2));
}); });
const SuggestionComplete = new Discord.MessageEmbed() const SuggestionComplete = new Discord.MessageEmbed()
.setColor(supportbot.SuccessColour) .setColor(supportbot.SuccessColour)
.setDescription(`:white_check_mark: Your suggestion has been successfully created. <#${locateChannel.id}>`) .setDescription(`:white_check_mark: Your suggestion has been successfully created. <#${locateChannel.id}>`)
message.channel.send({ embed: SuggestionComplete }) message.channel.send({ embeds: [SuggestionComplete] })
}); });
+242 -230
View File
@@ -1,230 +1,242 @@
// SupportBot, Created by Emerald Services // SupportBot, Created by Emerald Services
// Ticket Command // Ticket Command
const Discord = require("discord.js"); const Discord = require("discord.js");
const bot = new Discord.Client() const { MessageButton, MessageActionRow, Permissions } = require("discord.js");
const fs = require("fs") const fs = require("fs")
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
const TicketNumberID = require('../utils/TicketNumber.js'); const TicketNumberID = require('../utils/TicketNumber.js');
module.exports = { async function asyncForEach(array, callback) {
name: supportbot.NewTicket, for (let index = 0; index < array.length; index++) {
description: supportbot.NewTicketDesc, await callback(array[index], index, array);
}
async execute(message, args) { }
if (!message.channel.name === supportbot.ReactionChannel || !message.channel.id === supportbot.ReactionChannel) { module.exports = {
if (supportbot.DeleteMessages) message.delete(); name: supportbot.NewTicket,
} description: supportbot.NewTicketDesc,
let reactionUser = message.guild.members.cache.get(message.author.id) async execute(message, args) {
if (message.channel.name !== supportbot.ReactionChannel) {
if (reactionUser.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || reactionUser.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) { if (supportbot.DeleteMessages) message.delete();
return message.channel.send(`<@${message.author.id}> ${supportbot.TicketBlackListMessage}`).then(msg => { }
msg.delete({timeout: 3500})
}) let reactionUser = message.guild.members.cache.get(message.author.id)
}
if (reactionUser.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || reactionUser.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) {
// Ticket ID return message.channel.send({content:`<@${message.author.id}> ${supportbot.TicketBlackListMessage}`}).then(msg => {
let ticketNumberID = TicketNumberID.pad(message.guild.id); setTimeout(() => msg.delete(), 3500)
})
// Ticket Subject }
const TicketSubject = args || supportbot.NoTicketSubject;
// Ticket ID
const channel = await message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`); let ticketNumberID = TicketNumberID.pad(message.guild.id);
if (message.channel.name === supportbot.ReactionChannel || message.channel.id === supportbot.ReactionChannel) { // Ticket Subject
const CreatedTicket = new Discord.MessageEmbed() const TicketSubject = args || supportbot.NoTicketSubject;
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username))
.setColor(supportbot.EmbedColour) const TicketExists = new Discord.MessageEmbed()
message.channel.send({embed: CreatedTicket}).then((r) => { .setTitle("Ticket Exists!")
r.delete({ timeout:5000 }) .setDescription(`${supportbot.TicketExists}`)
}) .setColor(supportbot.WarningColour)
} else {
const CreatedTicket = new Discord.MessageEmbed() if (message.guild.channels.cache.find(ticketChannel => ticketChannel.name === `${supportbot.TicketChannel}-${ticketNumberID}`)) {
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username)) return message.channel.send({ embeds: [TicketExists] });
.setColor(supportbot.EmbedColour) }
message.channel.send({embed: CreatedTicket}); const Staff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
} const Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
const DeptRole1 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_1}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_1}`)
// Ticket Category const DeptRole2 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_2}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_2}`)
let TicketCategory = message.guild.channels.cache.find(category => category.name === supportbot.TicketCategory) || message.guild.channels.cache.find(category => category.id === supportbot.TicketCategory) const DeptRole3 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_3}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_3}`)
const Author = message.author
// Locate Roles const Everyone = message.guild.id
let StaffMember = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff) const ticketChannel = await message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`, {
let ServerAdmins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin) type: "GUILD_TEXT",
})
if (TicketCategory) {
channel.setParent(TicketCategory.id) 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, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
channel.updateOverwrite(message.guild.id, { .setColor(supportbot.EmbedColour)
SEND_MESSAGES: false, message.channel.send({embeds: [CreatedTicket]}).then(msg => {
VIEW_CHANNEL: false setTimeout(() => msg.delete(), 5000)
}) })
} else {
channel.updateOverwrite(message.author, { const CreatedTicket = new Discord.MessageEmbed()
SEND_MESSAGES: true, .setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
VIEW_CHANNEL: true .setColor(supportbot.EmbedColour)
}) message.channel.send({embeds: [CreatedTicket]}).then(msg => setTimeout(() => msg.delete(), 5000));
}
channel.updateOverwrite(StaffMember, { let AllowArr = [Staff, Staff, Admins, Author]
SEND_MESSAGES: true, await asyncForEach(AllowArr, (index) => {
VIEW_CHANNEL: true ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: true})
}) })
channel.updateOverwrite(ServerAdmins, { let DenyArr = [Everyone]
SEND_MESSAGES: true, await asyncForEach(DenyArr, (index) => {
VIEW_CHANNEL: true ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: false})
}) })
// Ticket Created, Message Sent 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 (supportbot.AllowTicketMentions) { ticketChannel.setParent(TicketCategory.id)
channel.send(`<@${message.author.id}>`) }
}
if (supportbot.AllowTicketMentions) {
const TicketMessage = new Discord.MessageEmbed() ticketChannel.send({content:`${message.author}`})
.setTitle(supportbot.Ticket_Title.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username)) }
.setDescription(supportbot.TicketMessage.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username))
.setColor(supportbot.EmbedColour) const TicketMessage = new Discord.MessageEmbed()
.setTitle(supportbot.Ticket_Title.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
if (supportbot.TicketSubject === "embed") { .setDescription(supportbot.TicketMessage.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
.setColor(supportbot.EmbedColour)
if (TicketSubject != 'No Reason Provided.') {
TicketMessage.addFields({ name: 'Reason', value: TicketSubject }) if (supportbot.TicketSubject === "embed") {
}
if (TicketSubject != 'No Reason Provided.') {
} TicketMessage.addFields({ name: 'Reason', value: TicketSubject })
}
if (supportbot.TicketSubject === "description") {
}
if (TicketSubject != 'No Reason Provided.') {
channel.setTopic(`Reason: ${TicketSubject} - User ID: ${message.author.id} - Ticket: ${channel.name}`) if (supportbot.TicketSubject === "description") {
}
if (TicketSubject != 'No Reason Provided.') {
} ticketChannel.setTopic(`Reason: ${TicketSubject} - User ID: ${message.author.id} - Ticket: ${ticketChannel.name}`)
}
const reactionMessage = await channel.send({
embed: TicketMessage }
}).then( async function(ticketmsg) {
await ticketmsg.react(supportbot.TicketLockReaction) if (supportbot.TicketDepartments) {
await ticketmsg.react(supportbot.TicketDeleteReaction) TicketMessage.addFields({ name: 'Departments', value: ` **${supportbot.DepartmentTitle_1}**\n **${supportbot.DepartmentTitle_2}**\n **${supportbot.DepartmentTitle_3}**` })
}
const collector = ticketmsg.createReactionCollector( const CloseButton = new MessageButton()
(reaction, user) => message.guild.roles.cache.find((staff) => staff.name === supportbot.Staff), .setCustomId('ticketclose')
{ dispose: true } .setLabel('Close')
); .setStyle(supportbot.TicketCloseColour)
.setEmoji(supportbot.TicketCloseEmoji)
collector.on('collect', (reaction, user) => {
switch (reaction.emoji.name) { const LockButton = new MessageButton()
case supportbot.TicketLockReaction: .setCustomId('ticketlock')
.setLabel('Lock')
channel.updateOverwrite(message.author, { .setStyle(supportbot.TicketLockColour)
SEND_MESSAGES: false, .setEmoji(supportbot.TicketLockEmoji)
VIEW_CHANNEL: true
}); const row2 = new MessageActionRow()
.addComponents(CloseButton, LockButton)
const LockTicketEmbed = new Discord.MessageEmbed()
.setDescription(supportbot.TicketLockMessage) if(supportbot.TicketDepartments) {
.setColor(supportbot.EmbedColour)
channel.send({embed: LockTicketEmbed}) let DenyArr = [DeptRole1, DeptRole2, DeptRole3]
break; await asyncForEach(DenyArr, (index) => {
ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: false})
case supportbot.TicketDeleteReaction: })
const DeleteTicketEmbed = new Discord.MessageEmbed() const Department1Button = new MessageButton()
.setDescription(supportbot.TicketDeleteMessage) .setCustomId('Department1')
.setColor(supportbot.EmbedColour) .setLabel(`${supportbot.DepartmentTitle_1}`)
channel.send({embed: DeleteTicketEmbed}) .setStyle(supportbot.TicketDept1Colour)
.setEmoji(supportbot.TicketDept1Emoji)
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; const Department2Button = new MessageButton()
let reason = args.join(" ") || "No Reason Provided."; .setCustomId('Department2')
.setLabel(`${supportbot.DepartmentTitle_2}`)
let name = message.channel.name; .setStyle(supportbot.TicketDept2Colour)
let ticketChannel = message.channel; .setEmoji(supportbot.TicketDept2Emoji)
message.channel.send(`**${supportbot.ClosingTicket}**`) const Department3Button = new MessageButton()
.setCustomId('Department3')
.then(() => { .setLabel(`${supportbot.DepartmentTitle_3}`)
const logEmbed = new Discord.MessageEmbed() .setStyle(supportbot.TicketDept3Colour)
.setTitle(supportbot.TranscriptTitle) .setEmoji(supportbot.TicketDept3Emoji)
.setColor(supportbot.EmbedColour)
.setFooter(supportbot.EmbedFooter) const row = new MessageActionRow()
.addField("Closed By", message.author.tag) .addComponents(Department1Button, Department2Button, Department3Button)
.addField("Reason", reason);
const m = await ticketChannel.send({embeds: [TicketMessage], components: [row]})
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
let html = ''; const filter = i => {
i.deferUpdate();
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp ); return i.user.id === message.author.id;
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`; };
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`; const collector = m.createMessageComponentCollector({ filter, max: 1, componentType: 'BUTTON', time: 60000 });
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
collector.on('collect',async (i) => {
msgs.forEach( msg => {
if ( msg.content ) { if(i.customId === 'Department1') {
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
html += `<strong>Message:</strong> ${msg.content}<br>`; ticketChannel.permissionOverwrites.edit(DeptRole1, {
html += `-----<br><br>`; VIEW_CHANNEL: true,
} READ_MESSAGE_HISTORY: true,
}); SEND_MESSAGES: true,
})
logChannel.send(logEmbed).catch(err => {
message.reply(err) if(!supportbot.AllowStaff) {
}) ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
}
const TranscriptSavedEmbed = new Discord.MessageEmbed()
.setDescription(supportbot.TranscriptSavedMessage) const Department1 = new Discord.MessageEmbed()
.setColor(supportbot.SuccessColour) .setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_1} Department**. Please provide us information regarding your query.`)
channel.send({embed: TranscriptSavedEmbed}) .setColor(supportbot.EmbedColour)
ticketChannel.send({ embeds: [Department1] });
logChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) );
setTimeout(() => channel.delete(), supportbot.TicketDeleteTime); if (supportbot.AllowTicketMentions) {
ticketChannel.send({content: `@here`})
}) }
}
}).catch( () => { i.message.edit({embeds: [TicketMessage], components: [row2]})
m.edit('The request to close the ticket has timed out.').then( m2 => m2.delete( 3000 ) );
}); if(i.customId === 'Department2') {
break;
ticketChannel.permissionOverwrites.edit(DeptRole2, {
} VIEW_CHANNEL: true,
}); READ_MESSAGE_HISTORY: true,
SEND_MESSAGES: true,
}) })
fs.writeFileSync("./storage/SupportTickets.json", '{\n "ticket": "' + channel.name + '", \n "id":' + message.author.id + "\n}", (err) => { if(!supportbot.AllowStaff) {
if (!err) return; ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
console.error(err) }
})
// Ticket Logs
const Department2 = new Discord.MessageEmbed()
const errornochannel = new Discord.MessageEmbed() .setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_2} Department**. Please provide us information regarding your query.`)
.setTitle("SupportBot Error!") .setColor(supportbot.EmbedColour)
.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\``) ticketChannel.send({ embeds: [Department2] });
.setColor(supportbot.ErrorColour);
if (supportbot.AllowTicketMentions) {
const TicketLogs = new Discord.MessageEmbed() ticketChannel.send({content: `@here`})
.setTitle(supportbot.TicketLog_Title) }
.setThumbnail(supportbot.Ticket_Thumbnail)
.addFields( i.message.edit({embeds: [TicketMessage], components: [row2]})
{ name: 'Ticket', value: `<#${channel.id}>` }, }
{ name: 'User', value: `<@${message.author.id}>` }, if(i.customId === 'Department3') {
)
.setColor(supportbot.EmbedColour) ticketChannel.permissionOverwrites.edit(DeptRole3, {
.setFooter(supportbot.EmbedFooter) VIEW_CHANNEL: true,
READ_MESSAGE_HISTORY: true,
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === supportbot.TicketLog) || message.guild.channels.cache.find(LocateChannel => LocateChannel.id === supportbot.TicketLog) SEND_MESSAGES: true,
})
if(!locateChannel) return message.channel.send({ embed: errornochannel });
if(!supportbot.AllowStaff) {
locateChannel.send({ embed: TicketLogs }); ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
}
} const Department3 = new Discord.MessageEmbed()
.setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_3} Department**. Please provide us information regarding your query.`)
} .setColor(supportbot.EmbedColour)
ticketChannel.send({ embeds: [Department3] });
if (supportbot.AllowTicketMentions) {
ticketChannel.send({content: `@here`})
}
i.message.edit({embeds: [TicketMessage], components: [row2]})
}
})
} else {
ticketChannel.send({embeds: [TicketMessage], components: [row2]})
}
}
}
+8 -14
View File
@@ -1,20 +1,16 @@
// SupportBot, Created by Emerald Services // SupportBot, Created by Emerald Services
// Announce // Announce
const Discord = require("discord.js"); const Discord = require("discord.js");
const fs = require("fs"); const fs = require("fs");
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const { execute } = require("./help"); const { execute } = require("./help");
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
module.exports = { module.exports = {
name: supportbot.ChatLog, name: supportbot.ChatLog,
description: supportbot.ChatLogDesc, description: supportbot.ChatLogDesc,
execute(message, args) { execute(message, args) {
if (supportbot.DeleteMessages) message.delete(); if (supportbot.DeleteMessages) message.delete();
let name = message.channel.name; let name = message.channel.name;
message.channel.messages.fetch({ limit: 100 }).then( msgs => { message.channel.messages.fetch({ limit: 100 }).then( msgs => {
@@ -37,11 +33,10 @@ module.exports = {
const TranscriptSavedEmbed = new Discord.MessageEmbed() const TranscriptSavedEmbed = new Discord.MessageEmbed()
.setDescription(supportbot.ChatLogSavedMessage) .setDescription(supportbot.ChatLogSavedMessage)
.setColor(supportbot.SuccessColour) .setColor(supportbot.SuccessColour)
message.channel.send({embed: TranscriptSavedEmbed}) message.channel.send({embeds: [TranscriptSavedEmbed]})
const errornochannel = new Discord.MessageEmbed() const errornochannel = new Discord.MessageEmbed()
.setTitle("SupportBot Error!") .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\``) .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.ChatLogChannel}\`\n\nError Code: \`SB-03\``)
.setColor(supportbot.ErrorColour); .setColor(supportbot.ErrorColour);
const ChatLogs = new Discord.MessageEmbed() const ChatLogs = new Discord.MessageEmbed()
@@ -53,14 +48,13 @@ 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.ChatLogChannel) || message.guild.channels.cache.find(LocateChannel => LocateChannel.id === supportbot.ChatLogChannel) 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 }); if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
locateChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) ); let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
locateChannel.send({ embed: ChatLogs }); locateChannel.send({embeds: [ChatLogs], files: [file]})
}) })
} }
} }
+128
View File
@@ -0,0 +1,128 @@
// SupportBot Interaction Event
// SupportBot Created by Emerald Services
const fs = require("fs");
const { MessageEmbed, MessageAttachment, Permissions, MessageButton, MessageActionRow } = require("discord.js");
const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
module.exports = async (bot, interaction, args) => {
if (interaction.isCommand()) return;
if(interaction.isButton()) {
if(interaction.customId === 'openticket') {
interaction.message.fetch()
interaction.deferUpdate()
let message = {
guild: bot.guilds.cache.get(interaction.message.guildId),
author: bot.users.cache.get(interaction.user.id),
content: "N/A",
channel: bot.channels.cache.get(interaction.message.channelId)
}
try {
const cmd = bot.commands.get(supportbot.NewTicket);
if(!cmd) return;
cmd.execute(message, message.content)
}
catch (error){
console.error(error)
}
}
if(interaction.customId === 'ticketclose') {
if(interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
interaction.message.fetch()
interaction.deferUpdate()
const DeleteTicketEmbed = new MessageEmbed()
.setDescription(supportbot.TicketDeleteMessage)
.setColor(supportbot.EmbedColour)
interaction.channel.send({embeds: [DeleteTicketEmbed]})
let logChannel = interaction.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || interaction.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
let user = interaction.user
let name = interaction.channel.name;
let ticketChannel = interaction.channel
let reason = "No Reason Provided."
interaction.channel.send({content: `**${supportbot.ClosingTicket}**`})
.then(() => {
const logEmbed = new MessageEmbed()
.setTitle(supportbot.TranscriptTitle)
.setColor(supportbot.EmbedColour)
.setFooter(supportbot.EmbedFooter)
.addField("Closed By", user.username)
.addField("Reason", reason)
interaction.channel.messages.fetch({limit: 100}).then(msgs => {
let html = ''
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`
msgs.forEach(msg => {
if(msg.content) {
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
html += `<strong>Message:</strong> ${msg.content}<br>`;
html += `-----<br><br>`;
}
})
const TranscriptSavedEmbed = new MessageEmbed()
.setDescription(supportbot.TranscriptSavedMessage)
.setColor(supportbot.SuccessColour)
interaction.channel.send({embeds: [TranscriptSavedEmbed]})
let file = new MessageAttachment( Buffer.from( html ), `${name}.html` )
logChannel.send({embeds: [logEmbed], files: [file]})
setTimeout(() => interaction.channel.delete(), supportbot.TicketDeleteTime)
})
})
}
}
if(interaction.customId === 'ticketlock') {
if(interaction.channel.name.startsWith(`${supportbot.TicketChannel}`)) {
interaction.message.fetch()
interaction.deferUpdate()
let Admin = interaction.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || interaction.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
let all = interaction.channel.permissionOverwrites.cache
let parent = interaction.guild.channels.cache.find(c => c.name === `${supportbot.LockTicketCategory}`) || interaction.guild.channels.cache.find(c => c.id === `${supportbot.LockTicketCategory}`)
if(parent) {
interaction.channel.setParent(parent.id)
}
all.forEach(perm => {
interaction.channel.permissionOverwrites.delete(perm.id)
})
interaction.channel.permissionOverwrites.create(Admin.id, {VIEW_CHANNEL: true})
interaction.channel.permissionOverwrites.create(interaction.guild.id, {VIEW_CHANNEL: false})
const ticketDeleteButton = new MessageButton()
.setCustomId('ticketclose')
.setLabel('Close')
.setStyle(supportbot.TicketDeleteColour)
.setEmoji(supportbot.TicketDeleteEmoji)
const row = new MessageActionRow()
.addComponents(ticketDeleteButton)
const ArchiveEmbed = new MessageEmbed()
.setTitle("Archived")
.setDescription(`Archived ${interaction.channel.name}`)
.setColor(`${supportbot.SuccessColour}`)
interaction.channel.send({embeds: [ArchiveEmbed]})
interaction.message.edit({components: [row]})
}
}
}
}
File renamed without changes.
+26 -18
View File
@@ -3,17 +3,17 @@
const Discord = require("discord.js"); const Discord = require("discord.js");
const fs = require("fs"); const fs = require("fs");
const { MessageActionRow, MessageButton } = require('discord.js');
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8')); const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
module.exports = async (bot) => { module.exports = async bot => {
bot.user.setActivity(supportbot.BotActivity, { bot.user.setActivity(supportbot.BotActivity, {
type: supportbot.ActivityType, type: supportbot.ActivityType,
url: supportbot.StreamingURL url: supportbot.StreamingURL
}); });
console.log(`\u001b[32m`, `┏━━━┓╋╋╋╋╋╋╋╋╋╋╋╋╋┏┓┏━━┓╋╋╋┏┓`) console.log(`\u001b[32m`, `┏━━━┓╋╋╋╋╋╋╋╋╋╋╋╋╋┏┓┏━━┓╋╋╋┏┓`)
@@ -24,21 +24,21 @@ module.exports = async (bot) => {
console.log(`\u001b[32m`, `┗━━━┻━━┫┏━┫┏━┻━━┻┛┗━┻━━━┻━━┻━┛`) console.log(`\u001b[32m`, `┗━━━┻━━┫┏━┫┏━┻━━┻┛┗━┻━━━┻━━┻━┛`)
console.log(`\u001b[32m`, `┗╋╋╋╋╋╋╋┃┃╋┃┃`) console.log(`\u001b[32m`, `┗╋╋╋╋╋╋╋┃┃╋┃┃`)
console.log(`\u001b[32m`, `╋╋╋╋╋╋╋┗┛╋┗┛`) console.log(`\u001b[32m`, `╋╋╋╋╋╋╋┗┛╋┗┛`)
console.log(` `) console.log(` `)
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`) console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
console.log(` `) console.log(` `)
console.log(`\u001b[33m`, `${supportbot.Bot_Name} v${supportbot.SupportBot_Version}`, `\u001b[36m`, `Connected to Discord`) console.log(`\u001b[33m`, `${supportbot.Bot_Name} v${supportbot.SupportBot_Version}`, `\u001b[36m`, `Connected to Discord`)
console.log(`\u001b[33m`, `Documentation:`, `\u001b[36m`, `https://docs.emeraldsrv.dev`) console.log(`\u001b[33m`, `Documentation:`, `\u001b[36m`, `https://supportbot.emeraldsrv.dev`)
console.log(`\u001b[33m`, `Discord:`, `\u001b[36m`, `https://emeraldsrv.dev/discord`) console.log(`\u001b[33m`, `Discord:`, `\u001b[36m`, `https://emeraldsrv.dev/discord`)
console.log(`\u001b[33m`, `Hosting:`, `\u001b[36m`, `https://emeraldsrv.dev/hosting`) console.log(`\u001b[33m`, `Hosting:`, `\u001b[36m`, `https://emeraldsrv.dev/hosting`)
console.log(` `) console.log(` `)
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`) console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`)
console.log(` `) console.log(` `)
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`) console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
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)
if (!chan1) { if (!chan1) {
@@ -46,26 +46,36 @@ module.exports = async (bot) => {
return false; return false;
} }
chan1.messages.fetch(tickets.ReactionMessage_ID).catch(r => { chan1.messages.fetch(tickets.ReactionMessage_ID).catch(async r => {
let embed = new Discord.MessageEmbed() let embed = new Discord.MessageEmbed()
.setTitle(supportbot.ReactionMessage.replace(/%reaction_emoji%/g, supportbot.ReactionEmoji)) .setTitle(supportbot.ReactionMessage.replace(/%reaction_emoji%/g, supportbot.ReactionEmoji))
.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)
} }
let button = new MessageButton()
.setLabel('Open Ticket')
.setCustomId('openticket')
.setStyle('PRIMARY')
let row = new MessageActionRow()
.addComponents(button)
bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel).send({ await chan1.send({
embed: embed embeds: [embed],
components: [row]
}).then(r => { }).then(r => {
let data = { let data = {
"ReactionMessage_ID": `${r.id}` "ReactionMessage_ID": `${r.id}`
@@ -73,12 +83,10 @@ module.exports = async (bot) => {
let yamlStr = yaml.dump(data); let yamlStr = yaml.dump(data);
fs.writeFileSync('./storage/ticketreaction.yml', yamlStr, 'utf8'); fs.writeFileSync('./storage/ticketreaction.yml', yamlStr, 'utf8');
r.react(supportbot.ReactionEmoji);
}).catch(e => { }).catch(e => {
console.log(e) console.log("Raw"+e)
}) })
}) })
} }
}; };
+13 -6
View File
@@ -9,11 +9,18 @@
// //
// Discord Support: https://emeraldsrv.dev/discord // Discord Support: https://emeraldsrv.dev/discord
const Discord = require("discord.js"); // const Discord = require("discord.js");
const fs = require("fs"); const { Client, Intents, Collection } = require("discord.js");
const bot = new Discord.Client();
bot.commands = new Discord.Collection(); const fs = require("fs");
const bot = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
});
const { REST } = require('@discordjs/rest');
bot.commands = new Collection();
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8')); const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
@@ -50,7 +57,7 @@ const init = async () => {
init(); init();
fs.readdir("./commands/", (err, files) => { fs.readdir("./commands/", async (err, files) => {
console.info(`\u001b[36m`, `➢ SupportBot Commands`); console.info(`\u001b[36m`, `➢ SupportBot Commands`);
console.info(` `); console.info(` `);
@@ -70,7 +77,7 @@ fs.readdir("./commands/", (err, files) => {
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Command Loaded: ${props.name.toProperCase()}`); console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Command Loaded: ${props.name.toProperCase()}`);
bot.commands.set(props.name, props); bot.commands.set(props.name, props);
}); });
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Loaded ${jsfiles.length} commands!`); console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Loaded ${jsfiles.length} commands!`);
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`) console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
console.log(` `) console.log(` `)
+3 -1
View File
@@ -12,7 +12,9 @@
"author": "Emerald Services", "author": "Emerald Services",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"discord.js": "^12.5.3", "@discordjs/rest": "^0.1.0-canary.0",
"discord-api-types": "^0.23.1",
"discord.js": "^13.1.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"jsdom": "^16.7.0" "jsdom": "^16.7.0"
} }
+8 -1
View File
@@ -1 +1,8 @@
{} {
"854057237495676938": {
"id": 21
},
"597779408295821323": {
"id": 1
}
}
+57 -14
View File
@@ -9,14 +9,14 @@
# #
# Discord Support: https://emeraldsrv.dev/discord # Discord Support: https://emeraldsrv.dev/discord
SupportBot_Version: "7.1" SupportBot_Version: "7.2"
# ------------------------- # -------------------------
# General Configuration # General Configuration
# ------------------------- # -------------------------
Token: "BOT_TOKEN_HERE" Token: "BOT_TOKEN"
Prefix: "!" Prefix: "-"
Bot_Name: "SupportBot" Bot_Name: "SupportBot"
DeleteMessages: true DeleteMessages: true
@@ -26,7 +26,7 @@ DeleteMessages: true
# Activity Configuration # Activity Configuration
# ------------------------- # -------------------------
BotActivity: "-help | SupportBot" BotActivity: "Need Help? -ticket"
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME" StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
# Set The ActivityType to "STREAMING" for a streaming status! # Set The ActivityType to "STREAMING" for a streaming status!
@@ -39,7 +39,7 @@ ActivityType: "PLAYING"
# ------------------------- # -------------------------
EmbedColour: "#f74343" EmbedColour: "#f74343"
EmbedFooter: "SupportBot | The #1 Supportive Discord Bot" EmbedFooter: "SupportBot | An Advanced Ticket System"
ErrorColour: "#d12519" ErrorColour: "#d12519"
SuccessColour: "#04b545" SuccessColour: "#04b545"
@@ -60,18 +60,14 @@ AutoRole: true
AutoRole_Role: "Member" AutoRole_Role: "Member"
LockdownRole: "@everyone" LockdownRole: "@everyone"
Staff: "Staff" Staff: "Server Staff"
Admin: "Admin" Admin: "Server Admin"
TicketBlackListRole: "Blacklisted" TicketBlackListRole: "Blacklisted"
# ------------------------- # -------------------------
# Tickets Configuration # Tickets Configuration
# ------------------------- # -------------------------
# --- General Config --- TicketCategory: "Support Tickets"
# --- Start ---
TicketCategory: "▬▬ TICKETS ▬▬"
TicketChannel: "ticket" TicketChannel: "ticket"
TicketLog: "ticket-logs" TicketLog: "ticket-logs"
@@ -129,20 +125,67 @@ AddedUser: "👍 <@%user%> has been added to this ticket"
RemovedUser: "👍 <@%user%> has been removed from this ticket" RemovedUser: "👍 <@%user%> has been removed from this ticket"
# --- Buttons Config ---
# --- Start ---
# Discord Button Colour Selection
# PRIMARY - Blurple
# DANGER - Red
# SUCCESS - Green
# Secondary - Grey
TicketLockReaction: "🔒" TicketLockReaction: "🔒"
TicketDeleteReaction: "⛔" TicketDeleteReaction: "⛔"
LockTicketCategory: "Archive"
TicketCloseEmoji: "❌"
TicketDeleteEmoji: "⛔"
TicketLockEmoji: "🔒"
TicketCloseColour: "DANGER"
TicketDeleteColour: "DANGER"
TicketLockColour: "PRIMARY"
TicketDept1Colour: "PRIMARY"
TicketDept2Colour: "PRIMARY"
TicketDept3Colour: "PRIMARY"
TicketDept1Emoji: "1️⃣"
TicketDept2Emoji: "2️⃣"
TicketDept3Emoji: "3️⃣"
TranscriptSavedMessage: "📝 **Transcript Saved!**" TranscriptSavedMessage: "📝 **Transcript Saved!**"
TicketLockMessage: "❌ **Ticket Locked!**" TicketLockMessage: "❌ **Ticket Locked!**"
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default. TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
TicketDeleteTime: 5000 # Time must be set in miliseconds. TicketDeleteTime: 5000 # Time must be set in miliseconds.
# --- Departments Config ---
# --- Start ---
TicketDepartments: true
AllowStaff: true
# If set to false users with the "Staff" role will not be able to view tickets
# without a valid department role set below.
# Set to false to allow "Staff" to see tickets whether its a department for them or not.
DepartmentTitle_1: "Support"
DepartmentTitle_2: "Billing"
DepartmentTitle_3: "Marketing"
# Ticket department title, This is the title for a ticket department to help users know what is available.
DepartmentRole_1: "Support Team"
DepartmentRole_2: "Billing Team"
DepartmentRole_3: "Marketing Team"
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been choosen.
# --- Closing Config --- # --- Closing Config ---
# --- Start --- # --- Start ---
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: false
# -------------------------------- # --------------------------------
# System Messages Configuration # System Messages Configuration
@@ -297,4 +340,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!"