Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af35f83291 | ||
|
|
39fec94ead | ||
|
|
1b8468330e | ||
|
|
b698c89a89 | ||
|
|
7ed2d7bcc7 | ||
|
|
f2ddaa5fd4 | ||
|
|
fc50a8e83f | ||
|
|
5bece3357d | ||
|
|
97d1489558 | ||
|
|
a211cef1f6 | ||
|
|
ae002e168b | ||
|
|
86a5a1a2ca |
+5
-1
@@ -10,7 +10,11 @@ devConfig5.json
|
||||
openticketdebug.txt
|
||||
developerChangelog.md
|
||||
storage/dynamicDB/
|
||||
storage/slashcmdEnabled.txt
|
||||
storage/database.json
|
||||
storage/tsdatabase.json
|
||||
storage/.DS_Store
|
||||
.vscode/
|
||||
livestatus.json
|
||||
test.js
|
||||
test.js
|
||||
testtsconfig.json
|
||||
@@ -1,5 +1,5 @@
|
||||
# Open Ticket
|
||||
[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/DJj123dj/open-ticket/releases/tag/v3.0.1) []() [](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [](https://docs.openticket.dj-dj.be)
|
||||
[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/DJj123dj/open-ticket/releases/tag/v3.2.0) []() [](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [](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!
|
||||
Start using it now, you can do anything!
|
||||
@@ -15,16 +15,18 @@ Start using it now, you can do anything!
|
||||
- Sanke: for translation & new ideas
|
||||
- Everyone that reported a bug
|
||||
#### And our translators!
|
||||
- ExothDE
|
||||
- 1x1
|
||||
- Redactado
|
||||
- t0miiis
|
||||
- josuens14
|
||||
- M4
|
||||
- David.
|
||||
- Maurizio
|
||||
- Sanke#6086 (Romanian & French)
|
||||
- Redactado#1673 (Spanish)
|
||||
- t0miiis#3022 (Czech)
|
||||
- josuens14 (Spanish)
|
||||
- M4#5882 (Arabic)
|
||||
- ChilledBroke#9986 (Arabic)
|
||||
- David.#0187 (German)
|
||||
- Maurizio#0268 (Italian)
|
||||
- the_gamer#5095 (Danish)
|
||||
|
||||
## features
|
||||
- **🎉 NEW! html transcripts!**
|
||||
- discord interaction buttons
|
||||
- slash & text commands
|
||||
- close, delete & re-open tickets
|
||||
@@ -39,9 +41,6 @@ Start using it now, you can do anything!
|
||||
- custom API + plugins
|
||||
- unlimited tickets spread over multiple messages
|
||||
- close with reason
|
||||
|
||||
*comming soon*
|
||||
- share transcripts
|
||||
- view transcripts in html
|
||||
|
||||
## quick start
|
||||
@@ -52,7 +51,7 @@ Start using it now, you can do anything!
|
||||
|
||||
## information
|
||||
|
||||
_v3.0.1_
|
||||
_v3.2.0_
|
||||
|
||||
changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog)
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
const discord = require('discord.js')
|
||||
const bot = require('../index')
|
||||
const client = bot.client
|
||||
const config = bot.config
|
||||
const log = bot.errorLog.log
|
||||
const l = bot.language
|
||||
const permsChecker = require("../core/utils/permisssionChecker")
|
||||
|
||||
const APIEvents = require("../core/api/modules/events")
|
||||
const DISABLE = require("../core/api/api.json").disable
|
||||
|
||||
module.exports = () => {
|
||||
bot.errorLog.log("debug","COMMANDS: loaded change.js")
|
||||
|
||||
if (!DISABLE.commands.text.change) client.on("messageCreate",msg => {
|
||||
if (!msg.content.startsWith(config.prefix+"change")) return
|
||||
|
||||
if (!msg.guild) return
|
||||
if (!permsChecker.command(msg.author.id,msg.guild.id)){
|
||||
permsChecker.sendUserNoPerms(msg.author)
|
||||
return
|
||||
}
|
||||
|
||||
msg.channel.messages.fetchPinned().then(msglist => {
|
||||
var firstmsg = msglist.last()
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]})
|
||||
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
|
||||
const ticketId = hiddendata.data.find(d => d.key == "type").value
|
||||
|
||||
var newtype = msg.content.split(config.prefix+"change")[1].substring(1)
|
||||
if (!newtype) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<type>`:\n`"+config.prefix+"change <type>`")]})
|
||||
|
||||
const newTicket = require("../core/utils/configParser").getTicketById(newtype)
|
||||
const list = []
|
||||
config.options.forEach((o) => list.push(o.id))
|
||||
if (!newTicket) return bot.errorLog.invalidIdChooseFromList(list)
|
||||
|
||||
/**@type {String} */
|
||||
var chName = msg.channel.name
|
||||
const splitted = chName.split("-")
|
||||
const prefix = splitted.shift()
|
||||
const name = (splitted.length > 0) ? splitted.join("-") : prefix
|
||||
|
||||
|
||||
msg.channel.setName(newTicket.channelprefix+name)
|
||||
msg.channel.send({embeds:[bot.embeds.commands.changeEmbed(msg.author,newtype)]})
|
||||
|
||||
log("command","someone used the 'change' command",[{key:"user",value:msg.author.tag}])
|
||||
log("system","ticket type changed",[{key:"user",value:msg.author.tag},{key:"ticket",value:name},{key:"newtype",value:newtype}])
|
||||
APIEvents.onCommand("change",permsChecker.command(msg.author.id,msg.guild.id),msg.author,msg.channel,msg.guild,new Date())
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
if (!DISABLE.commands.slash.change) client.on("interactionCreate",(interaction) => {
|
||||
if (!interaction.isChatInputCommand()) return
|
||||
if (interaction.commandName != "change") return
|
||||
|
||||
if (!interaction.guild) return
|
||||
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
|
||||
permsChecker.sendUserNoPerms(interaction.user)
|
||||
return
|
||||
}
|
||||
|
||||
//interaction.deferReply()
|
||||
interaction.channel.messages.fetchPinned().then(msglist => {
|
||||
var firstmsg = msglist.last()
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
|
||||
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
|
||||
const ticketId = hiddendata.data.find(d => d.key == "type").value
|
||||
|
||||
console.log("HELLO WORLD!! 1")
|
||||
var newtype = interaction.options.getString("type",true)
|
||||
if (!newtype) return interaction.reply({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<type>`:\n`"+config.prefix+"change <type>`")]})
|
||||
|
||||
console.log("HELLO WORLD!! 2")
|
||||
const newTicket = require("../core/utils/configParser").getTicketById(newtype,true)
|
||||
const list = []
|
||||
config.options.forEach((o) => list.push(o.id))
|
||||
if (!newTicket) return bot.errorLog.invalidIdChooseFromList(list)
|
||||
|
||||
console.log("HELLO WORLD!! 3")
|
||||
/**@type {String} */
|
||||
var chName = interaction.channel.name
|
||||
const splitted = chName.split("-")
|
||||
const prefix = splitted.shift()
|
||||
const name = (splitted.length > 0) ? splitted.join("-") : prefix
|
||||
|
||||
console.log("HELLO WORLD!! 4")
|
||||
|
||||
interaction.channel.setName(newTicket.channelprefix+name)
|
||||
interaction.reply({embeds:[bot.embeds.commands.changeEmbed(interaction.user,newtype)]})
|
||||
|
||||
console.log("HELLO WORLD!! 5")
|
||||
log("command","someone used the 'change' command",[{key:"user",value:interaction.user.tag}])
|
||||
log("system","ticket type changed",[{key:"user",value:interaction.user.tag},{key:"ticket",value:name},{key:"newtype",value:newtype}])
|
||||
APIEvents.onCommand("change",permsChecker.command(interaction.user.id,interaction.guild.id),interaction.user,interaction.channel,interaction.guild,new Date())
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -21,8 +21,6 @@ module.exports = () => {
|
||||
const header = config.system.ticket_channel ? l.helpMenu.header1.replace("{0}","<#"+config.system.ticket_channel+">") : l.helpMenu.header2
|
||||
helpEmbed.setDescription(header+"`"+prefix+msgName+" <id>` ➜ _"+l.helpMenu.msgCmd+"_\n\n`"+prefix+"rename <name>` ➜ _"+l.helpMenu.renameCmd+"_\n`"+prefix+"close` ➜ _"+l.helpMenu.closeCmd+"_\n`"+prefix+"delete` ➜ _"+l.helpMenu.deleteCmd+"_\n`"+prefix+"reopen` ➜ _"+l.helpMenu.reopenCmd+"_\n\n`"+prefix+"add <user>` ➜ _"+l.helpMenu.addCmd+"_\n`"+prefix+"remove <user>` ➜ _"+l.helpMenu.removeCmd+"_")
|
||||
|
||||
if (config.credits) helpEmbed.setFooter({text:"Open-Ticket by DJdj Development | view on github for source code",iconURL:"https://raw.githubusercontent.com/DJj123dj/open-ticket/main/logo.png"})
|
||||
|
||||
var otherprefix = prefix.endsWith(" ") ? prefix.substring(0,prefix.length-1) : prefix
|
||||
|
||||
if (!DISABLE.commands.text.help) client.on("messageCreate",msg => {
|
||||
|
||||
+20
-7
@@ -6,7 +6,6 @@
|
||||
"prefix":"!ticket ",
|
||||
"languagefile":"english",
|
||||
|
||||
"credits":true,
|
||||
"status":{
|
||||
"enabled":true,
|
||||
"type":"PLAYING",
|
||||
@@ -22,9 +21,7 @@
|
||||
"member_role":"member role (doesn't have access to tickets)",
|
||||
"closeMode":"adminonly|normal",
|
||||
|
||||
"enable_transcript":false,
|
||||
"enable_DM_transcript":false,
|
||||
"transcript_channel":"channel id",
|
||||
"transcripts":"!!!! ALL SETTINGS FOR TRANSCRIPTS ARE LOCATED IN: transcriptconfig.json !!!!",
|
||||
|
||||
"showSlashcmdsInHelp":false
|
||||
},
|
||||
@@ -92,7 +89,7 @@
|
||||
"dropdown":false,
|
||||
|
||||
"enableFooter":false,
|
||||
"footer":"Open Ticket v3.0.1 - I'm a footer!",
|
||||
"footer":"Open Ticket v3.2.0 - I'm a footer!",
|
||||
|
||||
"enableThumbnail":false,
|
||||
"thumbnail":"https://www.example.com/catmemes/cat.png",
|
||||
@@ -101,8 +98,24 @@
|
||||
"color":"#ffffff",
|
||||
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+4
-2
@@ -29,7 +29,8 @@
|
||||
"remove":false,
|
||||
"rename":false,
|
||||
"claim":false,
|
||||
"unclaim":false
|
||||
"unclaim":false,
|
||||
"change":false
|
||||
},
|
||||
"slash":{
|
||||
"help":false,
|
||||
@@ -42,7 +43,8 @@
|
||||
"remove":false,
|
||||
"rename":false,
|
||||
"claim":false,
|
||||
"unclaim":false
|
||||
"unclaim":false,
|
||||
"change":false
|
||||
}
|
||||
},
|
||||
"checkerjs":{
|
||||
|
||||
@@ -17,6 +17,10 @@ const ticketReopenListeners = []
|
||||
const ticketAddListeners = []
|
||||
const ticketRemoveListeners = []
|
||||
|
||||
const ticketClaimListeners = []
|
||||
const ticketUnclaimListeners = []
|
||||
const ticketChangeListeners = []
|
||||
|
||||
|
||||
const transcriptCreationListeners = []
|
||||
const commandListeners = []
|
||||
@@ -146,6 +150,66 @@ exports.onTicketRemove = (user,editeduser,channel,guild,date,ticketdata) => {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.User} user
|
||||
* @param {discord.TextChannel} channel
|
||||
* @param {discord.Guild} guild
|
||||
* @param {Date} date
|
||||
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||
*/
|
||||
exports.onTicketClaim = (user,channel,guild,date,ticketdata) => {
|
||||
//system
|
||||
bot.errorLog.log("api","user claimed a ticket",[{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
|
||||
|
||||
ticketClaimListeners.forEach((func) => {
|
||||
try {
|
||||
func(user,channel,guild,date,ticketdata)
|
||||
}catch{}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.User} user
|
||||
* @param {discord.TextChannel} channel
|
||||
* @param {discord.Guild} guild
|
||||
* @param {Date} date
|
||||
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||
*/
|
||||
exports.onTicketUnclaim = (user,channel,guild,date,ticketdata) => {
|
||||
//system
|
||||
bot.errorLog.log("api","user unclaimed a ticket",[{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
|
||||
|
||||
ticketUnclaimListeners.forEach((func) => {
|
||||
try {
|
||||
func(user,channel,guild,date,ticketdata)
|
||||
}catch{}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} newtype
|
||||
* @param {discord.User} user
|
||||
* @param {discord.TextChannel} channel
|
||||
* @param {discord.Guild} guild
|
||||
* @param {Date} date
|
||||
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||
*/
|
||||
exports.onTicketChange = (newtype,user,channel,guild,date,ticketdata) => {
|
||||
//system
|
||||
bot.errorLog.log("api","user changed ticket type",[{key:"newtype",value:newtype},{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
|
||||
|
||||
ticketChangeListeners.forEach((func) => {
|
||||
try {
|
||||
func(newtype,user,channel,guild,date,ticketdata)
|
||||
}catch{}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.Message[]} messages
|
||||
@@ -165,7 +229,7 @@ exports.onTranscriptCreation = (messages,channel,guild,date) => {
|
||||
|
||||
}
|
||||
|
||||
/**@typedef {"help"|"message"|"close"|"delete"|"reopen"|"rename"|"add"|"remove"} OTCommandType */
|
||||
/**@typedef {"help"|"message"|"close"|"delete"|"reopen"|"rename"|"add"|"remove"|"claim"|"unclaim"|"change"} OTCommandType */
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -269,6 +333,16 @@ exports.onCommand = (type,hasPerms,user,channel,guild,date) => {
|
||||
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback TicketTypeChangeEvent
|
||||
* @param {String} newtype
|
||||
* @param {discord.User} user
|
||||
* @param {discord.TextChannel} channel
|
||||
* @param {discord.Guild} guild
|
||||
* @param {Date} date
|
||||
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback CommandEvent
|
||||
* @param {OTCommandType} type
|
||||
@@ -328,6 +402,21 @@ const onTicketRemove = (callback) => {
|
||||
ticketRemoveListeners.push(callback)
|
||||
}
|
||||
|
||||
/**@param {TicketActionEvent} callback */
|
||||
const onTicketClaim = (callback) => {
|
||||
ticketClaimListeners.push(callback)
|
||||
}
|
||||
|
||||
/**@param {TicketActionEvent} callback */
|
||||
const onTicketUnclaim = (callback) => {
|
||||
ticketUnclaimListeners.push(callback)
|
||||
}
|
||||
|
||||
/**@param {TicketTypeChangeEvent} callback */
|
||||
const onTicketChange = (callback) => {
|
||||
ticketChangeListeners.push(callback)
|
||||
}
|
||||
|
||||
/**@param {TranscriptCreationEvent} callback */
|
||||
const onTranscriptCreation = (callback) => {
|
||||
transcriptCreationListeners.push(callback)
|
||||
@@ -355,6 +444,9 @@ exports.events = {
|
||||
onTicketReopen,
|
||||
onTicketAdd,
|
||||
onTicketRemove,
|
||||
onTicketClaim,
|
||||
onTicketUnclaim,
|
||||
onTicketChange,
|
||||
onTranscriptCreation,
|
||||
onCommand,
|
||||
onReactionRole,
|
||||
|
||||
+37
-11
@@ -311,10 +311,6 @@ exports.checker = async () => {
|
||||
checkHexColor(input.color,path+"/color")
|
||||
}
|
||||
|
||||
//ticket explaination & max tickets warning
|
||||
checkType(input.enableTicketExplaination,"boolean",path+"/enableTicketExplaination")
|
||||
checkType(input.enableMaxTicketsWarning,"boolean",path+"/enableMaxTicketsWarning")
|
||||
|
||||
//OPTIONS!!!
|
||||
var counter = 0
|
||||
input.options.forEach((option) => {if (!configParser.optionExists(option)){counter++}})
|
||||
@@ -328,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!")}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------|
|
||||
@@ -336,7 +368,7 @@ exports.checker = async () => {
|
||||
//--------------------------|
|
||||
//--------------------------|
|
||||
|
||||
var configArray = ["main_color","server_id","auth_token","main_adminroles","prefix","languagefile","credits","status","system","options","messages"]
|
||||
var configArray = ["main_color","server_id","auth_token","main_adminroles","prefix","languagefile","status","system","options","messages"]
|
||||
configArray.forEach((item) => {
|
||||
if (config[item] == undefined){
|
||||
throw new Error("\n\nMAIN ERROR: the item '"+item+"' doesn't exist in config.json")
|
||||
@@ -358,7 +390,6 @@ exports.checker = async () => {
|
||||
createError("'languagefile' | invalid language, more info in the wiki")
|
||||
}
|
||||
|
||||
checkType(config.credits,"boolean","credits")
|
||||
//status:
|
||||
checkType(config.status.enabled,"boolean","status/enabled")
|
||||
if (config.status.enabled){
|
||||
@@ -391,11 +422,6 @@ exports.checker = async () => {
|
||||
createError("'system/closeMode' | the close mode must be adminonly or normal")
|
||||
}
|
||||
|
||||
checkType(config.system.enable_transcript,"boolean","system/enable_transcript")
|
||||
checkType(config.system.enable_DM_transcript,"boolean","system/enable_DM_transcript")
|
||||
if (config.system.enable_transcript){
|
||||
checkDiscord("channelid",config.system.transcript_channel,"system/transcript_channel")
|
||||
}
|
||||
checkType(config.system.showSlashcmdsInHelp,"boolean","system/showSlashcmdsInHelp")
|
||||
|
||||
//options
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -36,4 +36,8 @@ exports.get = (category,id) => {
|
||||
exports.delete = (category,id) => {
|
||||
ls.removeItem(category+"--"+id)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
this.set("category","key","value")
|
||||
this.get("category","key",)
|
||||
this.delete("category","key")
|
||||
@@ -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 {
|
||||
var db = require("./dynamicfiles/local")
|
||||
}catch{
|
||||
var db = require("./dynamicfiles/database")
|
||||
}catch(err){
|
||||
console.log(err)
|
||||
console.log("I couldn't find the database file! (location: ./core/dynamicdatabase/storage.js:2)")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
@@ -25,16 +25,26 @@ exports.closeCommandRow = new arb()
|
||||
)
|
||||
.addComponents(
|
||||
new button()
|
||||
.setCustomId("OTsendTranscript")
|
||||
.setCustomId("OTreopenTicket")
|
||||
.setDisabled(false)
|
||||
.setStyle(bs.Secondary)
|
||||
.setLabel(l.buttons.sendTranscript)
|
||||
.setEmoji("📄")
|
||||
.setStyle(bs.Success)
|
||||
.setLabel(l.buttons.reopen)
|
||||
.setEmoji("✔")
|
||||
)
|
||||
|
||||
exports.closeCommandRowDisabled = new arb()
|
||||
.addComponents(
|
||||
new button()
|
||||
.setCustomId("OTdeleteTicket1")
|
||||
.setDisabled(true)
|
||||
.setStyle(bs.Danger)
|
||||
.setLabel(l.buttons.delete)
|
||||
.setEmoji("✖️")
|
||||
)
|
||||
.addComponents(
|
||||
new button()
|
||||
.setCustomId("OTreopenTicket")
|
||||
.setDisabled(false)
|
||||
.setDisabled(true)
|
||||
.setStyle(bs.Success)
|
||||
.setLabel(l.buttons.reopen)
|
||||
.setEmoji("✔")
|
||||
|
||||
@@ -136,4 +136,17 @@ exports.renameEmbed = (renamer,newname) => {
|
||||
.setDescription("Loading...")
|
||||
.setFooter({text:author.tag,iconURL:author.displayAvatarURL()})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.User} changer
|
||||
* @param {String} newtype
|
||||
* @returns {discord.EmbedBuilder}
|
||||
*/
|
||||
exports.changeEmbed = (changer,newtype) => {
|
||||
return new embed()
|
||||
.setTitle("🔄 "+l.commands.changeTitle.replace("{0}",newtype))
|
||||
.setColor(mc)
|
||||
.setFooter({text:changer.tag,iconURL:changer.displayAvatarURL()})
|
||||
}
|
||||
@@ -22,7 +22,9 @@ module.exports = () => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTcloseTicketTrue") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
|
||||
if (closeTicketButtonChecker == true) return
|
||||
closeTicketButtonChecker = true
|
||||
|
||||
@@ -50,8 +50,8 @@ module.exports = () => {
|
||||
}
|
||||
})
|
||||
|
||||
interaction.channel.send({embeds:[bot.embeds.commands.deleteEmbed(interaction.user)]})
|
||||
await interaction.message.edit({components:[bot.buttons.close.openRowDisabled]})
|
||||
await interaction.channel.send({embeds:[bot.embeds.commands.deleteEmbed(interaction.user)]})
|
||||
await require("../../../ticketActions/ticketCloser").NEWcloseTicket(interaction.member,interaction.channel,prefix,"delete",false,true)
|
||||
deleteTicketButtonChecker = false
|
||||
})
|
||||
@@ -90,8 +90,10 @@ module.exports = () => {
|
||||
}
|
||||
})
|
||||
|
||||
interaction.channel.send({embeds:[bot.embeds.commands.deleteEmbed(interaction.user)]})
|
||||
await require("../../../ticketActions/ticketCloser").NEWcloseTicket(interaction.member,interaction.channel,prefix,"deletenotranscript",false,true)
|
||||
await interaction.message.edit({components:[bot.buttons.close.closeCommandRowDisabled]})
|
||||
await interaction.channel.send({embeds:[bot.embeds.commands.deleteEmbed(interaction.user)]})
|
||||
await require("../../../ticketActions/ticketCloser").NEWcloseTicket(interaction.member,interaction.channel,prefix,"delete",false,true)
|
||||
deleteTicketButtonChecker1 = false
|
||||
|
||||
})
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
module.exports = () => {
|
||||
require("./firstmsg")()
|
||||
require("./sendTranscript")()
|
||||
require("./verifyBars")()
|
||||
|
||||
//accepted
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
const discord = require('discord.js')
|
||||
const bot = require('../../../index')
|
||||
const client = bot.client
|
||||
const config = bot.config
|
||||
const l = bot.language
|
||||
const log = bot.errorLog.log
|
||||
|
||||
const storage = bot.storage
|
||||
const hiddendata = bot.hiddenData
|
||||
const embed = discord.EmbedBuilder
|
||||
const mc = config.main_color
|
||||
|
||||
const button = discord.ButtonBuilder
|
||||
const arb = discord.ActionRowBuilder
|
||||
const bs = discord.ButtonStyle
|
||||
|
||||
|
||||
module.exports = () => {
|
||||
client.on("interactionCreate",async (interaction) => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTsendTranscript") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
const tsmsg = await interaction.channel.send({embeds:[bot.embeds.commands.sendTranscriptEmbed(false,interaction.channel,interaction.user)]})
|
||||
|
||||
const channelmessages = await interaction.channel.messages.fetch()
|
||||
|
||||
channelmessages.sweep((msgSweep) => {
|
||||
return msgSweep.author.id == client.user.id
|
||||
})
|
||||
|
||||
var fileattachment = await require("../../transcript").createTranscript(channelmessages,interaction.channel)
|
||||
|
||||
if (fileattachment == false){
|
||||
log("system","internal error: transcript is not created!")
|
||||
tsmsg.edit({embeds:[bot.errorLog.serverError(l.errors.somethingWentWrongTranscript)]})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
tsmsg.edit({embeds:[bot.embeds.commands.sendTranscriptEmbed(true,interaction.channel,interaction.user)],files:[fileattachment]})
|
||||
}catch{}
|
||||
})
|
||||
}
|
||||
@@ -20,7 +20,9 @@ module.exports = () => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTcloseTicket") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
interaction.message.edit({components:[bot.buttons.verifybars.closeVerifyBar]})
|
||||
|
||||
})
|
||||
@@ -28,7 +30,9 @@ module.exports = () => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTcloseTicketFalse") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
interaction.message.edit({components:[bot.buttons.close.openRowNormal]})
|
||||
})
|
||||
|
||||
@@ -37,7 +41,9 @@ module.exports = () => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTdeleteTicket") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
interaction.message.edit({components:[bot.buttons.verifybars.deleteVerifyBar]})
|
||||
|
||||
})
|
||||
@@ -45,7 +51,9 @@ module.exports = () => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTdeleteTicketFalse") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
interaction.message.edit({components:[bot.buttons.close.openRowNormal]})
|
||||
})
|
||||
|
||||
@@ -54,7 +62,9 @@ module.exports = () => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTdeleteTicket1") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
interaction.message.edit({components:[bot.buttons.verifybars.delete1VerifyBar]})
|
||||
|
||||
})
|
||||
@@ -62,7 +72,9 @@ module.exports = () => {
|
||||
if (!interaction.isButton()) return
|
||||
if (interaction.customId != "OTdeleteTicketFalse1") return
|
||||
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
interaction.message.edit({components:[bot.buttons.close.closeCommandRow]})
|
||||
})
|
||||
}
|
||||
@@ -16,6 +16,7 @@ else if (config.languagefile.startsWith("arabic")) localLanguage = require("../l
|
||||
else if (config.languagefile.startsWith("spanish")) localLanguage = require("../language/spanish.json")
|
||||
else if (config.languagefile.startsWith("portuguese")) localLanguage = require("../language/portuguese.json")
|
||||
else if (config.languagefile.startsWith("italian")) localLanguage = require("../language/italian.json")
|
||||
else if (config.languagefile.startsWith("danish")) localLanguage = require("../language/danish.json")
|
||||
|
||||
|
||||
const errorLog = async () => {
|
||||
|
||||
+56
-49
@@ -12,64 +12,71 @@ module.exports = async () => {
|
||||
const chalk = await (await import("chalk")).default
|
||||
|
||||
client.on("interactionCreate",(interaction) => {
|
||||
if (!interaction.isButton()) return
|
||||
if (!interaction.customId.startsWith("newR")) return
|
||||
if (!interaction.isButton() && !interaction.isStringSelectMenu()) 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
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const option = require("./utils/getButton").getOption(optionid)
|
||||
/**@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)
|
||||
|
||||
|
||||
|
||||
|
||||
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 {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const option = require("./utils/getButton").getOption(optionid)
|
||||
/**@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)
|
||||
|
||||
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) => {
|
||||
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.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.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)]})
|
||||
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)]})
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -32,8 +32,10 @@ module.exports = async () => {
|
||||
//process.stdout.write("[status] there are "+chalk.blue("0 out of 10")+" commands ready! (this can take up to 40 seconds)")
|
||||
setInterval(() => {
|
||||
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)")
|
||||
if (readystats >= 12){
|
||||
process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 13")+" commands ready! (this can take up to 40 seconds)")
|
||||
if (readystats >= 13){
|
||||
const fs = require("fs")
|
||||
fs.writeFileSync("./storage/slashcmdEnabled.txt","true")
|
||||
console.log(chalk.green("\nready!"))
|
||||
console.log(chalk.blue("you can now start the bot with "+chalk.bgBlue("'npm start'")+"!"))
|
||||
process.exit(1)
|
||||
@@ -243,4 +245,23 @@ module.exports = async () => {
|
||||
readystats++
|
||||
})
|
||||
|
||||
//category
|
||||
client.application.commands.create({
|
||||
name:"change",
|
||||
description:"Change ticket type.",
|
||||
defaultPermission:true,
|
||||
type:act.ChatInput,
|
||||
options:[
|
||||
{
|
||||
type:acot.String,
|
||||
name:"type",
|
||||
description:"The new ticket type.",
|
||||
required:true,
|
||||
choices:choices
|
||||
}
|
||||
]
|
||||
},sid).then(() => {
|
||||
readystats++
|
||||
})
|
||||
|
||||
}
|
||||
@@ -22,7 +22,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
const guild = channel.guild
|
||||
const user = member.user
|
||||
const chalk = await (await import("chalk")).default
|
||||
const channelmessages = await channel.messages.fetch()
|
||||
|
||||
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:
|
||||
if (pendingDelete.includes(channel.id)) return false
|
||||
|
||||
//remove ot bot from transcript
|
||||
channelmessages.sweep((msgSweep) => {return msgSweep.author.id == client.user.id})
|
||||
|
||||
/**@type {String}*/
|
||||
const channelname = channel.name
|
||||
const ticketOpenerChannelName = channelname.split(prefix)[1]
|
||||
@@ -53,7 +49,7 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
var enableTranscript = true
|
||||
var deleteRequired = false
|
||||
|
||||
if (mode == "delete"){
|
||||
if (mode == "delete" || mode == "deletenotranscript"){
|
||||
//delete
|
||||
//check perms
|
||||
if (!guild) return
|
||||
@@ -92,12 +88,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
|
||||
if (!id) return false
|
||||
|
||||
try{
|
||||
if (config.system.enable_DM_Messages){
|
||||
member.send({embeds:[bot.errorLog.custom(l.messages.deletedTicketDmTitle,l.messages.deletedTicketDmDescription,":ticket:",config.main_color)]})
|
||||
}
|
||||
}
|
||||
catch{log("system","can't send DM to member, member doesn't allow dm's")}
|
||||
})
|
||||
|
||||
}else if (mode == "close"){
|
||||
@@ -200,14 +190,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
.setLabel(l.buttons.delete)
|
||||
.setEmoji("✖️")
|
||||
)
|
||||
.addComponents(
|
||||
new discord.ButtonBuilder()
|
||||
.setCustomId("OTsendTranscript")
|
||||
.setDisabled(false)
|
||||
.setStyle(discord.ButtonStyle.Secondary)
|
||||
.setLabel(l.buttons.sendTranscript)
|
||||
.setEmoji("📄")
|
||||
)
|
||||
.addComponents(
|
||||
new discord.ButtonBuilder()
|
||||
.setCustomId("OTreopenTicket")
|
||||
@@ -241,105 +223,26 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
|
||||
if (!id) return false
|
||||
|
||||
try{
|
||||
if (config.system.enable_DM_Messages){
|
||||
member.send({embeds:[bot.errorLog.custom(l.messages.closedTicketDmTitle,l.messages.closedTicketDmDescription+"\n\n**reason:** "+newReason,":ticket:",config.main_color)]})
|
||||
}
|
||||
}
|
||||
catch{log("system","can't send DM to member, member doesn't allow dm's")}
|
||||
})
|
||||
|
||||
|
||||
}else if (mode == "deletenotranscript"){
|
||||
//delete with no transcript
|
||||
//check perms
|
||||
if (!guild) return
|
||||
if (!permsChecker.command(user.id,guild.id)){
|
||||
permsChecker.sendUserNoPerms(user)
|
||||
return
|
||||
}
|
||||
|
||||
//start delete proccess
|
||||
enableTranscript = false
|
||||
deleteRequired = true
|
||||
if (!nomessage){
|
||||
await channel.send({content:"**"+l.messages.gettingdeleted+"**"})
|
||||
}
|
||||
log("system","deleted a ticket",[{key:"user",value:user.tag},{key:"ticket",value:channel.name}])
|
||||
|
||||
if (!isDatabaseError) storage.set("ticketStorage",getuserID,Number(storage.get("ticketStorage",getuserID)) - 1)
|
||||
|
||||
//getID & send DM & send api event
|
||||
await channel.messages.fetchPinned().then(msglist => {
|
||||
var firstmsg = msglist.last()
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return false
|
||||
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
|
||||
const ticketId = hiddendata.data.find(d => d.key == "type").value
|
||||
const ticketData = require("../utils/configParser").getTicketById(ticketId,true)
|
||||
|
||||
require("../api/modules/events").onTicketDelete(user,channel,guild,new Date(),{name:channel.name,status:"deleted",ticketOptions:ticketData})
|
||||
|
||||
const id = hiddendata.data.find(d => d.key == "openerid").value
|
||||
|
||||
if (!id) return false
|
||||
|
||||
try{
|
||||
if (config.system.enable_DM_Messages){
|
||||
member.send({embeds:[bot.errorLog.custom(l.messages.deletedTicketDmTitle,l.messages.deletedTicketDmDescription,":ticket:",config.main_color)]})
|
||||
}
|
||||
}
|
||||
catch{log("system","can't send DM to member, member doesn't allow dm's")}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (enableTranscript == true && mode != "deletenotranscript"){
|
||||
const transcriptHandler = async () => {
|
||||
if (!bot.tsconfig.sendTranscripts.enableChannel && !bot.tsconfig.sendTranscripts.enableDM) return false
|
||||
|
||||
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
|
||||
|
||||
if (config.system.enable_transcript || config.system.enable_DM_transcript){
|
||||
var fileattachment = await require("../transcript").createTranscript(channelmessages,channel)
|
||||
|
||||
if (fileattachment == false){log("system","internal error: transcript is not created!");return}
|
||||
}
|
||||
|
||||
if (config.system.enable_transcript && !require("../api/api.json").disable.transcripts.server){
|
||||
const transcriptEmbed = new discord.EmbedBuilder()
|
||||
.setColor(config.main_color)
|
||||
.setTitle("📄 "+l.messages.newTranscriptTitle)
|
||||
.setDescription(transcriptReason)
|
||||
.setFooter({text:closedByPrefix+": "+user.tag+" | ticket: "+channelname,iconURL:user.displayAvatarURL()})
|
||||
|
||||
guild.channels.cache.find(c => c.id == config.system.transcript_channel).send({
|
||||
embeds:[transcriptEmbed],
|
||||
files:[fileattachment]
|
||||
})
|
||||
}
|
||||
|
||||
if (config.system.enable_DM_transcript && !require("../api/api.json").disable.transcripts.dm){
|
||||
const transcriptEmbed = new discord.EmbedBuilder()
|
||||
.setColor(config.main_color)
|
||||
.setTitle("📄 "+l.messages.newTranscriptTitle)
|
||||
.setDescription(transcriptReason)
|
||||
.setFooter({text:closedByPrefix+": "+user.tag+" | ticket: "+channelname,iconURL:user.displayAvatarURL()})
|
||||
|
||||
if (!isDatabaseError) ticketOpener.send({
|
||||
embeds:[transcriptEmbed],
|
||||
files:[fileattachment]
|
||||
})
|
||||
}
|
||||
const APIEvents = require("../api/modules/events")
|
||||
const messages = await channel.messages.fetch({cache:true})
|
||||
await require("../transcriptSystem/manager")(messages,guild,channel,user,reason)
|
||||
APIEvents.onTranscriptCreation(messages,channel,guild,new Date())
|
||||
}
|
||||
|
||||
if (deleteRequired){
|
||||
//const timer = () => {return new Promise((resolve,reject) => {
|
||||
// setTimeout(() => {resolve(true)},7000)
|
||||
//})}
|
||||
//await timer()
|
||||
|
||||
setTimeout(async () => {
|
||||
const deleteHandler = async () => {
|
||||
if (deleteRequired){
|
||||
pendingDelete.shift()
|
||||
await channel.delete()
|
||||
},6000)
|
||||
}
|
||||
}
|
||||
if (mode == "delete" || mode == "deletenotranscript") await transcriptHandler()
|
||||
deleteHandler()
|
||||
}
|
||||
@@ -13,7 +13,9 @@ module.exports = () => {
|
||||
client.on("interactionCreate",(interaction) => {
|
||||
if (!interaction.isStringSelectMenu()) return
|
||||
if (interaction.customId != "OTdropdownMenu") return
|
||||
if (interaction.values.includes("OTChooseTicket")) interaction.deferUpdate()
|
||||
if (interaction.values.includes("OTChooseTicket")){
|
||||
interaction.deferUpdate()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@@ -50,17 +52,21 @@ module.exports = () => {
|
||||
if (currentTicketOptions == false) return interaction.reply({embeds:[bot.errorLog.serverError(l.errors.anotherOption)]})
|
||||
|
||||
if (interaction.isButton()){
|
||||
interaction.deferUpdate()
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
} catch{}
|
||||
}else if (interaction.isChatInputCommand()){
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.messages.createdTitle,l.messages.createdDescription)]})
|
||||
}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){
|
||||
|
||||
try{
|
||||
if (config.system.enable_DM_Messages){
|
||||
if (currentTicketOptions.enableDmOnOpen){
|
||||
interaction.member.send({embeds:[bot.errorLog.custom(l.messages.newTicketDmTitle,currentTicketOptions.message,":ticket:",config.main_color)]})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
const discord = require('discord.js')
|
||||
const bot = require('../index')
|
||||
const client = bot.client
|
||||
const config = bot.config
|
||||
const l = bot.language
|
||||
|
||||
/** @param {discord.TextBasedChannel} channel @returns {Promise<{ticketname:String,ticketopener:{discordjsuser:discord.User,name:String,id:String}>} */
|
||||
const getUserInfo = (channel) => {
|
||||
return new Promise((promiseresolve,reject) => {
|
||||
//getID
|
||||
var result = {
|
||||
ticketopener:{
|
||||
discordjsuser:"",
|
||||
id:"/",
|
||||
name:"/"
|
||||
},
|
||||
ticketname:"/"
|
||||
}
|
||||
channel.messages.fetchPinned().then(msglist => {
|
||||
var firstmsg = msglist.last()
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return false
|
||||
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
|
||||
const ticketId = hiddendata.data.find(d => d.key == "type")
|
||||
|
||||
const id = hiddendata.data.find(d => d.key == "openerid").value
|
||||
|
||||
result.ticketopener.id = id
|
||||
|
||||
const ticketopener = client.users.cache.find(u => u.id == id)
|
||||
const name = ticketopener.tag
|
||||
|
||||
const channelname = channel.name
|
||||
|
||||
promiseresolve({ticketname:channelname,ticketopener:{discordjsuser:ticketopener,name:name,id:id}})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.Message[]} messagecollection
|
||||
* @param {discord.Channel} channel
|
||||
* @returns new `discord.attachmentBuilder`
|
||||
*/
|
||||
|
||||
exports.createTranscript = async (messagecollection,channel) => {
|
||||
const ticketuserdata = await getUserInfo(channel)
|
||||
|
||||
require("./api/modules/events").onTranscriptCreation(messagecollection,channel,channel.guild,new Date())
|
||||
try {
|
||||
const cd = new Date()
|
||||
const months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
|
||||
const dateString = cd.getDate()+" "+months[cd.getMonth()-1]+" "+cd.getFullYear()+" - "+cd.getHours()+":"+cd.getMinutes()+":"+cd.getSeconds()
|
||||
const filearray = ["open ticket transcript:\ntranscript creation: "+dateString+"\nticket name: "+ticketuserdata.ticketname+"\nticket opener: "+ticketuserdata.ticketopener.name,"\nTRANSCRIPT START:"]
|
||||
|
||||
messagecollection.reverse()
|
||||
|
||||
messagecollection.forEach((msg) => {
|
||||
const timestamp = new Date(msg.createdTimestamp)
|
||||
|
||||
if (msg.content){var content = msg.content}else{var content = "*empty message*"}
|
||||
|
||||
const msgstats = "files: "+msg.attachments.size+", embeds: "+msg.embeds.length
|
||||
filearray.push("["+timestamp.getDate()+"/"+timestamp.getMonth()+"/"+timestamp.getFullYear()+", "+timestamp.getHours()+":"+timestamp.getMinutes()+":"+timestamp.getSeconds()+"|"+msg.author.tag+"] ["+msgstats+"]\n"+content+"\n")
|
||||
})
|
||||
|
||||
if (filearray.length < 2) filearray.push("transcript is empty")
|
||||
const filestring = filearray.join("\n")
|
||||
const filebuff = Buffer.from(filestring,"utf-8")
|
||||
return new discord.AttachmentBuilder(filebuff,{name:"transcript_"+ticketuserdata.ticketname+".txt",description:"An Open Ticket transcript"})
|
||||
}catch(err){
|
||||
console.log("[error] "+err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
const discord = require('discord.js')
|
||||
|
||||
const bot = require("../../../index")
|
||||
const tsconfig = bot.tsconfig
|
||||
const tsembeds = require("../embeds")
|
||||
const tsdb = require("../tsdb")
|
||||
|
||||
const otversion = require("../../../package.json").version
|
||||
const version = require("../info.json").version
|
||||
|
||||
/**@typedef {{style:{enableCustomBackground:Boolean, backgroundModus:"color"|"image", backgroundData:String, titleColor:String}, bot:{name:String, id:Number, pfp:String}, ticket:{creatorname:String, creatorid:Number, closedtime:Number, openedtime:Number}}} OThtsDataOption */
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.Guild} guild
|
||||
* @param {discord.Channel} channel
|
||||
* @param {discord.User} user
|
||||
* @param {discord.Message[]} messagesInv
|
||||
* @param {OThtsDataOption} data
|
||||
*/
|
||||
exports.compile = (guild,channel,user,messagesInv,data) => {
|
||||
const messages = messagesInv.reverse()
|
||||
var invisibleMessages = 0
|
||||
|
||||
const rawfiles = messages.filter((m) => Array.from(m.attachments).length > 0)
|
||||
var fileAmount = 0
|
||||
rawfiles.forEach((msg) => {
|
||||
fileAmount = fileAmount + Array.from(msg.attachments).length
|
||||
})
|
||||
|
||||
const messagesArray = []
|
||||
messages.forEach((msg) => {
|
||||
if (msg.content || msg.embeds.length > 0 || msg.attachments.toJSON().length > 0){
|
||||
|
||||
const embedArray = []
|
||||
const fileArray = []
|
||||
|
||||
msg.attachments.forEach((file) => {
|
||||
fileArray.push({
|
||||
name:file.name,
|
||||
type:file.contentType,
|
||||
size:file.size.toString()+" bytes",
|
||||
url:file.url
|
||||
})
|
||||
})
|
||||
|
||||
msg.embeds.forEach((embed) => {
|
||||
if (embed.description){
|
||||
var desc = bot.hiddenData.removeHiddenData(embed.description).description
|
||||
}else{var desc = false}
|
||||
|
||||
embedArray.push({
|
||||
title:embed.title || false,
|
||||
description:desc,
|
||||
authorimg:((embed.author && embed.author.iconURL) ? embed.author.iconURL : false),
|
||||
authortext:(embed.author ? embed.author.name : false),
|
||||
footerimg:((embed.footer && embed.footer.iconURL) ? embed.footer.iconURL : false),
|
||||
footertext:(embed.footer ? embed.footer.text : false),
|
||||
color:embed.hexColor,
|
||||
image:((embed.image && embed.image.url) ? embed.image.url : false),
|
||||
thumbnail:((embed.thumbnail && embed.thumbnail.url) ? embed.thumbnail.url : false),
|
||||
url:(embed.url ? embed.url : false)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
messagesArray.push({
|
||||
author:{
|
||||
name:msg.author.tag,
|
||||
id:Number(msg.author.id),
|
||||
color:msg.author.hexAccentColor || "#ffffff",
|
||||
pfp:msg.author.displayAvatarURL()
|
||||
},
|
||||
content:msg.content || "",
|
||||
timestamp:msg.createdTimestamp,
|
||||
embeds:embedArray,
|
||||
files:fileArray
|
||||
})
|
||||
}else {invisibleMessages++}
|
||||
})
|
||||
|
||||
const result = {
|
||||
version,otversion,
|
||||
style:{
|
||||
backgroundData:data.style.backgroundData || "",
|
||||
backgroundModus:data.style.backgroundModus || "",
|
||||
enableCustomBackground:data.style.enableCustomBackground || false,
|
||||
titleColor:data.style.titleColor || "#F8BA00"
|
||||
},
|
||||
bot:{
|
||||
name:data.bot.name || "Open Ticket",
|
||||
id:Number(data.bot.id) || 0,
|
||||
pfp:data.bot.pfp || "dj-dj.be/wp-content/uploads/2022/07/profielfoto-blauw-wit.png?size=128"
|
||||
},
|
||||
ticket:{
|
||||
name:channel.name,
|
||||
id:Number(channel.id),
|
||||
|
||||
guildname:guild.name,
|
||||
guildid:Number(guild.id),
|
||||
|
||||
creatorname:data.ticket.creatorname,
|
||||
creatorid:Number(data.ticket.creatorid),
|
||||
closedbyname:user.tag,
|
||||
closedbyid:Number(user.id),
|
||||
|
||||
closedtime:data.ticket.closedtime,
|
||||
openedtime:data.ticket.openedtime,
|
||||
|
||||
messages:Array.from(messages).length-invisibleMessages,
|
||||
files:fileAmount
|
||||
},
|
||||
messages:messagesArray
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
const axios = require("axios").default
|
||||
const discord = require('discord.js')
|
||||
|
||||
const bot = require("../../../index")
|
||||
const tsconfig = bot.tsconfig
|
||||
const tsembeds = require("../embeds")
|
||||
const tsdb = require("../tsdb")
|
||||
|
||||
/**@typedef {{status:"success"|"error", id:String, time:Number, estimated:{lastdump: Number, processtime:Number}, transcriptstatus:{value:2, data:{fetchedmsgs:true, uploaded:true, inqueue:true, processed:false, waiting:false, available:false}}}} OTuploadResponse */
|
||||
|
||||
/**
|
||||
* @param {Object} json
|
||||
* @returns {Promise<OTuploadResponse|false>}
|
||||
*/
|
||||
exports.upload = async (json) => {
|
||||
return new Promise(async (resolve,reject) => {
|
||||
const data = encodeURIComponent(JSON.stringify(json))
|
||||
|
||||
try {
|
||||
const res = await axios.get("https://api.transcripts.dj-dj.be/upload?auth=openticketTRANSCRIPT1234&version=1.0.0&data="+data)
|
||||
if (res.status != 200) resolve(false)
|
||||
|
||||
resolve(res.data)
|
||||
}catch{
|
||||
console.log("failed transcript upload!")
|
||||
resolve(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"version":"1.0.0",
|
||||
"otversion":"3.2.0",
|
||||
"style":{
|
||||
"enableCustomBackground":false,
|
||||
"backgroundModus":"color OR image",
|
||||
"backgroundData":"#ffffff OR https://www.example.com/image.png",
|
||||
"titleColor":"#ffffff"
|
||||
},
|
||||
"bot":{
|
||||
"name":"DJdj Support Bot",
|
||||
"id":12345678910,
|
||||
"pfp":"https://www.example.com/image.png"
|
||||
},
|
||||
"ticket":{
|
||||
"name":"support-DJj123dj",
|
||||
"id":12345678910,
|
||||
|
||||
"guildname":"DJdj Development",
|
||||
"guildid":12345678910,
|
||||
|
||||
"creatorname":"DJj123dj#1706",
|
||||
"creatorid":12345678910,
|
||||
"closedbyname":"DJj123dj#1706",
|
||||
"closedbyid":12345678910,
|
||||
|
||||
"closedtime":12345678910,
|
||||
"openedtime":12345678910,
|
||||
|
||||
"messages":1,
|
||||
"files":1
|
||||
},
|
||||
"messages":[
|
||||
{
|
||||
"author":{
|
||||
"name":"DJj123dj#1706",
|
||||
"id":12345678910,
|
||||
"color":"#ffffff",
|
||||
"pfp":"https://www.example.com/image.png"
|
||||
},
|
||||
"content":"string or FALSE",
|
||||
"timestamp":12345678910,
|
||||
"embeds":[
|
||||
{
|
||||
"title":"string or FALSE",
|
||||
"description":"string or FALSE",
|
||||
"authorimg":"https://www.example.com/image.png or FALSE",
|
||||
"authortext":"string or FALSE",
|
||||
"footerimg":"https://www.example.com/image.png or FALSE",
|
||||
"footertext":"string or FALSE",
|
||||
"color":"#ffffff",
|
||||
"image":"https://www.example.com/image.png or FALSE",
|
||||
"thumbnail":"https://www.example.com/image.png or FALSE",
|
||||
"url":"https://www.example.com/image.png or FALSE"
|
||||
}
|
||||
],
|
||||
"files":[
|
||||
{
|
||||
"name":"image.png",
|
||||
"type":"PNG",
|
||||
"size":"1MB",
|
||||
"url":"https://www.example.com/image.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
const discord = require('discord.js')
|
||||
const bot = require('../../index')
|
||||
const client = bot.client
|
||||
const config = bot.config
|
||||
const log = bot.errorLog.log
|
||||
const l = bot.language
|
||||
const storage = bot.storage
|
||||
const tsconfig = bot.tsconfig
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} id
|
||||
* @param {Number} rawprocesstime milliseconds
|
||||
* @param {discord.User} user
|
||||
*/
|
||||
exports.beingprocessed = (name,id,rawprocesstime,user) => {
|
||||
|
||||
const newtime = rawprocesstime
|
||||
|
||||
const processtime = "<t:"+newtime.getTime().toString().substring(0,newtime.getTime().toString().length-3)+":R>"
|
||||
|
||||
const embed = new discord.EmbedBuilder()
|
||||
.setTitle("🧾 Transcript")
|
||||
.setColor(config.main_color)
|
||||
.setAuthor({name:user.tag,iconURL:user.displayAvatarURL()})
|
||||
.setFooter({text:name})
|
||||
|
||||
.setDescription("`This transcript is being processed...`\nPlease wait!\n\nEstimated time: "+processtime)
|
||||
|
||||
return embed
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} id
|
||||
* @param {String} url
|
||||
* @param {discord.User} user
|
||||
*/
|
||||
exports.tsready = (name,id,url,user) => {
|
||||
const embed = new discord.EmbedBuilder()
|
||||
.setTitle("🧾 Transcript")
|
||||
.setColor(config.main_color)
|
||||
.setAuthor({name:user.tag,iconURL:user.displayAvatarURL()})
|
||||
.setFooter({text:name})
|
||||
.setURL(url)
|
||||
|
||||
.setDescription("\nThe transcript is available [here]("+url+")\n")
|
||||
|
||||
return embed
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} id
|
||||
* @param {discord.User} user
|
||||
* @param {undefined|String} err
|
||||
*/
|
||||
exports.tserror = (name,id,user,err) => {
|
||||
const embed = new discord.EmbedBuilder()
|
||||
.setTitle("❌ Transcript")
|
||||
.setColor(discord.Colors.Red)
|
||||
.setAuthor({name:user.tag,iconURL:user.displayAvatarURL()})
|
||||
.setFooter({text:name})
|
||||
|
||||
const errDesc = (typeof err == "string") ? "\n"+err : ""
|
||||
|
||||
embed.setDescription("Something went wrong while creating the HTML transcript.\n\n[possible reasons](https://docs.openticket.dj-dj.be/the-system/transcripts/transcript-errors)"+errDesc)
|
||||
|
||||
return embed
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"version":"1.0.0"
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
const discord = require('discord.js')
|
||||
const bot = require('../../index')
|
||||
const client = bot.client
|
||||
const config = bot.config
|
||||
const log = bot.errorLog.log
|
||||
const l = bot.language
|
||||
const storage = bot.storage
|
||||
|
||||
const tsconfig = bot.tsconfig
|
||||
const tsembeds = require("./embeds")
|
||||
const tsdb = require("./tsdb")
|
||||
|
||||
|
||||
const checkAvailability = async () => {
|
||||
const axios = require("axios").default
|
||||
const res = await axios.get("https://transcripts.dj-dj.be/status.txt")
|
||||
if (!res || !(res.status == 200) || !res.data) return false
|
||||
|
||||
if ((res.data == "online") || (res.data == "1") || (res.data == "true")) return true
|
||||
else return false
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.Message[]} messages
|
||||
* @param {discord.Guild} guild
|
||||
* @param {discord.TextChannel} channel
|
||||
* @param {discord.User} user
|
||||
* @param {String|false} reason
|
||||
*/
|
||||
module.exports = async (messages,guild,channel,user,reason) => {
|
||||
require("../api/modules/events").onTranscriptCreation(messages,channel,guild,new Date())
|
||||
const msglist = await channel.messages.fetchPinned()
|
||||
|
||||
const chName = channel.name
|
||||
const chId = channel.id
|
||||
|
||||
/**@param {discord.Collection<string, discord.Message<true>>} msglist*/
|
||||
const asyncmanager = async (msglist) => {
|
||||
var firstmsg = msglist.last()
|
||||
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return false
|
||||
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
|
||||
const ticketId = hiddendata.data.find(d => d.key == "type")
|
||||
|
||||
const id = hiddendata.data.find(d => d.key == "openerid").value
|
||||
const opentime = new Date(Number(hiddendata.data.find(d => d.key == "createdms").value))
|
||||
|
||||
const ticketopener = client.users.cache.find(u => u.id == id)
|
||||
|
||||
|
||||
const JSONDATA = require("./communication/compileJson").compile(guild,channel,user,messages,{
|
||||
style:{
|
||||
titleColor:tsconfig.style.titleColor,
|
||||
enableCustomBackground:tsconfig.style.background.enableCustomBackground,
|
||||
backgroundModus:tsconfig.style.background.backgroundModus,
|
||||
backgroundData:tsconfig.style.background.backgroundData
|
||||
},
|
||||
bot:{
|
||||
name:client.user.username,
|
||||
id:client.user.id,
|
||||
pfp:client.user.displayAvatarURL()
|
||||
},
|
||||
ticket:{
|
||||
creatorid:ticketopener.id,
|
||||
creatorname:ticketopener.tag,
|
||||
openedtime:opentime.getTime(),
|
||||
closedtime:new Date().getTime()
|
||||
}
|
||||
})
|
||||
|
||||
if (!await checkAvailability()){
|
||||
const attachment = await require("./oldTranscript").createTranscript(messages,channel)
|
||||
const errembed = tsembeds.tserror(chName,chId,user)
|
||||
|
||||
if (tsconfig.sendTranscripts.enableChannel){
|
||||
/**@type {discord.TextChannel|undefined} */
|
||||
const tc = guild.channels.cache.find((c) => c.id == tsconfig.sendTranscripts.channel)
|
||||
|
||||
if (!tc) return
|
||||
tc.send({embeds:[errembed],files:[attachment]})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const TSdata = await require("./communication/index").upload(JSONDATA)
|
||||
if (!TSdata) return false
|
||||
|
||||
if (TSdata.status == "success"){
|
||||
const url = "https://transcripts.dj-dj.be/t/"+TSdata.time+"_"+TSdata.id+".html"
|
||||
|
||||
//calculate estimated time
|
||||
const lastDumpTime = (new Date(TSdata.estimated.lastdump).getTime())
|
||||
const dumpLoopTime = 15000
|
||||
const nextDump = new Date(lastDumpTime+dumpLoopTime)
|
||||
const processtime = TSdata.estimated.processtime+6000 //6sec extra time for overflow
|
||||
|
||||
const finaltime = new Date(nextDump.getTime()+processtime)
|
||||
const duration = finaltime.getTime()-new Date().getTime()
|
||||
|
||||
//waiting
|
||||
if (tsconfig.sendTranscripts.enableChannel){
|
||||
/**@type {discord.TextChannel|undefined} */
|
||||
const tc = guild.channels.cache.find((c) => c.id == tsconfig.sendTranscripts.channel)
|
||||
|
||||
if (!tc) return
|
||||
const embed = tsembeds.beingprocessed(chName,chId,finaltime,user)
|
||||
var msg = await tc.send({embeds:[embed]})
|
||||
}else {var msg = false}
|
||||
|
||||
//ready
|
||||
setTimeout(() => {
|
||||
if (msg){
|
||||
msg.edit({embeds:[tsembeds.tsready(chName,chId,url,user)]})
|
||||
}
|
||||
|
||||
if (tsconfig.sendTranscripts.enableDM){
|
||||
if (!user) return
|
||||
const embed = tsembeds.tsready(chName,chId,url,user)
|
||||
try {
|
||||
user.send({embeds:[embed]})
|
||||
}catch{}
|
||||
}
|
||||
},duration)
|
||||
}else{
|
||||
const attachment = await require("./oldTranscript").createTranscript(messages,channel)
|
||||
const errembed = tsembeds.tserror(chName,chId,user,"`error type: transcript API error`")
|
||||
|
||||
if (tsconfig.sendTranscripts.enableChannel){
|
||||
/**@type {discord.TextChannel|undefined} */
|
||||
const tc = guild.channels.cache.find((c) => c.id == tsconfig.sendTranscripts.channel)
|
||||
|
||||
if (!tc) return
|
||||
tc.send({embeds:[errembed],files:[attachment]})
|
||||
}
|
||||
}
|
||||
}
|
||||
asyncmanager(msglist)
|
||||
}
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
const discord = require('discord.js')
|
||||
const bot = require('../../index')
|
||||
const client = bot.client
|
||||
const config = bot.config
|
||||
const l = bot.language
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.Message[]} messagecollection
|
||||
* @returns new `discord.attachmentBuilder`
|
||||
*/
|
||||
|
||||
exports.createTranscript = async (messagecollection) => {
|
||||
try {
|
||||
const cd = new Date()
|
||||
const months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
|
||||
const dateString = cd.getDate()+" "+months[cd.getMonth()-1]+" "+cd.getFullYear()+" - "+cd.getHours()+":"+cd.getMinutes()+":"+cd.getSeconds()
|
||||
const filearray = ["BACKUP TRANSCRIPT:\n"]
|
||||
|
||||
messagecollection.reverse()
|
||||
|
||||
messagecollection.forEach((msg) => {
|
||||
const timestamp = new Date(msg.createdTimestamp)
|
||||
|
||||
if (msg.content){var content = msg.content}else{var content = "*empty message*"}
|
||||
|
||||
const msgstats = "files: "+msg.attachments.size+", embeds: "+msg.embeds.length
|
||||
filearray.push("["+timestamp.getDate()+"/"+timestamp.getMonth()+"/"+timestamp.getFullYear()+", "+timestamp.getHours()+":"+timestamp.getMinutes()+":"+timestamp.getSeconds()+"|"+msg.author.tag+"] ["+msgstats+"]\n"+content+"\n")
|
||||
})
|
||||
|
||||
if (filearray.length < 2) filearray.push("transcript is empty")
|
||||
const filestring = filearray.join("\n")
|
||||
const filebuff = Buffer.from(filestring,"utf-8")
|
||||
return new discord.AttachmentBuilder(filebuff,{name:"backuptranscript.txt",description:"Open Ticket transcript"})
|
||||
}catch{
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
const fs = require("fs")
|
||||
const location = "./storage/tsdatabase.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
|
||||
}
|
||||
@@ -16,7 +16,7 @@ const l = bot.language
|
||||
|
||||
|
||||
//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
|
||||
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"closedCategory"} OTTicketStringOptions */
|
||||
|
||||
@@ -7,24 +7,26 @@ const configParser = require("./configParser")
|
||||
/**
|
||||
*
|
||||
* @param {String[]} ids
|
||||
* @param {String|undefined|false} placeholder
|
||||
* @returns {discord.StringSelectMenuBuilder|false}
|
||||
*/
|
||||
exports.getDropdown = (ids) => {
|
||||
exports.getDropdown = (ids,placeholder) => {
|
||||
const dropdown = new discord.StringSelectMenuBuilder()
|
||||
.setCustomId("OTdropdownMenu")
|
||||
.setDisabled(false)
|
||||
.setMaxValues(1)
|
||||
.setMinValues(1)
|
||||
.setPlaceholder(l.messages.chooseATicket)
|
||||
.setPlaceholder(placeholder || l.messages.chooseATicket)
|
||||
.addOptions(
|
||||
new discord.SelectMenuOptionBuilder()
|
||||
.setDefault(true)
|
||||
.setLabel(l.messages.chooseATicket)
|
||||
.setLabel(placeholder || l.messages.chooseATicket)
|
||||
.setValue("OTChooseTicket")
|
||||
)
|
||||
|
||||
ids.forEach((id) => {
|
||||
const option = configParser.getTicketById(id,true)
|
||||
const roleoption = configParser.getRoleById(id,true)
|
||||
if (option){
|
||||
const selectComponent = new discord.SelectMenuOptionBuilder()
|
||||
.setDefault(false)
|
||||
@@ -37,8 +39,23 @@ exports.getDropdown = (ids) => {
|
||||
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)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
+12
-5
@@ -35,7 +35,10 @@ exports.createEmbed = (id) => {
|
||||
const embed = new discord.EmbedBuilder()
|
||||
.setTitle(data.name)
|
||||
if (data.enableFooter) embed.setFooter({text:data.footer})
|
||||
if (data.enableThumbnail) embed.setThumbnail(data.thumbnail)
|
||||
|
||||
try {
|
||||
if (data.enableThumbnail) embed.setThumbnail(data.thumbnail)
|
||||
}catch{bot.errorLog.log("info","THUMBNAIL FAILED TO LOAD, probably invalid url!")}
|
||||
|
||||
if (data.enableCustomColor){
|
||||
embed.setColor(data.color)
|
||||
@@ -43,9 +46,12 @@ exports.createEmbed = (id) => {
|
||||
embed.setColor(config.main_color)
|
||||
}
|
||||
|
||||
if (data.other.embedTitleURL.enable) embed.setURL(data.other.embedTitleURL)
|
||||
|
||||
var description = data.description
|
||||
if (data.enableTicketExplaination){
|
||||
description = description+"\n\n__"+l.messages.chooseCategory+"__\n"
|
||||
if (data.other.enableTicketExplaination){
|
||||
const chooseCategoryMSG = data.other.customCategoryText.enable ? data.other.customCategoryText.text : l.messages.chooseCategory
|
||||
description = description+"\n\n__"+chooseCategoryMSG+"__\n"
|
||||
|
||||
var ticketExplainations = []
|
||||
buttonData.forEach((button) => {
|
||||
@@ -56,7 +62,7 @@ exports.createEmbed = (id) => {
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -92,7 +98,8 @@ exports.createEmbed = (id) => {
|
||||
//create the component IF DROPDOWN is true
|
||||
}else{
|
||||
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 = [
|
||||
new discord.ActionRowBuilder()
|
||||
.setComponents(dropdown)
|
||||
|
||||
@@ -69,8 +69,13 @@ const language = require("./core/languageManager").language
|
||||
exports.language = language
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","loaded language")
|
||||
|
||||
|
||||
const config = tempconfig
|
||||
exports.config = config
|
||||
|
||||
const tsconfig = require("./transcriptconfig.json")
|
||||
exports.tsconfig = tsconfig
|
||||
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","loaded config")
|
||||
exports.storage = require('./core/dynamicdatabase/storage')
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","loaded storage")
|
||||
@@ -124,6 +129,12 @@ client.on('ready',async () => {
|
||||
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!")
|
||||
|
||||
try {
|
||||
@@ -150,10 +161,19 @@ client.on('ready',async () => {
|
||||
if (config.status.enabled){
|
||||
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!")
|
||||
|
||||
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{
|
||||
console.log(chalk.red("STARTING IN ")+chalk.blue("SLASH MODE")+chalk.red("..."))
|
||||
this.errorLog.log("debug","slashmode activated")
|
||||
@@ -196,6 +216,7 @@ if (process.argv[2] && process.argv[2].startsWith("slash")){
|
||||
require("./commands/reopen")()
|
||||
require("./commands/claim")()
|
||||
require("./commands/unclaim")()
|
||||
require("./commands/change")()
|
||||
|
||||
this.errorLog.log("debug","LOADING CORE")
|
||||
//core
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"errors":{
|
||||
"missingArgsTitle":"Ugyldige argumenter",
|
||||
"missingArgsDescription":"Manglende argumenter",
|
||||
"noPermsTitle":"Ingen adgang",
|
||||
"noPermsDescription":"Du har ikke adgang til denne kommando",
|
||||
"noPermsDelete":"Kun administrators kan slette tickets",
|
||||
"chooseFromListTitle":"Ugyldig ID",
|
||||
"chooseFromListDescription":"Vælg et ID nedenunder",
|
||||
"boterror":"Bot Fejl!",
|
||||
"notInTicketTitle":"Du er ikke i en ticket!",
|
||||
"notInTicketDescription":"Denne kommando fungere kun i tickets!",
|
||||
"ticketDoesntExist":"Denne ticket eksistere ikke mere!",
|
||||
"roleDoesntExist":"Denne rolle eksistere ikke mere!",
|
||||
"anotherOption":"Dette er ikke en ticket, men noget andet!",
|
||||
"maxAmountTitle":"For mange tickets er blevet oprettet!",
|
||||
"maxAmountDescription":"Du har for mange tickets åbne!\nSå luk dem hvis du gerne vil oprette nye!",
|
||||
"somethingWentWrong":"**Noget gik galt**\nKontakt en udvikler!",
|
||||
"somethingWentWrongTranscript":"Noget gik galt med transcript!**\nKontakt en udvikler!"
|
||||
},
|
||||
"commands":{
|
||||
"userAddedTitle":"Tilføjer {0} til denne ticket!",
|
||||
"userRemovedTitle":"Fjernet {0} fra denne ticket!",
|
||||
"renameTitle":"Ændret navnet til{0}!",
|
||||
"closeTitle":"Closed this ticket!",
|
||||
"deleteTitle":"Fjerner ticketen",
|
||||
"reopenTitle":"Genåbnede denne ticket",
|
||||
"claimTitle":"Denne ticket er blevet taget af {0}",
|
||||
"unclaimTitle":"Denne ticket er nu tilgængelig!",
|
||||
|
||||
"ticketWarning":"Emebeddet er i beskeden nedenunder",
|
||||
"maxTicketWarning":"**Fejl:** _Du kan kun oprettre {0} ticket adgangen!_"
|
||||
},
|
||||
"helpMenu":{
|
||||
"title":"Tilgængelig kommandoer:",
|
||||
"header1":"**Gå til {0} For at oprette en ticket!**\n\n",
|
||||
"header2":"**Skriv kommandoen `/new` eller `/ticket` for at oprette en ticket!**\n\n",
|
||||
|
||||
"msgCmd":"Lav en embed med knapper (admins kun)",
|
||||
"renameCmd":"Ændre navnet (ingen mellemrum)",
|
||||
"closeCmd":"Luk denne ticket",
|
||||
"deleteCmd":"Fjern denne ticket",
|
||||
"addCmd":"Tilføj en person til ticketen",
|
||||
"removeCmd":"Fjern en person fra ticketen",
|
||||
"reopenCmd":"Genåben en ticket efter den har været lukket"
|
||||
},
|
||||
"buttons":{
|
||||
"close":"Luk ticket",
|
||||
"delete":"Fjern ticket",
|
||||
"reopen":"Genåben ticket",
|
||||
"sendTranscript":"Transcript",
|
||||
"closeWithReason":"Luk med grundlag"
|
||||
},
|
||||
"messages":{
|
||||
"reopenTitle":"Genåbener denne ticket",
|
||||
"reopenDescription":"Du kan nu skrive igen",
|
||||
"closedTitle":"Lukker ticketen!",
|
||||
"closedDescription":"Kun administrators kan skrive lige nu!\n\n*Klik på knappen nedenunder for at slette eller genåbne ticketen!*",
|
||||
"createdTitle":"Ticket oprettet!",
|
||||
"createdDescription":"Din ticket er oprettet!",
|
||||
|
||||
"newTicketDmTitle":"Ny Ticket!",
|
||||
"closedTicketDmTitle":"Ticket Lukket!",
|
||||
"deletedTicketDmTitle":"Ticket Fjernet!",
|
||||
"closedTicketDmDescription":"Din ticket er blevet lukket!",
|
||||
"deletedTicketDmDescription":"Din ticket er blevet fjernet!",
|
||||
"reopenTicketDmTitle":"Ticket Genåbnet!",
|
||||
"reopenTicketDmDescription":"Din ticket er blevet genåbent!",
|
||||
"newTranscriptTitle":" En ny transcript er tilføjet!",
|
||||
"hereIsTheTranscript":"Følgende transcript:",
|
||||
|
||||
"chooseCategory":"Vælg en kategori:",
|
||||
"gettingdeleted":"Ticketen slettes..",
|
||||
|
||||
"none":"Ingen",
|
||||
"reason":"Grundlag",
|
||||
|
||||
"deletedby":"Fjernet af",
|
||||
"closedby":"Lukket af",
|
||||
"modalreason":"Hvad er grundlaget for lukkens af denne ticket?",
|
||||
"chooseATicket": "Vælg en ticket"
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
"reopenTitle":"Re-Opened this ticket!",
|
||||
"claimTitle":"This ticket is now claimed to {0}",
|
||||
"unclaimTitle":"This ticket isn't claimed anymore!",
|
||||
"changeTitle":"Changed ticket type to {0}!",
|
||||
|
||||
"ticketWarning":"The embed is in the message below!",
|
||||
"maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_"
|
||||
|
||||
@@ -69,12 +69,14 @@
|
||||
"deletedTicketDmTitle":"Ticket löschen!",
|
||||
"closedTicketDmDescription":"Ihr Ticket ist geschlossen!",
|
||||
"deletedTicketDmDescription":"Ihr Ticket ist gelöscht!",
|
||||
"newTranscriptTitle":"Eine neue Transscript finden Sie hier!",
|
||||
"newTranscriptDescription":"Die Abschrift finden Sie in der obigen Textdatei!",
|
||||
"hereIsTheTranscript":"Hier ist das Transscript:",
|
||||
"newTranscriptTitle":"Eine neue Transcript finden Sie hier!",
|
||||
"hereIsTheTranscript":"Hier ist das Transcript:",
|
||||
|
||||
"chooseCategory":"Wähle eine Kategorie:",
|
||||
|
||||
"none":"keiner",
|
||||
"reason":"Grund",
|
||||
|
||||
"deletedby":"Gelöscht von",
|
||||
"closedby":"Geschlossen von",
|
||||
"modalreason":"Was ist der Grund?",
|
||||
|
||||
@@ -114,26 +114,37 @@
|
||||
"it":"Rinomina il canale di un ticket."
|
||||
},
|
||||
"claim":{
|
||||
"en-GB":"",
|
||||
"en-US":"",
|
||||
"nl":"",
|
||||
"ro":"",
|
||||
"de":"",
|
||||
"cs":"",
|
||||
"fr":"",
|
||||
"es-ES":"",
|
||||
"it":""
|
||||
"en-GB":"Claim a ticket.",
|
||||
"en-US":"Claim a ticket.",
|
||||
"nl":"Claim een ticket.",
|
||||
"ro":" ",
|
||||
"de":" ",
|
||||
"cs":" ",
|
||||
"fr":" ",
|
||||
"es-ES":" ",
|
||||
"it":" "
|
||||
},
|
||||
"unclaim":{
|
||||
"en-GB":"",
|
||||
"en-US":"",
|
||||
"nl":"",
|
||||
"ro":"",
|
||||
"de":"",
|
||||
"cs":"",
|
||||
"fr":"",
|
||||
"es-ES":"",
|
||||
"it":""
|
||||
"en-GB":"Un-claim a ticket.",
|
||||
"en-US":"Un-claim a ticket.",
|
||||
"nl":"Ontclaim een ticket.",
|
||||
"ro":" ",
|
||||
"de":" ",
|
||||
"cs":" ",
|
||||
"fr":" ",
|
||||
"es-ES":" ",
|
||||
"it":" "
|
||||
},
|
||||
"category":{
|
||||
"en-GB":"Change ticket type.",
|
||||
"en-US":"Change ticket type.",
|
||||
"nl":"Verander ticket type.",
|
||||
"ro":" ",
|
||||
"de":" ",
|
||||
"cs":" ",
|
||||
"fr":" ",
|
||||
"es-ES":" ",
|
||||
"it":" "
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "open-ticket",
|
||||
"version": "3.0.1",
|
||||
"version": "3.2.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": {
|
||||
@@ -16,9 +16,7 @@
|
||||
"axios": "^0.27.2",
|
||||
"chalk": "^5.0.1",
|
||||
"discord.js": "^14.7.1",
|
||||
"express": "^4.17.1",
|
||||
"node": "^16.10.0",
|
||||
"node-localstorage": "^2.2.1"
|
||||
"node": "^16.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
This file is only here to make sure that this directory exists!
|
||||
|
||||
I don't have any other use :)
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"sendTranscripts":{
|
||||
"enableChannel":false,
|
||||
"channel":"transcript channel id",
|
||||
|
||||
"enableDM":false
|
||||
},
|
||||
"style":{
|
||||
"titleColor":"#F8BA00",
|
||||
"background":{
|
||||
"enableCustomBackground":false,
|
||||
"backgroundModus":"color OR image",
|
||||
"backgroundData":"#abc123 OR https://www.example.com/image.png"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user