Skip to content

Commit 8aceac0

Browse files
author
Foaf
committed
Version 1.0.0 Release
0 parents  commit 8aceac0

File tree

11 files changed

+440
-0
lines changed

11 files changed

+440
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<h1 align="center">
2+
<br>
3+
<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>
4+
<br>
5+
SimpleTickets
6+
<br>
7+
</h1>
8+
9+
<h4 align="center">Brings ease to your discord with a new and modern ticket system.</h4>
10+
11+
<p align="center">
12+
<a href="https://discord.gg/MfpSxttxCS">
13+
<img src="https://discordapp.com/api/guilds/798609106268323910/widget.png?style=shield" alt="Discord Server">
14+
</a>
15+
<a href="https://github.com/Rapptz/discord.py/">
16+
<img src="https://img.shields.io/node/v/discord.js" alt="discord.js">
17+
</a>
18+
</p>
19+
20+
<p align="center">
21+
<a href="#overview">Overview</a>
22+
23+
<a href="#installation">Installation</a>
24+
25+
<a href="#join-our-discord">Discord</a>
26+
</p>
27+
28+
# Overview
29+
30+
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.
31+
32+
[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.
33+
34+
- Ticket System Embed with Button
35+
- Add Command
36+
- Close Command
37+
- Rename Command
38+
- Remove Command
39+
- Easy Setup
40+
- Customizeable Config
41+
- Admin Setup Command
42+
43+
# Installation
44+
45+
1. Run the **install.bat**
46+
2. Configure the **config.js**
47+
3. Run the **start.bat** that was created for you by the install.bat
48+
49+
[Discord](https://discord.gg/MfpSxttxCS) Join to ask for support.
50+
51+
# Join our Discord!
52+
53+
Join the official **Foaf Development [Discord](https://discord.gg/MfpSxttxCS)** to find support, resources, and new updates to all of my products.
54+
New features are constantly added.

commands/Tickets/add.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const Discord = require('discord.js');
2+
const config = require('../../config.js');
3+
4+
module.exports = {
5+
name: "add",
6+
description: "Adds a user to the ticket.",
7+
run: (client, message, args) => {
8+
if (message.deletable) message.delete();
9+
10+
if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
11+
return message.reply("You do not have permisson to use this command.");
12+
if (message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Report Tickets');
13+
14+
let everyoneid = message.guild.roles.everyone.id;
15+
16+
const usertoadd = message.mentions.users.first();
17+
if (!usertoadd) return message.reply('Please mention who to add to the ticket.');
18+
19+
const embed = new Discord.MessageEmbed()
20+
.setTitle(`User Added`)
21+
.setColor('#e93020')
22+
.setDescription(`${message.author} You have added ${usertoadd} to the ticket`)
23+
if (config.logoEnabled === true) {
24+
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
25+
} else {
26+
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`)
27+
}
28+
29+
message.channel.updateOverwrite(usertoadd, {
30+
SEND_MESSAGES: true,
31+
VIEW_CHANNEL: true,
32+
READ_MESSAGE_HISTORY: true
33+
});
34+
35+
message.channel.send(embed)
36+
}
37+
}

commands/Tickets/close.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const Discord = require('discord.js');
2+
const config = require('../../config.js');
3+
4+
module.exports = {
5+
name: "close",
6+
description: "Closes an active ticket.",
7+
run: async (client, message, args) => {
8+
if (message.deletable) message.delete();
9+
10+
if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
11+
return message.reply("You do not have permisson to use this command.");
12+
if(message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Report Tickets');
13+
14+
const logchannel = message.guild.channels.cache.find((ch) => ch.id === config.ticketLogs);
15+
16+
const timeElapsed = Date.now();
17+
const today = new Date(timeElapsed);
18+
19+
const log = new Discord.MessageEmbed()
20+
.setTitle('Ticket Closed')
21+
.setColor('#e93020')
22+
.addField('Ticket Handler:', `${message.author}`)
23+
.addField(`Ticket ID`, `${message.channel.id}`)
24+
.addField(`Date`, `${today.toLocaleDateString()}`)
25+
if (config.logoEnabled === true) {
26+
log.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
27+
} else {
28+
log.setFooter(`${message.guild.name} | Made by Foaf#0001`)
29+
}
30+
31+
await logchannel.send(log)
32+
message.channel.delete()
33+
}
34+
}

commands/Tickets/remove.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const Discord = require('discord.js');
2+
const config = require('../../config.js');
3+
4+
module.exports = {
5+
name: "remove",
6+
description: "Removes a user from the ticket.",
7+
run: async (client, message, args) => {
8+
if (message.deletable) message.delete();
9+
10+
if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
11+
return message.reply("You do not have permisson to use this command.");
12+
if(message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Report Tickets');
13+
14+
let everyoneid = message.guild.roles.everyone.id;
15+
16+
const usertoremove = message.mentions.users.first();
17+
if (!usertoremove) return message.reply('Please mention who to remove from the ticket.');
18+
19+
const embed = new Discord.MessageEmbed()
20+
.setTitle(`User Removed`)
21+
.setColor('#e93020')
22+
.setDescription(`${message.author} You have removed ${usertoremove} to the ticket`)
23+
if (config.logoEnabled === true) {
24+
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
25+
} else {
26+
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`)
27+
}
28+
29+
message.channel.updateOverwrite(usertoremove, {
30+
SEND_MESSAGES: false,
31+
VIEW_CHANNEL: false,
32+
READ_MESSAGE_HISTORY: false
33+
});
34+
35+
message.channel.send(embed)
36+
}
37+
}

commands/Tickets/rename.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const Discord = require('discord.js');
2+
const config = require('../../config.js');
3+
4+
module.exports = {
5+
name: "rename",
6+
description: "Renames the active ticket.",
7+
run: async (client, message, args) => {
8+
if (message.deletable) message.delete();
9+
10+
if (!message.member.roles.cache.some(r => [config.supportTeamID, config.ticketOverwatch, config.adminID].includes(r.id)))
11+
return message.reply("You do not have permisson to use this command.");
12+
if(message.channel.parentID !== config.ticketCategory) return message.reply('You may only use Ticket Commands in active Tickets');
13+
14+
const newName = args.join(" ");
15+
const embed = new Discord.MessageEmbed()
16+
.setTitle(`Ticket Renamed`)
17+
.setColor('#e93020')
18+
.setDescription(`${message.author} Your ticket has been renamed to ticket-${newName}`)
19+
if (config.logoEnabled === true) {
20+
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`, config.logoURL)
21+
} else {
22+
embed.setFooter(`${message.guild.name} | Made by Foaf#0001`)
23+
}
24+
25+
message.channel.setName(`ticket-${newName}`)
26+
message.channel.send(embed)
27+
}
28+
}

commands/admin/setup.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const Discord = require('discord.js');
2+
const config = require('../../config');
3+
const disbut = require('discord-buttons');
4+
5+
module.exports = {
6+
name: "setup",
7+
description: "Sets up the Create a Ticket Embed!",
8+
run: async (client, message, args) => {
9+
if (message.deletable) message.delete();
10+
11+
if (!message.member.roles.cache.some(r => [config.adminID].includes(r.id)))
12+
return message.reply("You need the Admin Role to use this command!").then(m => m.delete({ timeout: 5000 }));
13+
14+
// Ticket Embed
15+
const ticketEmbed = new Discord.MessageEmbed()
16+
.setTitle(`${config.embedTitle}`)
17+
.setDescription(`\`\`\`Use the button to create a ticket!\`\`\``)
18+
.setColor('#FF4649')
19+
20+
// Ticket Button
21+
const createRow = new disbut.MessageActionRow()
22+
createButton = new disbut.MessageButton()
23+
.setStyle('red')
24+
.setLabel('Create a Ticket')
25+
.setID('gKwBvQhLvW')
26+
27+
createRow.addComponent(createButton)
28+
29+
await message.channel.send({
30+
embed: ticketEmbed,
31+
component: createRow
32+
})
33+
}
34+
}

config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
____ ___ _____ ____ __ _ _ _
3+
| __ ) / _ \_ _| / ___|___ _ __ / _(_) __ _ _ _ _ __ __ _| |_(_) ___ _ __ ___
4+
| _ \| | | || | | | / _ \| '_ \| |_| |/ _` | | | | '__/ _` | __| |/ _ \| '_ \/ __|
5+
| |_) | |_| || | | |__| (_) | | | | _| | (_| | |_| | | | (_| | |_| | (_) | | | \__ \
6+
|____/ \___/ |_| \____\___/|_| |_|_| |_|\__, |\__,_|_| \__,_|\__|_|\___/|_| |_|___/
7+
|___/
8+
9+
*/
10+
11+
module.exports = {
12+
13+
token: "", // Required | Bot Token, See: https://discord.com/developers/applications
14+
prefix: "!", // Required | Prefix to use to run commands
15+
16+
adminID: "", // Required | Admin Role ID
17+
ticketOverwatch: "", // Required | Role ID of role that will overwatch tickets
18+
supportTeam: "", // Required | Ticket Support Team Role ID
19+
ticketCategory: "", // Required | ID of Category where tickets are created
20+
ticketLogs: "", // Required | ID of Channel where tickets are logged to
21+
22+
embedTitle: "Server Name Tickets", // Required | Title of the embed where users open tickets
23+
24+
logoEnabled: true,
25+
logoURL: "https://cdn.discordapp.com/attachments/853389464277876747/867948408298696745/512x512.png", // Optional | Link to logo if you leave this blank make sure "logoEnabled" is false
26+
27+
}

handler/command.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { readdirSync } = require("fs");
2+
const ascii = require("ascii-table");
3+
const table = new ascii().setHeading("Command", "Load status");
4+
5+
module.exports = (client) => {
6+
readdirSync("./commands/").forEach(dir => {
7+
const commands = readdirSync(`./commands/${dir}/`).filter(f => f.endsWith(".js"));
8+
for (let file of commands) {
9+
let pull = require(`../commands/${dir}/${file}`);
10+
if (pull.name) {
11+
client.commands.set(pull.name, pull);
12+
table.addRow(file, '✅');
13+
} else {
14+
table.addRow(file, '❌ -> missing something??');
15+
continue;
16+
}
17+
if (pull.aliases && Array.isArray(pull.aliases))
18+
pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
19+
}
20+
});
21+
}

install.bat

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@echo off
2+
title SimpleTickets Installer
3+
4+
echo / ---------------------------------------------- /
5+
echo SimpleTickets Created by Foaf#0001
6+
echo Established
7+
echo 7 / 22 / 2021
8+
echo Please Await Installer
9+
echo / ---------------------------------------------- /
10+
echo Installer Attached...
11+
echo Downloading Required Node Modules...
12+
echo Installing Required Node Modules...
13+
cd %~dp0
14+
cmd /c "npm i"
15+
echo Checking Files...
16+
echo Finilizing Project...
17+
echo Finished!
18+
echo --------------------------------------
19+
echo Creating start command for Your Bot...
20+
echo --------------------------------------
21+
echo @echo off > start.bat
22+
echo title SimpleTickets >> start.bat
23+
echo :START >> start.bat
24+
echo node server.js >> start.bat
25+
echo goto START >> start.bat
26+
echo "start.bat" File Created.
27+
echo ------------------------------------
28+
echo Deleting Unwanted Files...
29+
echo ------------------------------------
30+
del "%~f0"
31+
echo Closing...
32+
exit

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "simpletickets",
3+
"version": "1.0.0",
4+
"description": "SimpleTickets Discord Bot created by Foaf#0001",
5+
"main": "server.js",
6+
"scripts": {
7+
"test": "run"
8+
},
9+
"keywords": [
10+
"Tickets",
11+
"Discord",
12+
"Bots",
13+
"SimpleTickets",
14+
"Foaf"
15+
],
16+
"author": "Foaf#0001",
17+
"license": "ISC",
18+
"dependencies": {
19+
"ascii-table": "0.0.9",
20+
"discord-buttons": "^4.0.0",
21+
"discord.js": "^12.5.3",
22+
"discord.js-pagination": "^1.0.3",
23+
"moment": "^2.29.1",
24+
"request": "^2.88.2"
25+
}
26+
}

0 commit comments

Comments
 (0)