Compare commits

...
15 Commits
Author SHA1 Message Date
Jasper f2ddaa5fd4 Merge pull request #36 from DJj123dj/dev
Open Ticket v3.1.0
2022-12-31 11:47:35 +01:00
DJj123dj fc50a8e83f v3.1 last push 2022-12-31 11:42:33 +01:00
DJj123dj 5bece3357d v3.1.0 push 3 2022-12-27 17:41:54 +01:00
Jasper 97d1489558 Delete .DS_Store 2022-12-27 17:37:23 +01:00
Jasper a211cef1f6 Delete database.json 2022-12-27 17:36:52 +01:00
DJj123dj ae002e168b v3.1.0 push 2 2022-12-27 17:35:01 +01:00
DJj123dj 86a5a1a2ca v3.1.0 push 1 2022-12-27 11:38:32 +01:00
Jasper 23ebc14b8b Merge pull request #35 from DJj123dj/dev
Open Ticket v3.0.1
2022-12-10 13:38:08 +01:00
DJj123dj 3a5768a1b1 added new README image 2022-12-10 13:37:02 +01:00
DJj123dj 33c3803ca8 openticket v3.0.1 2022-12-10 12:59:44 +01:00
DJj123dj f3613fb674 update to discord.js 14.7 2022-12-05 19:32:11 +01:00
DJj123dj f1dc8cbcf5 changed some stuff 2022-11-24 21:51:13 +01:00
Jasper a365c4b69f Update issue templates 2022-10-10 20:01:10 +02:00
Jasper 687372481a Update issue templates 2022-10-10 19:54:28 +02:00
Jasper 1bc8bde922 Update issue templates 2022-10-10 19:49:16 +02:00
29 changed files with 559 additions and 172 deletions
+37
View File
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve Open Ticket
title: "[BUG] your bug"
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Device:**
- Device: [e.g. Macbook pro, raspberry pi, HP Probook]
- OS: [e.g. MacOS, Ubuntu, Windows,...]
- Node.js version:
- Open Ticket Version:
**Files:**
Please include the `openticketdebug.txt` file in your report!
This is a file that we can see what happend!
**Additional context**
Add any other context about the problem here.
+29
View File
@@ -0,0 +1,29 @@
---
name: Plugin
about: Show your open ticket plugins here!
title: "[PLUGIN] your plugin"
labels: plugin
assignees: ''
---
**Plugin Name:**
What's the name of your plugin?
**Description:**
Tell a little bit about what the plugin does!
Also tell how to use the plugin, like if there is additional setup needed!
**NPM libraries:**
List all the libraries needed for this plugin to work!
*The default open ticket libraries are not required!*
**Author:**
- github account [e.g. DJj123dj]
- discord account [e.g. Wumpus#1234]
**Compatible versions:**
[e.g. from v2.2.1 until v3.0.1]
**File:**
Please attach the plugin file to this issue!
+2
View File
@@ -10,6 +10,8 @@ devConfig5.json
openticketdebug.txt openticketdebug.txt
developerChangelog.md developerChangelog.md
storage/dynamicDB/ storage/dynamicDB/
storage/slashcmdEnabled.txt
storage/database.json
storage/.DS_Store storage/.DS_Store
.vscode/ .vscode/
livestatus.json livestatus.json
+3 -3
View File
@@ -1,5 +1,5 @@
# Open Ticket # 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-3.0.0-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.0.0) [![discord.js](https://img.shields.io/badge/discord.js-v14-CB3837.svg?style=flat-square&logo=npm)]() [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [![documentation](https://img.shields.io/badge/documentation-Click%20Here-yellow.svg?style=flat-square)](https://docs.openticket.dj-dj.be) [![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-3.1.0-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.1.0) [![discord.js](https://img.shields.io/badge/discord.js-v14-CB3837.svg?style=flat-square&logo=npm)]() [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [![documentation](https://img.shields.io/badge/documentation-Click%20Here-yellow.svg?style=flat-square)](https://docs.openticket.dj-dj.be)
Open ticket is the most configurable open-source ticket bot for discord! Made with the newest technologies. Like: Slash commands, transcripts, multiple ticket types, buttons & dropdowns! Open ticket is the most configurable open-source ticket bot for discord! Made with the newest technologies. Like: Slash commands, transcripts, multiple ticket types, buttons & dropdowns!
Start using it now, you can do anything! Start using it now, you can do anything!
@@ -48,11 +48,11 @@ Start using it now, you can do anything!
[Click here to start your adventure!](https://docs.openticket.dj-dj.be/quick-start) [Click here to start your adventure!](https://docs.openticket.dj-dj.be/quick-start)
## documentation ## documentation
[Official Documentation](https://docs.openticket.dj-dj.be) [<img src="./otWIKI.png" width="400px" href="https://docs.openticket.dj-dj.be">](https://docs.openticket.dj-dj.be)
## information ## information
_v3.0.0_ _v3.1.0_
changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog) changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog)
+19 -3
View File
@@ -92,7 +92,7 @@
"dropdown":false, "dropdown":false,
"enableFooter":false, "enableFooter":false,
"footer":"Open Ticket v3.0.0 - I'm a footer!", "footer":"Open Ticket v3.1.0 - I'm a footer!",
"enableThumbnail":false, "enableThumbnail":false,
"thumbnail":"https://www.example.com/catmemes/cat.png", "thumbnail":"https://www.example.com/catmemes/cat.png",
@@ -101,8 +101,24 @@
"color":"#ffffff", "color":"#ffffff",
"options":["general","apply"], "options":["general","apply"],
"enableTicketExplaination":true,
"enableMaxTicketsWarning":true "other":{
"enableTicketExplaination":true,
"enableMaxTicketsWarning":true,
"customDropdownPlaceholder":{
"enable":false,
"text":"Choose a ticket"
},
"customCategoryText":{
"enable":false,
"text":"choose a category:"
},
"embedTitleURL":{
"enable":false,
"url":"https://www.dj-dj.be/projects/open-ticket"
}
}
} }
] ]
} }
+10 -9
View File
@@ -4,7 +4,8 @@ const client = bot.client
const config = bot.config const config = bot.config
const log = bot.errorLog.log const log = bot.errorLog.log
const l = bot.language const l = bot.language
const storage = bot.storage
const configParser = require("../../utils/configParser")
//EVENT API: //EVENT API:
@@ -48,7 +49,7 @@ exports.onTicketOpen = (user,channel,guild,date,ticketdata) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
* @param {String} reason * @param {String} reason
*/ */
exports.onTicketClose = (user,channel,guild,date,ticketdata,reason) => { exports.onTicketClose = (user,channel,guild,date,ticketdata,reason) => {
@@ -69,7 +70,7 @@ exports.onTicketClose = (user,channel,guild,date,ticketdata,reason) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
*/ */
exports.onTicketDelete = (user,channel,guild,date,ticketdata) => { exports.onTicketDelete = (user,channel,guild,date,ticketdata) => {
//system //system
@@ -89,7 +90,7 @@ exports.onTicketDelete = (user,channel,guild,date,ticketdata) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
*/ */
exports.onTicketReopen = (user,channel,guild,date,ticketdata) => { exports.onTicketReopen = (user,channel,guild,date,ticketdata) => {
//system //system
@@ -110,7 +111,7 @@ exports.onTicketReopen = (user,channel,guild,date,ticketdata) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
*/ */
exports.onTicketAdd = (user,editeduser,channel,guild,date,ticketdata) => { exports.onTicketAdd = (user,editeduser,channel,guild,date,ticketdata) => {
//system //system
@@ -131,7 +132,7 @@ exports.onTicketAdd = (user,editeduser,channel,guild,date,ticketdata) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
*/ */
exports.onTicketRemove = (user,editeduser,channel,guild,date,ticketdata) => { exports.onTicketRemove = (user,editeduser,channel,guild,date,ticketdata) => {
//system //system
@@ -237,7 +238,7 @@ exports.onCommand = (type,hasPerms,user,channel,guild,date) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
*/ */
/** /**
@@ -246,7 +247,7 @@ exports.onCommand = (type,hasPerms,user,channel,guild,date) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
* @param {String} reason * @param {String} reason
*/ */
@@ -265,7 +266,7 @@ exports.onCommand = (type,hasPerms,user,channel,guild,date) => {
* @param {discord.TextChannel} channel * @param {discord.TextChannel} channel
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {Date} date * @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata * @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
*/ */
/** /**
+7 -3
View File
@@ -19,9 +19,13 @@ module.exports = () => {
/**@type {Error} */ /**@type {Error} */
const theError = err const theError = err
if (api.enableAPIdebug){ if (api.enableAPIdebug){
const data = fs.readFileSync("./apiDebug.txt") try {
const newData = data ? data.toString() : "" const data = fs.readFileSync("./apiDebug.txt")
fs.writeFileSync("./apiDebug.txt",newData+"ERROR: "+theError.name+": "+theError.message+"\n"+theError.stack+"\n\n") const newData = data ? data.toString() : ""
fs.writeFileSync("./apiDebug.txt",newData+"ERROR: "+theError.name+": "+theError.message+"\n"+theError.stack+"\n\n")
}catch{
fs.writeFileSync("./apiDebug.txt","ERROR: "+theError.name+": "+theError.message+"\n"+theError.stack+"\n\n")
}
} }
failcount++ failcount++
totalcount++ totalcount++
+42 -4
View File
@@ -85,6 +85,9 @@ exports.checker = async () => {
/**@param {"userid"|"roleid"|"channelid"|"serverid"} mode @param {String[]} arrayValue @param {String} path */ /**@param {"userid"|"roleid"|"channelid"|"serverid"} mode @param {String[]} arrayValue @param {String} path */
const checkDiscordArray = (mode,arrayValue,path) => { const checkDiscordArray = (mode,arrayValue,path) => {
if (!Array.isArray(arrayValue)){
return createError("'"+path+"' | this needs to be an Array!")
}
if (mode == "userid"){ if (mode == "userid"){
arrayValue.forEach((value,index) => { arrayValue.forEach((value,index) => {
if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){ if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){
@@ -308,10 +311,6 @@ exports.checker = async () => {
checkHexColor(input.color,path+"/color") checkHexColor(input.color,path+"/color")
} }
//ticket explaination & max tickets warning
checkType(input.enableTicketExplaination,"boolean",path+"/enableTicketExplaination")
checkType(input.enableMaxTicketsWarning,"boolean",path+"/enableMaxTicketsWarning")
//OPTIONS!!! //OPTIONS!!!
var counter = 0 var counter = 0
input.options.forEach((option) => {if (!configParser.optionExists(option)){counter++}}) input.options.forEach((option) => {if (!configParser.optionExists(option)){counter++}})
@@ -325,6 +324,42 @@ exports.checker = async () => {
} }
}) })
} }
//other
//ticket explaination & max tickets warning
if (typeof input.other != "object"){
createError("'"+path+"/other' | this object doesn't exist!")
}else{
checkType(input.other.enableTicketExplaination,"boolean",path+"/other/enableTicketExplaination")
checkType(input.other.enableMaxTicketsWarning,"boolean",path+"/other/enableMaxTicketsWarning")
//customDropdownPlaceholder
if (typeof input.other.customDropdownPlaceholder != "object"){
createError("'"+path+"/other/customDropdownPlaceholder' | this object doesn't exist!")
}else{
checkType(input.other.customDropdownPlaceholder.enable,"boolean",path+"/other/customDropdownPlaceholder/enable")
checkType(input.other.customDropdownPlaceholder.text,"string",path+"/other/customDropdownPlaceholder/text")
if (input.other.customDropdownPlaceholder.enable && input.other.customDropdownPlaceholder.text.length < 1){createError("'"+path+"/other/customDropdownPlaceholder/text' | there is no placeholder text!")}
}
//customCategoryText
if (typeof input.other.customCategoryText != "object"){
createError("'"+path+"/other/customCategoryText' | this object doesn't exist!")
}else{
checkType(input.other.customCategoryText.enable,"boolean",path+"/other/customCategoryText/enable")
checkType(input.other.customCategoryText.text,"string",path+"/other/customCategoryText/text")
if (input.other.customCategoryText.enable && input.other.customCategoryText.text.length < 1){createError("'"+path+"/other/customCategoryText/text' | there is no category text!")}
}
//embedTitleURL
if (typeof input.other.embedTitleURL != "object"){
createError("'"+path+"/other/embedTitleURL' | this object doesn't exist!")
}else{
checkType(input.other.embedTitleURL.enable,"boolean",path+"/other/embedTitleURL/enable")
checkType(input.other.embedTitleURL.url,"string",path+"/other/embedTitleURL/text")
if (input.other.embedTitleURL.enable && input.other.embedTitleURL.url.length < 1){createError("'"+path+"/other/embedTitleURL/url' | there is no url!")}
}
}
} }
//--------------------------| //--------------------------|
@@ -438,6 +473,9 @@ exports.checker = async () => {
const splitw = w.split("'") const splitw = w.split("'")
if (splitw.length > 1){ if (splitw.length > 1){
var splitstring = chalk.yellow(splitw[0])+chalk.blue("'"+splitw[1]+"'")+chalk.yellow(splitw[2]) var splitstring = chalk.yellow(splitw[0])+chalk.blue("'"+splitw[1]+"'")+chalk.yellow(splitw[2])
if (splitw[3]){splitstring = splitstring+chalk.yellow(splitw[3])}
if (splitw[4]){splitstring = splitstring+chalk.yellow(splitw[4])}
if (splitw[5]){splitstring = splitstring+chalk.yellow(splitw[5])}
}else {var splitstring = chalk.yellow(splitw[0])} }else {var splitstring = chalk.yellow(splitw[0])}
console.log(splitstring) console.log(splitstring)
}) })
@@ -0,0 +1,71 @@
const fs = require("fs")
const location = "./storage/database.json"
/**@returns {[{category:String, key:String, value:String}]}*/
function getData(){
if (fs.existsSync(location)){
return JSON.parse(fs.readFileSync(location).toString())
}else{
fs.writeFileSync(location,"[]")
return []
}
}
/**@param {[{category:String, key:String, value:String}]} data*/
function setData(data){
fs.writeFileSync(location,JSON.stringify(data,null,"\t"))
}
exports.set = (category,key,value) => {
const currentData = getData()
const exists = currentData.find((d) => (d.category == category) && (d.key == key)) ? true : false
var newData = []
if (exists){
currentData.forEach((d,i) => {
if (d.category == category && d.key == key){
newData.push({category,key,value})
}else{
newData.push(d)
}
})
}else{
currentData.push({category,key,value})
newData = currentData
}
setData(newData)
return exists
}
/**
* @param {String} category
* @param {String} key
* @returns {String|false}
*/
exports.get = (category,key) => {
const currentData = getData()
const tempresult = currentData.find((d) => (d.category == category) && (d.key == key))
const result = tempresult ? tempresult.value : false
return result
}
/**
* @param {String} category
* @param {String} key
* @param {String} value
*/
exports.delete = (category,key) => {
const currentData = getData()
const exists = currentData.find((d) => (d.category == category) && (d.key == key)) ? true : false
var newData = []
if (exists){
currentData.forEach((d,i) => {
if (!(d.category == category && d.key == key)){
newData.push(d)
}
})
}else{
newData = currentData
}
setData(newData)
return exists
}
@@ -37,3 +37,7 @@ exports.delete = (category,id) => {
ls.removeItem(category+"--"+id) ls.removeItem(category+"--"+id)
return true return true
} }
this.set("category","key","value")
this.get("category","key",)
this.delete("category","key")
+3 -7
View File
@@ -1,11 +1,7 @@
//Do not change this without knowing what you are doing!!
const databaseFile = "local"
//Do not change this without knowing what you are doing!!
try { try {
var db = require("./dynamicfiles/local") var db = require("./dynamicfiles/database")
}catch{ }catch(err){
console.log(err)
console.log("I couldn't find the database file! (location: ./core/dynamicdatabase/storage.js:2)") console.log("I couldn't find the database file! (location: ./core/dynamicdatabase/storage.js:2)")
process.exit(1) process.exit(1)
} }
+14
View File
@@ -93,10 +93,24 @@ exports.custom = (title,message,emoji,color) => {
return x return x
} }
exports.clearDebugFile = () => {
const fs = require("fs")
if (!fs.existsSync("./openticketdebug.txt")) return
const content = fs.readFileSync("./openticketdebug.txt").toString().split("\n")
if (content.length < 5000) return
for (let i = 0; i < 4000; i++) {
content.shift()
}
const newContent = "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="+content.join("\n")
fs.writeFileSync("./openticketdebug.txt",newContent)
}
const normalLog = (debugString) => { const normalLog = (debugString) => {
const fs = require("fs") const fs = require("fs")
const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n==========================" const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="
fs.writeFileSync("./openticketdebug.txt",content+"\nSYSTEM: "+debugString) fs.writeFileSync("./openticketdebug.txt",content+"\nSYSTEM: "+debugString)
this.clearDebugFile()
} }
/** /**
@@ -22,7 +22,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTcloseTicketTrue") return if (interaction.customId != "OTcloseTicketTrue") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
if (closeTicketButtonChecker == true) return if (closeTicketButtonChecker == true) return
closeTicketButtonChecker = true closeTicketButtonChecker = true
@@ -20,7 +20,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTsendTranscript") return if (interaction.customId != "OTsendTranscript") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
const tsmsg = await interaction.channel.send({embeds:[bot.embeds.commands.sendTranscriptEmbed(false,interaction.channel,interaction.user)]}) const tsmsg = await interaction.channel.send({embeds:[bot.embeds.commands.sendTranscriptEmbed(false,interaction.channel,interaction.user)]})
const channelmessages = await interaction.channel.messages.fetch() const channelmessages = await interaction.channel.messages.fetch()
@@ -20,7 +20,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTcloseTicket") return if (interaction.customId != "OTcloseTicket") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.verifybars.closeVerifyBar]}) interaction.message.edit({components:[bot.buttons.verifybars.closeVerifyBar]})
}) })
@@ -28,7 +30,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTcloseTicketFalse") return if (interaction.customId != "OTcloseTicketFalse") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.close.openRowNormal]}) interaction.message.edit({components:[bot.buttons.close.openRowNormal]})
}) })
@@ -37,7 +41,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicket") return if (interaction.customId != "OTdeleteTicket") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.verifybars.deleteVerifyBar]}) interaction.message.edit({components:[bot.buttons.verifybars.deleteVerifyBar]})
}) })
@@ -45,7 +51,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicketFalse") return if (interaction.customId != "OTdeleteTicketFalse") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.close.openRowNormal]}) interaction.message.edit({components:[bot.buttons.close.openRowNormal]})
}) })
@@ -54,7 +62,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicket1") return if (interaction.customId != "OTdeleteTicket1") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.verifybars.delete1VerifyBar]}) interaction.message.edit({components:[bot.buttons.verifybars.delete1VerifyBar]})
}) })
@@ -62,7 +72,9 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicketFalse1") return if (interaction.customId != "OTdeleteTicketFalse1") return
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.close.closeCommandRow]}) interaction.message.edit({components:[bot.buttons.close.closeCommandRow]})
}) })
} }
+50 -43
View File
@@ -12,64 +12,71 @@ module.exports = async () => {
const chalk = await (await import("chalk")).default const chalk = await (await import("chalk")).default
client.on("interactionCreate",(interaction) => { client.on("interactionCreate",(interaction) => {
if (!interaction.isButton()) return if (!interaction.isButton() && !interaction.isStringSelectMenu()) return
if (!interaction.customId.startsWith("newR")) return if (interaction.isButton() && !interaction.customId.startsWith("newR")) return
if (interaction.isStringSelectMenu() && !(interaction.customId == "OTdropdownMenu")) return
interaction.deferUpdate()
if (interaction.customId.startsWith("newR")){
const optionid = interaction.customId.split("newR")[1]
if (!optionid){
interaction.reply({embeds:[bot.errorLog.serverError(l.errors.roleDoesntExist)]})
return
}
const optionidRaw = interaction.isStringSelectMenu() ? interaction.values[0] : interaction.customId
if (!optionidRaw.includes("newR")) return
const optionid = optionidRaw.split("newR")[1]
if (!optionid){
interaction.reply({embeds:[bot.errorLog.serverError(l.errors.roleDoesntExist)]})
return
}else{
try { try {
interaction.deferUpdate()
} catch{}
}
const option = require("./utils/getButton").getOption(optionid) try {
/**@type {"add"|"remove"|"add&remove"} */
const mode = option.mode
const user = interaction.member
if (mode == "add"){ const option = require("./utils/getButton").getOption(optionid)
option.roles.forEach((role) => { /**@type {"add"|"remove"|"add&remove"} */
const mode = option.mode
const user = interaction.member
if (mode == "add"){
option.roles.forEach((role) => {
interaction.guild.members.cache.find(u => u.id == user.id).roles.add(role)
log("system","added role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}])
const apirole = interaction.guild.roles.cache.find(r => r.id == role)
APIEvents.onReactionRole("add","add",apirole,interaction.user,interaction.channel,interaction.guild,new Date())
})
}else if (mode == "remove"){
option.roles.forEach((role) => {
interaction.guild.members.cache.find(u => u.id == user.id).roles.remove(role)
log("system","removed role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}])
const apirole = interaction.guild.roles.cache.find(r => r.id == role)
APIEvents.onReactionRole("remove","remove",apirole,interaction.user,interaction.channel,interaction.guild,new Date())
})
}else if (mode == "add&remove"){
option.roles.forEach((role) => {
if (!interaction.guild.members.cache.find(u => u.id == user.id).roles.cache.has(role)){
interaction.guild.members.cache.find(u => u.id == user.id).roles.add(role) interaction.guild.members.cache.find(u => u.id == user.id).roles.add(role)
log("system","added role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}]) log("system","added role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}])
const apirole = interaction.guild.roles.cache.find(r => r.id == role) const apirole = interaction.guild.roles.cache.find(r => r.id == role)
APIEvents.onReactionRole("add","add",apirole,interaction.user,interaction.channel,interaction.guild,new Date()) APIEvents.onReactionRole("add","add&remove",apirole,interaction.user,interaction.channel,interaction.guild,new Date())
}) }else {
}else if (mode == "remove"){
option.roles.forEach((role) => {
interaction.guild.members.cache.find(u => u.id == user.id).roles.remove(role) interaction.guild.members.cache.find(u => u.id == user.id).roles.remove(role)
log("system","removed role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}]) log("system","removed role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}])
const apirole = interaction.guild.roles.cache.find(r => r.id == role) const apirole = interaction.guild.roles.cache.find(r => r.id == role)
APIEvents.onReactionRole("remove","remove",apirole,interaction.user,interaction.channel,interaction.guild,new Date()) APIEvents.onReactionRole("remove","add&remove",apirole,interaction.user,interaction.channel,interaction.guild,new Date())
}) }
})
}else if (mode == "add&remove"){
option.roles.forEach((role) => {
if (interaction.guild.members.cache.find(u => u.id == user.id).roles.cache.has(role)){
interaction.guild.members.cache.find(u => u.id == user.id).roles.remove(role)
log("system","added role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}])
const apirole = interaction.guild.roles.cache.find(r => r.id == role)
APIEvents.onReactionRole("add","add&remove",apirole,interaction.user,interaction.channel,interaction.guild,new Date())
}else {
interaction.guild.members.cache.find(u => u.id == user.id).roles.add(role)
log("system","removed role (reaction roles)",[{key:"user",value:interaction.user.tag},{key:"role",value:role}])
const apirole = interaction.guild.roles.cache.find(r => r.id == role)
APIEvents.onReactionRole("remove","add&remove",apirole,interaction.user,interaction.channel,interaction.guild,new Date())
}
})
}
}catch{
interaction.channel.send({embeds:[bot.errorLog.serverError(l.errors.somethingWentWrong)]})
} }
}catch{
interaction.channel.send({embeds:[bot.errorLog.serverError(l.errors.somethingWentWrong)]})
} }
}) })
} }
+88
View File
@@ -0,0 +1,88 @@
const discord = require("discord.js")
const bot = require("../../index")
const client = require("../../index").client
const config = bot.config
const configParser = require("../utils/configParser")
const act = discord.ApplicationCommandType
const acot = discord.ApplicationCommandOptionType
module.exports = async () => {
bot.errorLog.log("info","auto-updating slash commands...")
const sid = config.server_id
const ids = configParser.getTicketValuesArray("id")
/**@type {[{name:String,value:String}]} */
var choices = []
ids.forEach((id) => {
const option = configParser.getTicketById(id)
if (option){
choices.push({name:option.name,value:option.id})
}
})
/**@type {[{name:String,value:String}]} */
var msgchoices = []
config.messages.forEach((msg) => {
msgchoices.push({name:msg.id,value:msg.id})
})
//slashtranslation
const ST = require("../../language/slashcmds/slash.json").data
//create a ticket (/new or /ticket)
client.application.commands.create({
name:"ticket",
description:"Create a ticket!",
descriptionLocalizations:ST.newticket,
defaultPermission:true,
type:act.ChatInput,
options:[
{
type:acot.String,
name:"type",
description:"The type of ticket.",
required:true,
choices:choices
}
]
},sid)
client.application.commands.create({
name:"new",
description:"Create a ticket!",
defaultPermission:true,
type:act.ChatInput,
descriptionLocalizations:ST.newticket,
options:[
{
type:acot.String,
name:"type",
description:"The type of ticket.",
required:true,
choices:choices
}
]
},sid)
//msg
client.application.commands.create({
name:"message",
description:"Create a ticket message.",
defaultPermission:true,
descriptionLocalizations:ST.message,
type:act.ChatInput,
options:[
{
type:acot.String,
name:"id",
description:"The message id.",
required:true,
choices:msgchoices,
max_length:30
}
]
},sid)
}
+2
View File
@@ -34,6 +34,8 @@ module.exports = async () => {
process.stdout.cursorTo(0) process.stdout.cursorTo(0)
process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 12")+" commands ready! (this can take up to 40 seconds)") process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 12")+" commands ready! (this can take up to 40 seconds)")
if (readystats >= 12){ if (readystats >= 12){
const fs = require("fs")
fs.writeFileSync("./storage/slashcmdEnabled.txt","true")
console.log(chalk.green("\nready!")) console.log(chalk.green("\nready!"))
console.log(chalk.blue("you can now start the bot with "+chalk.bgBlue("'npm start'")+"!")) console.log(chalk.blue("you can now start the bot with "+chalk.bgBlue("'npm start'")+"!"))
process.exit(1) process.exit(1)
+49 -41
View File
@@ -22,7 +22,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
const guild = channel.guild const guild = channel.guild
const user = member.user const user = member.user
const chalk = await (await import("chalk")).default const chalk = await (await import("chalk")).default
const channelmessages = await channel.messages.fetch()
const newReason = reason ? reason : l.messages.none const newReason = reason ? reason : l.messages.none
@@ -31,9 +30,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
//FIX CHANNEL COULD BE CLOSED AFTER DELETE: //FIX CHANNEL COULD BE CLOSED AFTER DELETE:
if (pendingDelete.includes(channel.id)) return false if (pendingDelete.includes(channel.id)) return false
//remove ot bot from transcript
channelmessages.sweep((msgSweep) => {return msgSweep.author.id == client.user.id})
/**@type {String}*/ /**@type {String}*/
const channelname = channel.name const channelname = channel.name
const ticketOpenerChannelName = channelname.split(prefix)[1] const ticketOpenerChannelName = channelname.split(prefix)[1]
@@ -293,53 +289,65 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
} }
if (enableTranscript == true && mode != "deletenotranscript"){ const transcriptHandler = async () => {
if (enableTranscript == true && mode != "deletenotranscript"){
//transcript messages
const transcriptReason = (mode == "close") ? "**"+l.messages.reason+":** "+newReason : "**"+l.messages.reason+":** "+l.messages.none
const closedByPrefix = (mode.startsWith("delete")) ? l.messages.deletedby : l.messages.closedby
const transcriptReason = (mode == "close") ? "**"+l.messages.reason+":** "+newReason : "**"+l.messages.reason+":** "+l.messages.none if (config.system.enable_transcript || config.system.enable_DM_transcript){
const closedByPrefix = (mode.startsWith("delete")) ? l.messages.deletedby : l.messages.closedby const channelmessages = await channel.messages.fetch({cache:true})
//remove ot bot from transcript
channelmessages.sweep((msgSweep) => {return msgSweep.author.id == client.user.id})
if (config.system.enable_transcript || config.system.enable_DM_transcript){ var fileattachment = await require("../transcript").createTranscript(channelmessages,channel)
var fileattachment = await require("../transcript").createTranscript(channelmessages,channel)
if (fileattachment == false){log("system","internal error: transcript is not created!");return} if (fileattachment == false){log("system","internal error: transcript is not created!");return}
} }
if (config.system.enable_transcript && !require("../api/api.json").disable.transcripts.server){ if (config.system.enable_transcript && !require("../api/api.json").disable.transcripts.server){
const transcriptEmbed = new discord.EmbedBuilder() const transcriptEmbed = new discord.EmbedBuilder()
.setColor(config.main_color) .setColor(config.main_color)
.setTitle("📄 "+l.messages.newTranscriptTitle) .setTitle("📄 "+l.messages.newTranscriptTitle)
.setDescription(transcriptReason) .setDescription(transcriptReason)
.setFooter({text:closedByPrefix+": "+user.tag+" | ticket: "+channelname,iconURL:user.displayAvatarURL()}) .setFooter({text:closedByPrefix+": "+user.tag+" | ticket: "+channelname,iconURL:user.displayAvatarURL()})
guild.channels.cache.find(c => c.id == config.system.transcript_channel).send({ guild.channels.cache.find(c => c.id == config.system.transcript_channel).send({
embeds:[transcriptEmbed], embeds:[transcriptEmbed],
files:[fileattachment] files:[fileattachment]
}) })
} }
if (config.system.enable_DM_transcript && !require("../api/api.json").disable.transcripts.dm){ if (config.system.enable_DM_transcript && !require("../api/api.json").disable.transcripts.dm){
const transcriptEmbed = new discord.EmbedBuilder() const transcriptEmbed = new discord.EmbedBuilder()
.setColor(config.main_color) .setColor(config.main_color)
.setTitle("📄 "+l.messages.newTranscriptTitle) .setTitle("📄 "+l.messages.newTranscriptTitle)
.setDescription(transcriptReason) .setDescription(transcriptReason)
.setFooter({text:closedByPrefix+": "+user.tag+" | ticket: "+channelname,iconURL:user.displayAvatarURL()}) .setFooter({text:closedByPrefix+": "+user.tag+" | ticket: "+channelname,iconURL:user.displayAvatarURL()})
if (!isDatabaseError) ticketOpener.send({ if (!isDatabaseError) ticketOpener.send({
embeds:[transcriptEmbed], embeds:[transcriptEmbed],
files:[fileattachment] files:[fileattachment]
}) })
}
} }
} }
const deleteHandler = async () => {
if (deleteRequired){
//const timer = () => {return new Promise((resolve,reject) => {
// setTimeout(() => {resolve(true)},7000)
//})}
//await timer()
if (deleteRequired){
//const timer = () => {return new Promise((resolve,reject) => {
// setTimeout(() => {resolve(true)},7000)
//})}
//await timer()
setTimeout(async () => {
pendingDelete.shift() pendingDelete.shift()
await channel.delete() await channel.delete()
},6000)
//setTimeout(async () => {
// pendingDelete.shift()
// await channel.delete()
//},6000)
}
} }
await transcriptHandler()
deleteHandler()
} }
+12 -6
View File
@@ -11,9 +11,11 @@ const storage = bot.storage
module.exports = () => { module.exports = () => {
//dropdown placeholder //dropdown placeholder
client.on("interactionCreate",(interaction) => { client.on("interactionCreate",(interaction) => {
if (!interaction.isSelectMenu()) return if (!interaction.isStringSelectMenu()) return
if (interaction.customId != "OTdropdownMenu") return if (interaction.customId != "OTdropdownMenu") return
if (interaction.values.includes("OTChooseTicket")) interaction.deferUpdate() if (interaction.values.includes("OTChooseTicket")){
interaction.deferUpdate()
}
}) })
@@ -26,7 +28,7 @@ module.exports = () => {
var customId = "OTnewT"+interaction.options.getString("type") var customId = "OTnewT"+interaction.options.getString("type")
}else if (interaction.isButton()){ }else if (interaction.isButton()){
var customId = interaction.customId var customId = interaction.customId
}else if (interaction.isSelectMenu() && (interaction.customId == "OTdropdownMenu")){ }else if (interaction.isStringSelectMenu() && (interaction.customId == "OTdropdownMenu")){
var customId = interaction.values[0] var customId = interaction.values[0]
}else return }else return
@@ -50,11 +52,15 @@ module.exports = () => {
if (currentTicketOptions == false) return interaction.reply({embeds:[bot.errorLog.serverError(l.errors.anotherOption)]}) if (currentTicketOptions == false) return interaction.reply({embeds:[bot.errorLog.serverError(l.errors.anotherOption)]})
if (interaction.isButton()){ if (interaction.isButton()){
interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
}else if (interaction.isChatInputCommand()){ }else if (interaction.isChatInputCommand()){
interaction.reply({embeds:[bot.errorLog.success(l.messages.createdTitle,l.messages.createdDescription)]}) interaction.reply({embeds:[bot.errorLog.success(l.messages.createdTitle,l.messages.createdDescription)]})
}else if (interaction.isSelectMenu()){ }else if (interaction.isStringSelectMenu()){
await interaction.deferUpdate() try {
interaction.deferUpdate()
} catch{}
} }
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){ 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){
+1 -1
View File
@@ -16,7 +16,7 @@ const l = bot.language
//OTConfigMessage //OTConfigMessage
/**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableThumbnail: boolean, thumbnail: string, enableCustomColor: boolean, color: string, options: string[], enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean}} OTConfigMessage*/ /**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableThumbnail: boolean, thumbnail: string, enableCustomColor: boolean, color: string, options: string[], other:{enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean, customDropdownPlaceholder:{enable:Boolean,text:String}, customCategoryText:{enable:Boolean,text:String}, embedTitleURL:{enable:Boolean,url:String} } }} OTConfigMessage*/
//StringOptions //StringOptions
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"closedCategory"} OTTicketStringOptions */ /**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"closedCategory"} OTTicketStringOptions */
+22 -5
View File
@@ -7,24 +7,26 @@ const configParser = require("./configParser")
/** /**
* *
* @param {String[]} ids * @param {String[]} ids
* @returns {discord.SelectMenuBuilder|false} * @param {String|undefined|false} placeholder
* @returns {discord.StringSelectMenuBuilder|false}
*/ */
exports.getDropdown = (ids) => { exports.getDropdown = (ids,placeholder) => {
const dropdown = new discord.SelectMenuBuilder() const dropdown = new discord.StringSelectMenuBuilder()
.setCustomId("OTdropdownMenu") .setCustomId("OTdropdownMenu")
.setDisabled(false) .setDisabled(false)
.setMaxValues(1) .setMaxValues(1)
.setMinValues(1) .setMinValues(1)
.setPlaceholder(l.messages.chooseATicket) .setPlaceholder(placeholder || l.messages.chooseATicket)
.addOptions( .addOptions(
new discord.SelectMenuOptionBuilder() new discord.SelectMenuOptionBuilder()
.setDefault(true) .setDefault(true)
.setLabel(l.messages.chooseATicket) .setLabel(placeholder || l.messages.chooseATicket)
.setValue("OTChooseTicket") .setValue("OTChooseTicket")
) )
ids.forEach((id) => { ids.forEach((id) => {
const option = configParser.getTicketById(id,true) const option = configParser.getTicketById(id,true)
const roleoption = configParser.getRoleById(id,true)
if (option){ if (option){
const selectComponent = new discord.SelectMenuOptionBuilder() const selectComponent = new discord.SelectMenuOptionBuilder()
.setDefault(false) .setDefault(false)
@@ -37,8 +39,23 @@ exports.getDropdown = (ids) => {
if (option.icon) selectComponent.setEmoji(option.icon) if (option.icon) selectComponent.setEmoji(option.icon)
} }
dropdown.addOptions(selectComponent)
}else if (roleoption){
const selectComponent = new discord.SelectMenuOptionBuilder()
.setDefault(false)
.setValue("OTnewR"+roleoption.id)
if (!roleoption.label && !roleoption.icon){
selectComponent.setLabel("OT ERROR: no description/emoji")
}else{
if (roleoption.label) selectComponent.setLabel(roleoption.label)
if (roleoption.icon) selectComponent.setEmoji(roleoption.icon)
}
dropdown.addOptions(selectComponent) dropdown.addOptions(selectComponent)
} }
}) })
+8 -4
View File
@@ -43,9 +43,12 @@ exports.createEmbed = (id) => {
embed.setColor(config.main_color) embed.setColor(config.main_color)
} }
if (data.other.embedTitleURL.enable) embed.setURL(data.other.embedTitleURL)
var description = data.description var description = data.description
if (data.enableTicketExplaination){ if (data.other.enableTicketExplaination){
description = description+"\n\n__"+l.messages.chooseCategory+"__\n" const chooseCategoryMSG = data.other.customCategoryText.enable ? data.other.customCategoryText.text : l.messages.chooseCategory
description = description+"\n\n__"+chooseCategoryMSG+"__\n"
var ticketExplainations = [] var ticketExplainations = []
buttonData.forEach((button) => { buttonData.forEach((button) => {
@@ -56,7 +59,7 @@ exports.createEmbed = (id) => {
description = description+ticketExplainations.join("\n\n") description = description+ticketExplainations.join("\n\n")
} }
if (data.enableMaxTicketsWarning){ if (data.other.enableMaxTicketsWarning){
description = description+"\n\n"+l.commands.maxTicketWarning.replace("{0}",config.system.max_allowed_tickets) description = description+"\n\n"+l.commands.maxTicketWarning.replace("{0}",config.system.max_allowed_tickets)
} }
@@ -92,7 +95,8 @@ exports.createEmbed = (id) => {
//create the component IF DROPDOWN is true //create the component IF DROPDOWN is true
}else{ }else{
const ids = data.options const ids = data.options
const dropdown = require("./getDropdown").getDropdown(ids) const customPlaceholder = data.other.customDropdownPlaceholder.enable ? data.other.customDropdownPlaceholder.text : false
const dropdown = require("./getDropdown").getDropdown(ids,customPlaceholder)
var componentRows = [ var componentRows = [
new discord.ActionRowBuilder() new discord.ActionRowBuilder()
.setComponents(dropdown) .setComponents(dropdown)
+24 -3
View File
@@ -124,9 +124,19 @@ client.on('ready',async () => {
setStatus(config.status.type,config.status.text) setStatus(config.status.type,config.status.text)
} }
if (fs.existsSync("./storage/slashcmdEnabled.txt")){
/**@type {"true"|"false"} */
const data = fs.readFileSync("./storage/slashcmdEnabled.txt").toString()
if (data === "true"){require("./core/slashSystem/autoSlashUpdate")()}
}else{fs.writeFileSync("./storage/slashcmdEnabled.txt","false")}
log("system","bot logged in!") log("system","bot logged in!")
await client.guilds.cache.find((g) => g.id == config.server_id).members.fetch() try {
await client.guilds.cache.find((g) => g.id == config.server_id).members.fetch()
}catch{
this.errorLog.log("info","tried to cache user information, failed!")
}
return return
} }
@@ -146,10 +156,19 @@ client.on('ready',async () => {
if (config.status.enabled){ if (config.status.enabled){
setStatus(config.status.type,config.status.text) setStatus(config.status.type,config.status.text)
} }
if (fs.existsSync("./storage/slashcmdEnabled.txt")){
/**@type {"true"|"false"} */
const data = fs.readFileSync("./storage/slashcmdEnabled.txt").toString()
if (data === "true"){require("./core/slashSystem/autoSlashUpdate")()}
}else{fs.writeFileSync("./storage/slashcmdEnabled.txt","false")}
log("system","bot logged in!") log("system","bot logged in!")
await client.guilds.cache.find((g) => g.id == config.server_id).members.fetch() try {
await client.guilds.cache.find((g) => g.id == config.server_id).members.fetch()
}catch{
this.errorLog.log("info","tried to cache user information, failed!")
}
}else{ }else{
console.log(chalk.red("STARTING IN ")+chalk.blue("SLASH MODE")+chalk.red("...")) console.log(chalk.red("STARTING IN ")+chalk.blue("SLASH MODE")+chalk.red("..."))
this.errorLog.log("debug","slashmode activated") this.errorLog.log("debug","slashmode activated")
@@ -163,7 +182,7 @@ client.on('ready',async () => {
console.log(chalk.green("switching to slashDisable.js")) console.log(chalk.green("switching to slashDisable.js"))
require("./core/slashSystem/slashDisable")() require("./core/slashSystem/slashDisable")()
}else{ }else{
console.log(chalk.red("Internal Error: unknown slash mode!")) console.log(chalk.red("[SLASH CMD MANAGER]: unknown slash mode!"))
process.exit(1) process.exit(1)
} }
} }
@@ -214,12 +233,14 @@ const debugLog = (debugString) => {
const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n==========================" const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="
fs.writeFileSync("./openticketdebug.txt",content+"\nDEBUG: "+debugString) fs.writeFileSync("./openticketdebug.txt",content+"\nDEBUG: "+debugString)
} }
this.errorLog.clearDebugFile()
} }
const errorLog = (errorString,stack) => { const errorLog = (errorString,stack) => {
if (!APIConfig.disable.debug.all){ if (!APIConfig.disable.debug.all){
const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n==========================" const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="
fs.writeFileSync("./openticketdebug.txt",content+"\nERROR: "+errorString+" STACK: "+stack) fs.writeFileSync("./openticketdebug.txt",content+"\nERROR: "+errorString+" STACK: "+stack)
} }
this.errorLog.clearDebugFile()
} }
this.errorLog.log("debug","OT error system loaded successfully") this.errorLog.log("debug","OT error system loaded successfully")
+23 -20
View File
@@ -3,8 +3,7 @@
"missingArgsTitle":"Ungültiges Argument!", "missingArgsTitle":"Ungültiges Argument!",
"missingArgsDescription":"Fehlendes Argument!", "missingArgsDescription":"Fehlendes Argument!",
"noPermsTitle":"Du hast keine Rechte!", "noPermsTitle":"Du hast keine Rechte!",
"noPermsDescription":"You need the `ADMINISTRATOR` permission or be in the list of allowed roles!", "noPermsDescription":"Sie haben nicht die richtigen Rollen, um diesen Befehl auszuführen!\nSie benötigen die `ADMINISTRATOR` Erlaubnis oder in der Liste der erlaubten Rollen sein!",
"noPermsDelete":"Only admins can delete a ticket!",
"chooseFromListTitle":"Ungültige ID", "chooseFromListTitle":"Ungültige ID",
"chooseFromListDescription":"Wählen Sie eine der folgenden ID:", "chooseFromListDescription":"Wählen Sie eine der folgenden ID:",
"boterror":"Bot Fehler!", "boterror":"Bot Fehler!",
@@ -15,24 +14,30 @@
"anotherOption":"Diese Option ist kein Ticket, sondern eine andere Art!", "anotherOption":"Diese Option ist kein Ticket, sondern eine andere Art!",
"maxAmountTitle":"Das Limit wurde erreicht!", "maxAmountTitle":"Das Limit wurde erreicht!",
"maxAmountDescription":"Sie haben die maximal zulässige Anzahl von Tickets erreicht!\nSie können also keine neue erstellen.!", "maxAmountDescription":"Sie haben die maximal zulässige Anzahl von Tickets erreicht!\nSie können also keine neue erstellen.!",
"somethingWentWrong":"**Etwas ist schief gelaufen!**\nBitte versuchen Sie es ein anderes Mal!", "somethingWentWrong":"Etwas ist schief gelaufen!**\nBitte versuchen Sie es ein anderes Mal!",
"somethingWentWrongTranscript":"Bei der Erstellung der Transcript ist etwas schief gelaufen!**\nBitte versuchen Sie es ein anderes Mal!" "somethingWentWrongTranscript":"Bei der Erstellung der Transcript ist etwas schief gelaufen!**\nBitte versuchen Sie es ein anderes Mal!"
}, },
"commands":{ "commands":{
"userAddedTitle":"Added {0} to this ticket!", "userAddedTitle":"User geaddet!",
"userRemovedTitle":"Removed {0} from this ticket!", "userAddedDescription":"{0} wird zu diesem Ticket hinzugefügt!",
"renameTitle":"Changed the name to {0}!", "userRemovedTitle":"User entfernt!",
"closeTitle":"Closed this ticket!", "userRemovedDescription":"{0} wird aus diesem Ticket entfernt!",
"deleteTitle":"Deleting this ticket...",
"reopenTitle":"Re-Opened this ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"The embed is in the message below!", "renameTitle":"Der Name wurde geändert!",
"maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_" "renameWarning":"Achtung: Sie können den Kanalnamen nur 2 Mal pro Minute ändern!\n(dies ist auf die Begrenzung der Diskordrate zurückzuführen)",
"closeTitle":"Dieses Ticket schließen!",
"closeDescription":"Sie können dieses Ticket schließen, indem Sie auf die Schaltfläche unten klicken!",
"deleteTitle":"Löschen Sie dieses Ticket!",
"deleteDescription":"Sie können dieses Ticket löschen, indem Sie auf die Schaltfläche unten klicken!",
"reopenTitle":"Öffne dieses Ticket erneut!",
"reopenDescription":"Sie können dieses Ticket erneut öffnen, indem Sie auf die Schaltfläche unten klicken!",
"ticketWarning":"Die Einbettung befindet sich in der Nachricht unten!",
"maxTicketWarning":"**Warnung:** _Sie können nur {0} ticket(s) erstellen zu einer Zeit!_"
}, },
"helpMenu":{ "helpMenu":{
"title":"Available Commands:", "title":"Hilfe Menu:",
"header1":"**Gehe zu {0} um ein Ticket zu erstellen!**\n\n", "header1":"**Gehe zu {0} um ein Ticket zu erstellen!**\n\n",
"header2":"**Führen Sie den Befehl `/new` oder `/ticket` um ein Ticket zu erstellen!**\n\n", "header2":"**Führen Sie den Befehl `/new` oder `/ticket` um ein Ticket zu erstellen!**\n\n",
@@ -64,20 +69,18 @@
"deletedTicketDmTitle":"Ticket löschen!", "deletedTicketDmTitle":"Ticket löschen!",
"closedTicketDmDescription":"Ihr Ticket ist geschlossen!", "closedTicketDmDescription":"Ihr Ticket ist geschlossen!",
"deletedTicketDmDescription":"Ihr Ticket ist gelöscht!", "deletedTicketDmDescription":"Ihr Ticket ist gelöscht!",
"reopenTicketDmTitle":"Ticket neu Eröffnen!",
"reopenTicketDmDescription":"Dein Ticket ist Neu eröffnet!",
"newTranscriptTitle":"Eine neue Transscript finden Sie hier!", "newTranscriptTitle":"Eine neue Transscript finden Sie hier!",
"newTranscriptDescription":"Die Abschrift finden Sie in der obigen Textdatei!",
"hereIsTheTranscript":"Hier ist das Transscript:", "hereIsTheTranscript":"Hier ist das Transscript:",
"chooseCategory":"Wähle eine Kategorie:", "chooseCategory":"Wähle eine Kategorie:",
"gettingdeleted":"Ticket wird gelöscht...",
"none":"none", "none":"keiner",
"reason":"reason", "reason":"Grund",
"deletedby":"Gelöscht von", "deletedby":"Gelöscht von",
"closedby":"Geschlossen von", "closedby":"Geschlossen von",
"modalreason":"Was ist der Grund für das schließen des Tickets?", "modalreason":"Was ist der Grund?",
"chooseATicket": "Wähle ein Ticket" "chooseATicket": "Wähle ein Ticket"
} }
} }
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "open-ticket", "name": "open-ticket",
"version": "3.0.0", "version": "3.1.0",
"description": "This is an open-source discord ticket bot, you can configure it and it comes with cool features like a transcript.", "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", "main": "index.js",
"scripts": { "scripts": {
@@ -15,7 +15,7 @@
"dependencies": { "dependencies": {
"axios": "^0.27.2", "axios": "^0.27.2",
"chalk": "^5.0.1", "chalk": "^5.0.1",
"discord.js": "^14.0.2", "discord.js": "^14.7.1",
"express": "^4.17.1", "express": "^4.17.1",
"node": "^16.10.0", "node": "^16.10.0",
"node-localstorage": "^2.2.1" "node-localstorage": "^2.2.1"
BIN
View File
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
This file is only here to make sure that this directory exists!
I don't have any other use :)