v2.1.0 push 1

changed some things
This commit is contained in:
DJj123dj
2022-06-08 17:13:53 +02:00
parent 9b378caff5
commit 62a1f0f8c1
11 changed files with 68 additions and 45 deletions
+7
View File
@@ -1,4 +1,11 @@
node_modules/
package-lock.json
devConfig.json
devConfig1.json
devConfig2.json
devConfig3.json
devConfig4.json
devConfig5.json
.DS_Store
openticketdebug.txt
developerChangelog.md
+3 -3
View File
@@ -1,5 +1,5 @@
# open-ticket
[![discord](https://img.shields.io/badge/discord-join%20our%20server-5865F2.svg?style=flat-square&logo=discord)](https://discord.com/invite/26vT9wt3n3) [![version](https://img.shields.io/badge/version-2.0.0%20stable-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v2.0.0) [![npm](https://img.shields.io/badge/npm-external%20libraries%20needed-CB3837.svg?style=flat-square&logo=npm)](#packages) [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE)
[![discord](https://img.shields.io/badge/discord-join%20our%20server-5865F2.svg?style=flat-square&logo=discord)](https://discord.com/invite/26vT9wt3n3) [![version](https://img.shields.io/badge/version-2.1.0%20stable-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v2.1.0) [![npm](https://img.shields.io/badge/npm-external%20libraries%20needed-CB3837.svg?style=flat-square&logo=npm)](#packages) [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE)
This is an open-source discord ticket bot, you can configure it and it comes with cool features like transcripts & custom options!
@@ -44,7 +44,7 @@ if there are any errors, you can open an **issue on github** or **contact me in
### config
Our config documentation is moved to another file:
[click here to view](https://www.github.com/DJj123dj/open-ticket/wiki/config-v2.0.0)
[click here to view](https://www.github.com/DJj123dj/open-ticket/wiki/config-v2.1.0)
### intents & permissions
In the discord developer portal in the "bot" panel you will find 3 switches under the title "Gateaway Intents". The following switches should always be turned on
@@ -56,7 +56,7 @@ You can also configure your own permissions
## information
_v2.0.0 unstable_
_v2.1.0 unstable_
changelog: [click here](https://www.github.com/DJj123dj/open-ticket/wiki/Changelog)
-5
View File
@@ -1,5 +0,0 @@
# documentation
The documentation is not available here, go to the [wiki](https://github.com/DJj123dj/open-ticket/wiki) instead. (the wiki isn't fully done yet!)
## 2.0.0 beta
There is currently no documentation available for open-ticket v2.0.0 beta. So if you want to test it, you need to figure it out on yourself at the moment!
+3 -3
View File
@@ -1,6 +1,6 @@
{
"bot_name":"Wumpus",
"main_color":"#fffff",
"main_color":"#ffffff",
"server_id":"server id (for slash cmds)",
"auth_token":"auth token",
"main_adminroles":["discord role id"],
@@ -78,10 +78,10 @@
"name":"Choose Your Ticket",
"description":"You can click one of the buttons below!\nYou can also customize all the embeds now!",
"enableFooter":true,
"footer":"Open Ticket v2.0.0 beta - sneakpeak",
"footer":"Open Ticket v2.1.0 - I'm a footer!",
"enableThumbnail":false,
"thumbnail":"https://www.example.com/catmemes/cat.png",
"color":"#0075e9",
"color":"#ffffff",
"options":["general","apply"],
"enableTicketExplaination":true,
"enableMaxTicketsWarning":true
+17 -4
View File
@@ -47,9 +47,18 @@ exports.checker = async () => {
}
/**@param {String} value @param {String} path */
const checkColor = (value,path) => {
if (!/^#[a-f0-9]{6}$/.test(value)){
createError("'"+path+"' | invalid color!")
const checkHexColor = (value,path) => {
if (!/^#[a-fA-F0-9]{3,6}$/.test(value)){
if (value.length < 4) return createError("'"+path+"' | hex color too short! (example: #123abc)")
if (value.length > 7) return createError("'"+path+"' | hex color too long! (example: #123abc)")
createError("'"+path+"' | invalid color! (example: #123abc)")
}
}
/**@param {String} value @param {String} path */
const checkEmbedColor = (value,path) => {
if (!['DEFAULT','WHITE','AQUA','GREEN','BLUE','YELLOW','PURPLE','LUMINOUS_VIVID_PINK','FUCHSIA','GOLD','ORANGE','RED','GREY','DARKER_GREY','NAVY','DARK_AQUA','DARK_GREEN','DARK_BLUE','DARK_PURPLE','DARK_VIVID_PINK','DARK_GOLD','DARK_ORANGE','DARK_RED','DARK_GREY','LIGHT_GREY','DARK_NAVY','BLURPLE','GREYPLE','DARK_BUT_NOT_BLACK','NOT_QUITE_BLACK','RANDOM'].includes(value)){
return createError("'"+path+"' | invalid color, must be a hex code or default color (more info in the wiki)")
}
}
@@ -229,7 +238,11 @@ exports.checker = async () => {
checkType(config.bot_name,"string","bot_name")
checkColor(config.main_color,"main_color")
if (config.main_color.startsWith("#")){
checkHexColor(config.main_color,"main_color")
}else{
checkEmbedColor(config.main_color,"main_color")
}
checkDiscord("serverid",config.server_id,"server_id")
checkToken(config.auth_token)
checkDiscordArray("roleid",config.main_adminroles,"main_adminroles")
+2 -2
View File
@@ -23,14 +23,14 @@ ask()
const runClear = async () => {
const chalk = await (await import("chalk")).default
console.log(chalk.blue("You can get a node.js warning below, just ignore that, it's not important!"))
//console.log(chalk.blue("You can get a node.js warning below, just ignore that, it's not important!"))
const dataPaths = ["./storage/dynamicDB"]
var index = 0
dataPaths.forEach((path) => {
try {
fs.rmdirSync(path,{recursive:true,force:true})
fs.rmSync(path,{recursive:true,force:true})
}catch{
//console.log(path,"doesn't exist")
}
+10 -10
View File
@@ -17,16 +17,16 @@ module.exports = db
** NOT READY YET
** must be dynamic
** =============================*/
const LocalStorage = require("node-localstorage")
const ticketStorage = new LocalStorage.LocalStorage("./storage/tickets")
exports.ticketStorage = ticketStorage
const userTicketStorage = new LocalStorage.LocalStorage("./storage/userTickets")
exports.userTicketStorage = userTicketStorage
const transcriptStorage = new LocalStorage.LocalStorage("./storage/transcripts")
exports.transcriptStorage = transcriptStorage
//const LocalStorage = require("node-localstorage")
//
//const ticketStorage = new LocalStorage.LocalStorage("./storage/tickets")
//exports.ticketStorage = ticketStorage
//
//const userTicketStorage = new LocalStorage.LocalStorage("./storage/userTickets")
//exports.userTicketStorage = userTicketStorage
//
//const transcriptStorage = new LocalStorage.LocalStorage("./storage/transcripts")
//exports.transcriptStorage = transcriptStorage
//const ticketNumberStorage = new LocalStorage.LocalStorage("./storage/ticketNumbers")
//exports.ticketNumberStorage = ticketNumberStorage
+3 -1
View File
@@ -13,7 +13,9 @@ module.exports = async () => {
var choices = []
ids.forEach((id) => {
const option = getoptions.getOptionsById(id)
choices.push({name:option.name,value:option.id})
if (option.type == "ticket"){
choices.push({name:option.name,value:option.id})
}
})
/**@type {[{name:String,value:String}]} */
+6 -3
View File
@@ -35,15 +35,17 @@ module.exports = () => {
if (getconfigoptions.getTicketValues("id").includes(customId)){
//ticketoptions from config
const currentTicketOptions = getconfigoptions.getOptionsById(customId)
if (currentTicketOptions == false || currentTicketOptions.type != "ticket") return interaction.reply({content:"This button is not a ticket!"})
if (interaction.isButton()){
interaction.deferUpdate()
}else if (interaction.isCommand()){
interaction.reply({content:"Your ticket is created!"})
}
//ticketoptions from config
const currentTicketOptions = getconfigoptions.getOptionsById(customId)
if (storage.get("ticketStorage",interaction.member.id) == null || storage.get("ticketStorage",interaction.member.id) == "false"|| Number(storage.get("ticketStorage",interaction.member.id)) < config.system.max_allowed_tickets){
try{
@@ -139,6 +141,7 @@ module.exports = () => {
storage.set("userTicketStorage",ticketChannel.id,interaction.member.id)
var ticketEmbed = new discord.MessageEmbed()
//.setColor(config.main_color)
.setColor(config.main_color)
.setTitle("You created a ticket!")
.setDescription("The staff will help you soon!\n\n*Click on the button below to close the ticket!*")
+14 -11
View File
@@ -6,9 +6,13 @@ exports.client = client
client.setMaxListeners(20)
//change to FALSE on release
const isDev = false
//!!!!!!!!!!!
if (process.argv[2]){
if (process.argv[2].endsWith("d")){
var isDev = true
console.log("starting in dev mode...")
}else{var isDev = false}
}else{var isDev = false}
if (isDev){
try {
@@ -22,12 +26,14 @@ exports.config = config
client.on('ready',async () => {
const chalk = await (await import("chalk")).default
if (process.argv[2] != "slash"){
if (!process.argv[2].startsWith("slash")){
console.log(chalk.green("open-ticket ready!"))
if (config.logs){console.log(chalk.white("\n\nlogs:\n============"))}
if (config.status.enabled){
client.user.setActivity(config.status.text,{type:config.status.type})
}
await client.guilds.cache.find((g) => g.id == config.server_id).members.fetch()
}else{
console.log(chalk.red("STARTING IN ")+chalk.blue("SLASH MODE")+chalk.red("..."))
console.log("logs:\n================")
@@ -46,9 +52,11 @@ client.on('ready',async () => {
}
})
require("./core/checker").checker()
if (!isDev){
require("./core/checker").checker()
}
if (process.argv[2] != "slash"){
if (process.argv[2] && !process.argv[2].startsWith("slash")){
var storage = require('./core/dynamicdatabase/storage')
exports.storage = storage
@@ -67,11 +75,6 @@ if (process.argv[2] != "slash"){
require("./core/closebuttons")()
require("./core/reactionRoles")()
/**
* We need:
* - checker.js
*/
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "open-ticket",
"version": "2.0.0",
"version": "2.1.0",
"description": "This is an open-source discord ticket bot, you can configure it and it comes with cool features like a transcript.",
"main": "index.js",
"scripts": {