Skip to content

Commit

Permalink
Version 1.0.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Foaf committed Jul 23, 2021
0 parents commit 8aceac0
Show file tree
Hide file tree
Showing 11 changed files with 440 additions and 0 deletions.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<h1 align="center">
<br>
<a href="https://github.com/Cog-Creators/Red-DiscordBot/tree/V3/develop"><img src="https://i.imgur.com/PpQaXUC.png" alt="Red - Discord Bot"></a>
<br>
SimpleTickets
<br>
</h1>

<h4 align="center">Brings ease to your discord with a new and modern ticket system.</h4>

<p align="center">
<a href="https://discord.gg/MfpSxttxCS">
<img src="https://discordapp.com/api/guilds/798609106268323910/widget.png?style=shield" alt="Discord Server">
</a>
<a href="https://github.com/Rapptz/discord.py/">
<img src="https://img.shields.io/node/v/discord.js" alt="discord.js">
</a>
</p>

<p align="center">
<a href="#overview">Overview</a>
<a href="#installation">Installation</a>
<a href="#join-our-discord">Discord</a>
</p>

# Overview

SimpleTickets created to bring a modernized ease of support to discord. The bot comes customizeable with tons of configuration out of the box. This is a self hosted bot so you do need to host it and keep it maintained. Support can be given on our discord but is not guaranteed.

