Compare commits

...
23 Commits
Author SHA1 Message Date
ItzEmerald d416c2e421 Update README.md 2019-11-18 16:12:28 +00:00
ItzEmerald 6bc2e669e4 Update README.md 2019-11-18 16:12:13 +00:00
ItzEmerald 9accb65256 Update README.md 2019-11-18 16:11:23 +00:00
ItzEmerald d9212584ca Update README.md 2019-11-18 16:10:19 +00:00
ItzEmerald 1a7effb422 Update README.md 2019-11-18 16:09:37 +00:00
ItzEmerald 1480435f15 Update index.js 2019-11-18 15:53:02 +00:00
ItzEmerald 64c6a97657 Update index.js 2019-11-18 15:49:36 +00:00
ItzEmerald 7ae2ff9837 Update settings.json 2019-11-18 15:49:21 +00:00
ItzEmerald f19dec405d Updated settings.json 2019-11-18 15:29:33 +00:00
ItzEmerald bbd4e9d162 Update ticket.js 2019-11-17 22:24:05 +00:00
ItzEmerald 58deff0869 Updated close.js
Added ticket transcripts
2019-11-17 21:27:13 +00:00
ItzEmerald 628632f43e Update forceclose.js 2019-11-15 21:54:32 +00:00
ItzEmerald 436586117c Update close.js 2019-11-15 21:53:39 +00:00
ItzEmerald 7234ec728c Update close.js 2019-11-15 20:43:29 +00:00
ItzEmerald fc4d68be39 Update forceclose.js 2019-11-15 20:31:58 +00:00
ItzEmerald bcf2df4bff Update close.js 2019-11-15 20:27:10 +00:00
ItzEmerald 70a469a951 Update settings.json
Added settings for transcripts
2019-11-15 20:25:43 +00:00
ItzEmerald 981995cb32 Merge pull request #7 from iJosGCS/patch-1
Update close.js
2019-11-15 20:00:14 +00:00
Joseph Gonzalo 406c7d368b Update close.js 2019-11-15 13:58:24 -06:00
ItzEmerald 5c266d8b8d Update README.md 2019-11-01 20:27:24 +00:00
Joseph Gonzalo 4f5b94a491 Update README.md 2019-10-17 17:08:13 -06:00
ItzEmerald 284c83cc1d Update help.js 2019-09-28 17:30:57 +01:00
RedstoneGamez 23f06af202 Update README.md 2019-09-07 14:59:59 -03:00
7 changed files with 169 additions and 107 deletions

No files matched your search

