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
+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}]} */
+7 -4
View File
@@ -34,16 +34,18 @@ module.exports = () => {
}else return
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!*")