[Installation](#installation) is easy, and you do **NOT** need to know anything about coding! Follow the guide bellow to get a fast and clean installation.

- Ticket System Embed with Button
- Add Command
- Close Command
- Rename Command
- Remove Command
- Easy Setup
- Customizeable Config
- Admin Setup Command

# Installation

1. Run the **install.bat**
2. Configure the **config.js**
3. Run the **start.bat** that was created for you by the install.bat

[Discord](https://discord.gg/MfpSxttxCS) Join to ask for support.

# Join our Discord!

Join the official **Foaf Development [Discord](https://discord.gg/MfpSxttxCS)** to find support, resources, and new updates to all of my products.
New features are constantly added.
37 changes: 37 additions & 0 deletions commands/Tickets/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const Discord = require('discord.js');
const config = require('../../config.js');

module.exports = {
name: "add",
description: "Adds a user to the ticket.",
run: (client, message, args) => {
if (message.deletable) message.delete();

if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
return message.reply("You do not have permisson to use this command.");
if (message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Report Tickets');

let everyoneid = message.guild.roles.everyone.id;

const usertoadd = message.mentions.users.first();
if (!usertoadd) return message.reply('Please mention who to add to the ticket.');

const embed = new Discord.MessageEmbed()
.setTitle(`User Added`)
.setColor('#e93020')
.setDescription(`${message.author} You have added ${usertoadd} to the ticket`)
if (config.logoEnabled === true) {
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
} else {
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`)
}

message.channel.updateOverwrite(usertoadd, {
SEND_MESSAGES: true,
VIEW_CHANNEL: true,
READ_MESSAGE_HISTORY: true
});

message.channel.send(embed)
}
}
34 changes: 34 additions & 0 deletions commands/Tickets/close.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Discord = require('discord.js');
const config = require('../../config.js');

module.exports = {
name: "close",
description: "Closes an active ticket.",
run: async (client, message, args) => {
if (message.deletable) message.delete();

if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
return message.reply("You do not have permisson to use this command.");
if(message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Report Tickets');

const logchannel = message.guild.channels.cache.find((ch) => ch.id === config.ticketLogs);

const timeElapsed = Date.now();
const today = new Date(timeElapsed);

const log = new Discord.MessageEmbed()
.setTitle('Ticket Closed')
.setColor('#e93020')
.addField('Ticket Handler:', `${message.author}`)
.addField(`Ticket ID`, `${message.channel.id}`)
.addField(`Date`, `${today.toLocaleDateString()}`)
if (config.logoEnabled === true) {
log.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
} else {
log.setFooter(`${message.guild.name} | Made by Foaf#0001`)
}

await logchannel.send(log)
message.channel.delete()
}
}
37 changes: 37 additions & 0 deletions commands/Tickets/remove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const Discord = require('discord.js');
const config = require('../../config.js');

module.exports = {
name: "remove",
description: "Removes a user from the ticket.",
run: async (client, message, args) => {
if (message.deletable) message.delete();

if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
return message.reply("You do not have permisson to use this command.");
if(message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Report Tickets');

let everyoneid = message.guild.roles.everyone.id;

const usertoremove = message.mentions.users.first();
if (!usertoremove) return message.reply('Please mention who to remove from the ticket.');

const embed = new Discord.MessageEmbed()
.setTitle(`User Removed`)
.setColor('#e93020')
.setDescription(`${message.author} You have removed ${usertoremove} to the ticket`)
if (config.logoEnabled === true) {
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
} else {
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`)
}

message.channel.updateOverwrite(usertoremove, {
SEND_MESSAGES: false,
VIEW_CHANNEL: false,
READ_MESSAGE_HISTORY: false
});

message.channel.send(embed)
}
}
28 changes: 28 additions & 0 deletions commands/Tickets/rename.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const Discord = require('discord.js');
const config = require('../../config.js');

module.exports = {
name: "rename",
description: "Renames the active ticket.",
run: async (client, message, args) => {
if (message.deletable) message.delete();

if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
return message.reply("You do not have permisson to use this command.");
if(message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Tickets');

const newName = args.join(" ");
const embed = new Discord.MessageEmbed()
.setTitle(`Ticket Renamed`)
.setColor('#e93020')
.setDescription(`${message.author} Your ticket has been renamed to ticket-${newName}`)
if (config.logoEnabled === true) {
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
} else {
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`)
}

message.channel.setName(`ticket-${newName}`)
message.channel.send(embed)
}
}
34 changes: 34 additions & 0 deletions commands/admin/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Discord = require('discord.js');
const config = require('../../config');
const disbut = require('discord-buttons');

module.exports = {
name: "setup",
description: "Sets up the Create a Ticket Embed!",
run: async (client, message, args) => {
if (message.deletable) message.delete();

if (!message.member.roles.cache.some(r => [config.adminID].includes(r.id)))
return message.reply("You need the Admin Role to use this command!").then(m => m.delete({ timeout: 5000 }));

// Ticket Embed
const ticketEmbed = new Discord.MessageEmbed()
.setTitle(`${config.embedTitle}`)
.setDescription(`\`\`\`Use the button to create a ticket!\`\`\``)
.setColor('#FF4649')

// Ticket Button
const createRow = new disbut.MessageActionRow()
createButton = new disbut.MessageButton()
.setStyle('red')
.setLabel('Create a Ticket')
.setID('gKwBvQhLvW')

createRow.addComponent(createButton)

await message.channel.send({
embed: ticketEmbed,
component: createRow
})
}
}
27 changes: 27 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
____ ___ _____ ____ __ _ _ _
| __ ) / _ \_ _| / ___|___ _ __ / _(_) __ _ _ _ _ __ __ _| |_(_) ___ _ __ ___
| _ \| | | || | | | / _ \| '_ \| |_| |/ _` | | | | '__/ _` | __| |/ _ \| '_ \/ __|
| |_) | |_| || | | |__| (_) | | | | _| | (_| | |_| | | | (_| | |_| | (_) | | | \__ \
|____/ \___/ |_| \____\___/|_| |_|_| |_|\__, |\__,_|_| \__,_|\__|_|\___/|_| |_|___/
|___/
*/

module.exports = {

token: "", // Required | Bot Token, See: https://discord.com/developers/applications
prefix: "!", // Required | Prefix to use to run commands

adminID: "", // Required | Admin Role ID
ticketOverwatch: "", // Required | Role ID of role that will overwatch tickets
supportTeam: "", // Required | Ticket Support Team Role ID
ticketCategory: "", // Required | ID of Category where tickets are created
ticketLogs: "", // Required | ID of Channel where tickets are logged to

embedTitle: "Server Name Tickets", // Required | Title of the embed where users open tickets

logoEnabled: true,
logoURL: "https://cdn.discordapp.com/attachments/853389464277876747/867948408298696745/512x512.png", // Optional | Link to logo if you leave this blank make sure "logoEnabled" is false

}
21 changes: 21 additions & 0 deletions handler/command.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { readdirSync } = require("fs");
const ascii = require("ascii-table");
const table = new ascii().setHeading("Command", "Load status");

module.exports = (client) => {
readdirSync("./commands/").forEach(dir => {
const commands = readdirSync(`./commands/${dir}/`).filter(f => f.endsWith(".js"));
for (let file of commands) {
let pull = require(`../commands/${dir}/${file}`);
if (pull.name) {
client.commands.set(pull.name, pull);
table.addRow(file, '✅');
} else {
table.addRow(file, '❌ -> missing something??');
continue;
}
if (pull.aliases && Array.isArray(pull.aliases))
pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
}
});
}
32 changes: 32 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@echo off
title SimpleTickets Installer

echo / ---------------------------------------------- /
echo SimpleTickets Created by Foaf#0001
echo Established
echo 7 / 22 / 2021
echo Please Await Installer
echo / ---------------------------------------------- /
echo Installer Attached...
echo Downloading Required Node Modules...
echo Installing Required Node Modules...
cd %~dp0
cmd /c "npm i"
echo Checking Files...
echo Finilizing Project...
echo Finished!
echo --------------------------------------
echo Creating start command for Your Bot...
echo --------------------------------------
echo @echo off > start.bat
echo title SimpleTickets >> start.bat
echo :START >> start.bat
echo node server.js >> start.bat
echo goto START >> start.bat
echo "start.bat" File Created.
echo ------------------------------------
echo Deleting Unwanted Files...
echo ------------------------------------
del "%~f0"
echo Closing...
exit
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "simpletickets",
"version": "1.0.0",
"description": "SimpleTickets Discord Bot created by Foaf#0001",
"main": "server.js",
"scripts": {
"test": "run"
},
"keywords": [
"Tickets",
"Discord",
"Bots",
"SimpleTickets",
"Foaf"
],
"author": "Foaf#0001",
"license": "ISC",
"dependencies": {
"ascii-table": "0.0.9",
"discord-buttons": "^4.0.0",
"discord.js": "^12.5.3",
"discord.js-pagination": "^1.0.3",
"moment": "^2.29.1",
"request": "^2.88.2"
}
}
Loading

0 comments on commit 8aceac0

Please sign in to comment.