+5 -14
View File
@@ -1,10 +1,7 @@
<h1 align="center">SupportBot v4.0.1</h1>
<h4 align="center">A Self Hosted discord application</h4>
<h1 align="center">SupportBot v5</h1>
<h4 align="center">#1 Discord Support System</h4>
<p align="center">
<a href="https://discord.gg/hmWgxdF">
<img src="https://discordapp.com/api/guilds/516345301985132552/widget.png?style=shield" alt="Discord Server">
</a>
<img src="https://img.shields.io/badge/Made%20with-NodeJS-blue.svg" alt="Made with NodeJS">
<img src="https://img.shields.io/github/release/EmeraldRusher/SupportBot.svg" alt="GitHub release">
<img src="https://img.shields.io/github/package-json/dependency-version/EmeraldRusher/SupportBot/discord.js.svg" alt="GitHub package.json dependency version (prod)">
@@ -18,7 +15,7 @@ SupportBot is a free & open source discord bot for your server that has the capa
| 2.x | 🚫 | Discontinued |
| 3.x | ✔️ | Supported |
| 4.x | ✔️ | Supported |
| Premium | ❌ | Not released yet |
| 5.x | ✔️ | Supported |
# Getting Started
Firstly you will need to download the resource, Once you have downloaded the resource open a new tab in your browser and go to https://discordapp.com/developers/applications/. Create a new application and then open your app and select bot and then create your bot. Copy the bot token and paste it where it says ``"token": "BOT TOKEN HERE",`` in the ``settings.json`` file.
@@ -112,16 +109,10 @@ Once you have setup your discord application such as invited the bot and added y
```
# Contributors List
<p>
<a href="https://github.com/iJosGCS">
<img src="https://cdn.discordapp.com/avatars/199237487648833556/cdd7d976b75698b19e3c6b64e1dcdceb.png?size=32" alt="iJosGCS Profile">
<strong>@iJosGCS</strong>
</a>
</p>
<p>
<a href="https://github.com/RedstoneGamez">
<img src="https://cdn.discordapp.com/avatars/282610987801247744/9567e0674a5a6d371bb5d6efb956d57b.png?size=32" alt="RedstoneGamez Profile">
<strong>@RedstoneGamez</strong>
<strong>RedstoneGamez</strong>
</a>
</p>
@@ -129,7 +120,7 @@ Once you have setup your discord application such as invited the bot and added y
# Community
<p align="center">
<a href="https://discord.gg/hmWgxdF">
<a href="https://discord.gg/tNt95Ba">
<img src="https://discordapp.com/api/guilds/516345301985132552/widget.png?style=banner1" alt="Discord Server">
</a>
</p>
+104 -37
View File
@@ -1,58 +1,125 @@
// SupportBot
// Command: Close Ticket
const Discord = require("discord.js");
const Discord = require( "discord.js" );
const bot = new Discord.Client()
bot.settings = require("../settings.json");
bot.settings = require( "../settings.json" );
exports.run = (bot, message, args) => {
/**
* @param {Discord.Message} message
*/
exports.run = ( bot, message, args ) => {
message.delete();
const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
const close1 = new Discord.RichEmbed()
.setDescription(`Looks like you have come to the end of your support ticket\nPlease confirm that you want to close your ticket by saying ||**confirm**||`)
.setFooter("Your request will be avoided in 20 seconds")
.setColor(bot.settings.colour)
message.channel.send({embed: close1}).then(m => {
message.channel.awaitMessages(response => response.content === `confirm`, {
max: 1,
time: 10000,
errors: ['time'],
}).then((collected) => {
message.channel.delete();
if ( !message.channel.name.startsWith( `ticket-` ) ) {
const embed = new Discord.RichEmbed()
.setDescription( `:x: Cannot use this command becase you are outside a ticket channel.` )
.setColor( bot.settings.colour );
}).catch(() => {
m.edit('Close ticket request, timedout').then(m2 => {
m2.delete();
}, 3000);
message.channel.send( embed );
return;
}
});
});
const closeRequestEmbed = new Discord.RichEmbed()
.setDescription( `Looks like you have come to the end of your support ticket\nPlease confirm that you want to close your ticket by saying ||**confirm**||` )
.setFooter( "Your request will be avoided in 20 seconds" )
.setColor( bot.settings.colour )
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Close_Command}`)
message.channel.send( closeRequestEmbed ).then( m => {
message.channel.awaitMessages( response => response.content.toLowerCase() === `confirm`, {
max: 1,
time: 20 * 1000,
errors: [ 'time' ],
} ).then( collected => {
let logChannel = message.guild.channels.find( channel => channel.name === bot.settings.Transcript_Logs );
let user = message.author;
let reason = args.join( " " ) || "No reason provided.";
let name = message.channel.name;
let ticketChannel = message.channel;
message.channel.send( bot.settings.Ticket_Closing )
.then( () => {
const logEmbed = new Discord.RichEmbed()
.setTitle( bot.settings.Transcript_Title )
.setColor( bot.settings.colour )
.setFooter( bot.settings.footer )
.addField( "Ticket Author", user )
.addField( "Closed By", message.author.tag )
.addField( "Reason", reason );
message.channel.fetchMessages( { limit: 100 } )
.then( msgs => {
let txt = '';
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
txt += `${message.guild.name}\n`;
txt += `#${ticketChannel.name}\n`;
txt += `${msgs.size} messages\n\n\n`;
msgs.forEach( msg => {
if ( msg.content ) {
txt += `----- ${msg.author.tag} at ${msg.createdAt}\n`;
txt += `${msg.content}\n`;
txt += `-----\n\n`;
}
} );
message.author.send( `A transcript has been generated for the ticket you closed.` );
message.author.send( new Discord.Attachment( Buffer.from( txt ), `${name}.txt` ) );
logChannel.send( logEmbed );
logChannel.send( new Discord.Attachment( Buffer.from( txt ), `${name}.txt` ) );
message.channel.delete();
// message.channel.fetchMessages( { limit: 100, before: msgs.last().id } )
// .then( msg => {
// const merged = msgs.concat( msg );
// const output = merged.reduce( ( out, msg ) => {
// out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace( /\n/g, '\r\n' ) : ''}\r\n`;
// return out;
// }, '' );
// log.send( { files: [ { attachment: Buffer.from( output, 'utf8' ), name: `${name}.txt` } ] } ).then( c.delete() ).catch( console.error ); // sends the file to logs
// return log.send( embed1 ).catch( console.error );
// } )
} );
} )
} ).catch( () => {
m.edit( 'The request to close the ticket has timed out.' ).then( m2 => m2.delete( 3000 ) );
} );
} );
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)
.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);
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.Close_Command,
}
}
+35 -2
View File
@@ -25,8 +25,41 @@ const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
message.channel.delete();
const log = message.guild.channels.find(channel => channel.name === bot.settings.Transcript_Logs)
const uID = message.author
const reason = args.join(" ") || "No Reason Provided.";
const name = message.channel.name;
const c = message.channel;
message.channel.send(`Your ticket is currently closing`)
.then(() => {
const embed1 = new Discord.RichEmbed()
.setTitle(bot.settings.Transcript_Title)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
.addField("Ticket Author", uID)
.addField("Closed By", message.author.tag)
.addField("Reason", reason)
message.channel.fetchMessages({ limit: 100 })
.then(msgs => {
message.channel.fetchMessages({ limit: 100, before: msgs.last().id })
.then(msg => {
const merged = msgs.concat(msg);
const output = merged.reduce((out, msg) => {
out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace(/\n/g, '\r\n') : ''}\r\n`;
return out;
}, '');
log.send({ files: [{ attachment: Buffer.from(output, 'utf8'), name: `${name}.txt` }] }).then(c.delete()).catch(console.error); // sends the file to logs
return log.send(embed1).catch(console.error);
})
});
})
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Forceclose_Command}`)
const CMDLog = new Discord.RichEmbed()
@@ -47,4 +80,4 @@ console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${
exports.help = {
name: bot.settings.Forceclose_Command,
}
}
+4 -3
View File
@@ -12,22 +12,23 @@ 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} <reason>**: Create a support ticket\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Ticket_Command} <reason>**: Create a support ticket\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Close_Command}**: Close your support ticket\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Suggest_Command} <suggestion>**: Create a server suggestion\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Report_Command} <user> <reason>**: Create a server suggestion\n`;
let supportCommands = "";
supportCommands += `**${bot.settings.prefix}${bot.settings.Add_Command} <user>**: Adds a user to a ticket\n`;
supportCommands += `**${bot.settings.prefix}${bot.settings.Add_Command} <user>**: Adds a user to a ticket\n`;
supportCommands += `**${bot.settings.prefix}${bot.settings.Remove_Command} <user>**: 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.Announcement_Command} <message>**: Create a bot announcement\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.Say_Command} <message>**: Send a message as the bot\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.Lockchat_Command}**: Lock the chat channel\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.UnLockchat_Command}**: UnLock the chat channel\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.Poll_Command}**: Create a poll\n`;
const embed = new Discord.RichEmbed()
.setTitle(bot.settings.botname)
+7 -40
View File
@@ -12,33 +12,6 @@ exports.run = (bot, message, args) => {
const ID = Math.floor(Math.random() * 10) + 2000;
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)
@@ -74,10 +47,11 @@ exports.run = (bot, message, args) => {
}
const ticketopened = new Discord.RichEmbed()
.setDescription(`:white_check_mark: <@${message.author.id}> You ticket has been created <#${TicketChannel.id}>`)
.setColor(bot.settings.colour)
.setTitle(":white_check_mark: Support Ticket Created")
.setDescription(`<@${message.author.id}> your support ticket created successfully`)
.addField("Your Ticket:", `<#${TicketChannel.id}>`)
.setColor(bot.settings.Ticket_Colour)
message.channel.send({embed: ticketopened});
// Ticket Message - ( Able to edit this message via the settings.json file )
const ticketMessage = `Hi! <@${message.author.id}>\n${bot.settings.Ticket_Message}`;
@@ -92,7 +66,7 @@ exports.run = (bot, message, args) => {
const TicketMessage = new Discord.RichEmbed()
.setDescription(ticketMessage, true)
.addField("Available Departments", `${Emoji_1} ${Department_1}\n${Emoji_2} ${Department_2}\n${Emoji_3} ${Department_3}`)
.setColor(bot.settings.colour)
.setColor(bot.settings.Ticket_Colour)
.setFooter(bot.settings.footer)
if (subject != 'No Subject.') {
@@ -172,15 +146,8 @@ exports.run = (bot, message, args) => {
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,
}
}
+7 -8
View File
@@ -7,7 +7,7 @@
// Resource: SupportBot
// Developed by Emerald Services
// Version: 4.2.0
// Version: 5.0.0
const Discord = require("discord.js");
const fs = require("fs");
@@ -48,13 +48,12 @@ fs.readdir("./sb-addons/", (err, files) => {
bot.on("ready", async () => {
bot.user.setActivity(bot.settings.BotStatus, {type:"PLAYING"});
console.log(`\u001b[31m`, `------------[ SupportBot ]------------`)
console.log(`\u001b[32m`, `Thank you for using SupportBot\n If you have any issues\n contact our team and we will\n give you furthur instructions\nContact us on discord if you require any support discord.gg/SPKDBX9`)
console.log(`\u001b[31m`, `------------[ SupportBot ]------------`)
console.log(`\u001b[31m`, `\n\n------------[ SupportBot Stats ]------------`)
console.log(`\u001b[32m`, `Bot Username: ${bot.user.username}\nInvite Link: https://discordapp.com/api/oauth2/authorize?client_id=${bot.user.username}&permissions=8&scope=bot`)
console.log(`\u001b[31m`, `------------[ SupportBot Stats ]------------`)
console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
console.log(`\u001b[37m`, `Emerald Services has successfully connected to discord`)
console.log(`\u001b[37m`, `Invite your bot with https://discordapp.com/api/oauth2/authorize?client_id=516372960110444574&permissions=8&scope=bot`)
console.log(`\u001b[37m`, `© ️SupportBot created by Emerald Services`)
console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
console.log(`\u001b[43;1m \u001b[37m \u001b[1m`, `If you require any assistance you can contact us at discord, https://discord.gg/tNt95Ba`)
});
+7 -3
View File
@@ -1,8 +1,8 @@
{
"SupportBot": "v4.2.0",
"SupportBot": "v5.0",
"token": "BOT_TOKEN_HERE",
"prefix": "dev-",
"prefix": "-",
"botname": "SupportBot",
"colour": "#13bd2a",
"footer": "Support Bot, By Emerald Services",
@@ -22,7 +22,11 @@
"Ticket_Message": "Your support ticket has been opened successfully\nPlease allow us some time to reach out to you.",
"Ticket_Logs": "ticket-logs",
"Default_Ticket_Reason": "No Subject",
"Ticket_React_Message": ":mailbox: React to create your support ticket.",
"Ticket_Colour": "#000e42",
"Transcript_Logs": "ticket-data",
"Transcript_Title": "Support Transcript",
"Ticket_Closing": "Your ticket is currently closing",
"Ticket_Department_1": "Support",
"Ticket_Department_2": "Security",