Merge branch 'dev-v4.2' into pr/208

This commit is contained in:
DJj123dj
2026-05-23 20:56:46 +02:00
254 changed files with 13032 additions and 26198 deletions
+130
View File
@@ -0,0 +1,130 @@
/// <reference types="node"/>
import fs from "fs"
import path from "path"
import crypto from "crypto"
const contributorData: {contributors:Contributor[],sections:Section[]} = JSON.parse(fs.readFileSync(path.join(process.cwd(),"./.github/CONTRIBUTORS.json")).toString())
//CONSTANTS
const CORNER_RADIUS = 10
const SPACE_MULTIPLIER = 1.2
const SVG_WIDTH = 1000
//TYPES
interface Contributor {
name:string,
pictureUrl:string,
profileUrl:string,
sectionId:string
}
interface Section {
name:string,
id:string,
pfpSize:number,
pfpColumns:number,
withNames:boolean
}
//FUNCTIONS
async function downloadPfpToBase64URL(url:string){
const res = await fetch(url,{method:"GET"})
if (!res.ok) return null
const buffer = Buffer.from(await res.arrayBuffer())
console.log("Downloaded picture URL:",url)
return "data:image/png;base64,"+buffer.toString("base64")
}
function createTitle(yPos:number,name:string){
return `<text x="${20}" y="${yPos+20}" text-anchor="start" class="contributor-tier-title">${name}</text>`
}
async function createPfp(yPos:number,xPos:number,size:number,contributor:Contributor,withNames:boolean){
const randomId = crypto.randomBytes(8).toString("hex")
const nameElement = (withNames) ? `<text x="${Math.round(xPos+(size/2))}" y="${yPos+size+20}" text-anchor="middle" fill="currentColor">${contributor.name}</text>` : ""
return (`<a href="${contributor.profileUrl}" class="contributor-link" target="_blank">
<clipPath id="clipPath-${randomId}">
<rect x="${xPos}" y="${yPos}" width="${size}" height="${size}" rx="${CORNER_RADIUS}" ry="${CORNER_RADIUS}"/>
</clipPath>
<image x="${xPos}" y="${yPos}" width="${size}" height="${size}" href="${await downloadPfpToBase64URL(contributor.pictureUrl)}" clip-path="url(#clipPath-${randomId})"/>
${nameElement}
</a>`)
}
async function generateSection(yPos:number,section:Section,contributors:Contributor[]){
let sectionHtml: string = ""
sectionHtml += createTitle(yPos,section.name)
const nameOffset = (section.withNames) ? 20 : 0
//divide contributors in rows
const groupedContributors: Contributor[][] = []
let currentGroup: Contributor[] = []
for (const contributor of contributors){
currentGroup.push(contributor)
if (currentGroup.length == section.pfpColumns){
groupedContributors.push(currentGroup)
currentGroup = []
}
}
if (currentGroup.length > 0) groupedContributors.push(currentGroup)
let y = 0
for (const contributorGroup of groupedContributors){
let x = 0
for (const contributor of contributorGroup){
const pfpYPos = 40 + yPos + (y * ((section.pfpSize * SPACE_MULTIPLIER) + nameOffset))
const pfpXPos = 20 + (x * section.pfpSize * SPACE_MULTIPLIER)
sectionHtml += await createPfp(pfpYPos,pfpXPos,section.pfpSize,contributor,section.withNames)
x++
}
y++
}
let sectionHeight: number = 40 + (y * ((section.pfpSize * SPACE_MULTIPLIER) + nameOffset))
return {sectionHtml,sectionHeight}
}
async function generateSections(sections:Section[],contributors:Contributor[]){
let finalHeight: number = 10
let finalHtml: string = ""
for (const section of sections){
const sectionContributors = contributors.filter((s) => s.sectionId === section.id)
if (sectionContributors.length < 1) continue
const {sectionHtml,sectionHeight} = await generateSection(finalHeight,section,sectionContributors)
finalHeight += sectionHeight
finalHtml += sectionHtml
}
finalHeight += 10
return {finalHeight,finalHtml}
}
function generateFinalHtml(sectionsHtml:string,sectionHeight:number){
return (`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 ${SVG_WIDTH} ${sectionHeight}" width="${SVG_WIDTH}" height="${sectionHeight}">
<style>
text {
font-weight: 300;
font-size: 14px;
fill: #777777;
font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
}
.contributor-link {
cursor: pointer;
}
.contributor-tier-title {
font-weight: 500;
font-size: 20px;
}
</style>
${sectionsHtml}
</svg>`)
}
//GENERATE CONTRIBUTORS SVG
async function main(){
const {finalHeight,finalHtml} = await generateSections(contributorData.sections,contributorData.contributors)
fs.writeFileSync(path.join(process.cwd(),"./.github/CONTRIBUTORS.svg"),generateFinalHtml(finalHtml,finalHeight))
}
main()
+132
View File
@@ -0,0 +1,132 @@
/// <reference types="node"/>
import fs from "fs"
import path from "path"
import crypto from "crypto"
const sponsorData: {sponsors:Sponsor[],sections:Section[]} = JSON.parse(fs.readFileSync(path.join(process.cwd(),"./.github/SPONSORS.json")).toString())
//CONSTANTS
const CORNER_RADIUS = 10
const SPACE_MULTIPLIER = 1.2
const SVG_WIDTH = 1000
//TYPES
interface Sponsor {
name:string,
pictureUrl:string,
profileUrl:string,
sectionId:string
}
interface Section {
name:string,
id:string,
pfpSize:number,
pfpColumns:number,
withNames:boolean
}
//FUNCTIONS
async function downloadPfpToBase64URL(url:string){
const res = await fetch(url,{method:"GET"})
if (!res.ok) return null
const buffer = Buffer.from(await res.arrayBuffer())
console.log("Downloaded picture URL:",url)
return "data:image/png;base64,"+buffer.toString("base64")
}
function createTitle(yPos:number,name:string){
return `<text x="${Math.round(SVG_WIDTH/2)}" y="${yPos+20}" text-anchor="middle" class="sponsor-tier-title">${name}</text>`
}
async function createPfp(yPos:number,xPos:number,size:number,sponsor:Sponsor,withNames:boolean){
const randomId = crypto.randomBytes(8).toString("hex")
const nameElement = (withNames) ? `<text x="${Math.round(xPos+(size/2))}" y="${yPos+size+20}" text-anchor="middle" fill="currentColor">${sponsor.name}</text>` : ""
return (`<a href="${sponsor.profileUrl}" class="sponsor-link" target="_blank">
<clipPath id="clipPath-${randomId}">
<rect x="${xPos}" y="${yPos}" width="${size}" height="${size}" rx="${CORNER_RADIUS}" ry="${CORNER_RADIUS}"/>
</clipPath>
<image x="${xPos}" y="${yPos}" width="${size}" height="${size}" href="${await downloadPfpToBase64URL(sponsor.pictureUrl)}" clip-path="url(#clipPath-${randomId})"/>
${nameElement}
</a>`)
}
async function generateSection(yPos:number,section:Section,sponsors:Sponsor[]){
let sectionHtml: string = ""
sectionHtml += createTitle(yPos,section.name)
const nameOffset = (section.withNames) ? 20 : 0
//divide sponsors in rows
const groupedSponsors: Sponsor[][] = []
let currentGroup: Sponsor[] = []
for (const sponsor of sponsors){
currentGroup.push(sponsor)
if (currentGroup.length == section.pfpColumns){
groupedSponsors.push(currentGroup)
currentGroup = []
}
}
if (currentGroup.length > 0) groupedSponsors.push(currentGroup)
let y = 0
for (const sponsorGroup of groupedSponsors){
const xOffset = Math.round((SVG_WIDTH - (sponsorGroup.length * section.pfpSize * SPACE_MULTIPLIER))/2)
let x = 0
for (const sponsor of sponsorGroup){
const pfpYPos = 40 + yPos + (y * ((section.pfpSize * SPACE_MULTIPLIER) + nameOffset))
const pfpXPos = xOffset + (x * section.pfpSize * SPACE_MULTIPLIER)
sectionHtml += await createPfp(pfpYPos,pfpXPos,section.pfpSize,sponsor,section.withNames)
x++
}
y++
}
let sectionHeight: number = 40 + (y * ((section.pfpSize * SPACE_MULTIPLIER) + nameOffset))
return {sectionHtml,sectionHeight}
}
async function generateSections(sections:Section[],sponsors:Sponsor[]){
let finalHeight: number = 10
let finalHtml: string = ""
for (const section of sections){
const sectionSponsors = sponsors.filter((s) => s.sectionId === section.id)
if (sectionSponsors.length < 1) continue
const {sectionHtml,sectionHeight} = await generateSection(finalHeight,section,sectionSponsors)
finalHeight += sectionHeight
finalHtml += sectionHtml
}
finalHeight += 10
return {finalHeight,finalHtml}
}
function generateFinalHtml(sectionsHtml:string,sectionHeight:number){
return (`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 ${SVG_WIDTH} ${sectionHeight}" width="${SVG_WIDTH}" height="${sectionHeight}">
<style>
text {
font-weight: 300;
font-size: 14px;
fill: #777777;
font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
}
.sponsor-link {
cursor: pointer;
}
.sponsor-tier-title {
font-weight: 500;
font-size: 20px;
}
</style>
<rect x="2" y="2" width="${SVG_WIDTH-4}" height="${sectionHeight-4}" rx="20" ry="20" style="fill:transparent;stroke:#f8ba00;stroke-width:3"></rect>
${sectionsHtml}
</svg>`)
}
//GENERATE SPONSORS SVG
async function main(){
const {finalHeight,finalHtml} = await generateSections(sponsorData.sections,sponsorData.sponsors)
fs.writeFileSync(path.join(process.cwd(),"./.github/SPONSORS.svg"),generateFinalHtml(finalHtml,finalHeight))
}
main()
+15
View File
@@ -0,0 +1,15 @@
# Docker Compose for Open Ticket
services:
openticket:
image: djj123dj/open-ticket:latest
volumes:
- config:/home/container/config
- database:/home/container/database
- plugins:/home/container/plugins
restart: unless-stopped
container_name: open-ticket
volumes:
config:
database:
plugins:
+650
View File
@@ -0,0 +1,650 @@
import fjs from "formatted-json-stringify"
import fs from "fs"
const formatter = new fjs.ObjectFormatter(null,true,[
new fjs.ObjectFormatter("_TRANSLATION",true,[
new fjs.PropertyFormatter("otversion"),
new fjs.ArrayFormatter("translators",false,new fjs.PropertyFormatter(null)),
new fjs.PropertyFormatter("lastedited"),
new fjs.PropertyFormatter("language"),
new fjs.PropertyFormatter("automated"),
]),
new fjs.ObjectFormatter("checker",true,[
new fjs.ObjectFormatter("system",true,[
new fjs.PropertyFormatter("typeError"),
new fjs.PropertyFormatter("headerOpenTicket"),
new fjs.PropertyFormatter("typeWarning"),
new fjs.PropertyFormatter("typeInfo"),
new fjs.PropertyFormatter("headerConfigChecker"),
new fjs.PropertyFormatter("headerDescription"),
new fjs.PropertyFormatter("footerError"),
new fjs.PropertyFormatter("footerWarning"),
new fjs.PropertyFormatter("footerSupport"),
new fjs.PropertyFormatter("compactInformation"),
new fjs.PropertyFormatter("dataPath"),
new fjs.PropertyFormatter("dataDocs"),
new fjs.PropertyFormatter("dataMessages"),
]),
new fjs.ObjectFormatter("messages",true,[
new fjs.PropertyFormatter("stringTooShort"),
new fjs.PropertyFormatter("stringTooLong"),
new fjs.PropertyFormatter("stringLengthInvalid"),
new fjs.PropertyFormatter("stringStartsWith"),
new fjs.PropertyFormatter("stringEndsWith"),
new fjs.PropertyFormatter("stringContains"),
new fjs.PropertyFormatter("stringChoices"),
new fjs.PropertyFormatter("stringRegex"),
new fjs.PropertyFormatter("stringInvertedContains"),
new fjs.PropertyFormatter("stringLowercase"),
new fjs.PropertyFormatter("stringUppercase"),
new fjs.PropertyFormatter("stringSpecialCharacters"),
new fjs.PropertyFormatter("stringNoSpaces"),
new fjs.PropertyFormatter("stringCapitalWord"),
new fjs.PropertyFormatter("stringCapitalSentence"),
new fjs.PropertyFormatter("stringPunctuation"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("numberTooShort"),
new fjs.PropertyFormatter("numberTooLong"),
new fjs.PropertyFormatter("numberLengthInvalid"),
new fjs.PropertyFormatter("numberTooSmall"),
new fjs.PropertyFormatter("numberTooLarge"),
new fjs.PropertyFormatter("numberNotEqual"),
new fjs.PropertyFormatter("numberStep"),
new fjs.PropertyFormatter("numberStepOffset"),
new fjs.PropertyFormatter("numberStartsWith"),
new fjs.PropertyFormatter("numberEndsWith"),
new fjs.PropertyFormatter("numberContains"),
new fjs.PropertyFormatter("numberChoices"),
new fjs.PropertyFormatter("numberFloat"),
new fjs.PropertyFormatter("numberNegative"),
new fjs.PropertyFormatter("numberPositive"),
new fjs.PropertyFormatter("numberZero"),
new fjs.PropertyFormatter("numberNan"),
new fjs.PropertyFormatter("numberInvertedContains"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("booleanTrue"),
new fjs.PropertyFormatter("booleanFalse"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("arrayEmptyDisabled"),
new fjs.PropertyFormatter("arrayEmptyRequired"),
new fjs.PropertyFormatter("arrayTooShort"),
new fjs.PropertyFormatter("arrayTooLong"),
new fjs.PropertyFormatter("arrayLengthInvalid"),
new fjs.PropertyFormatter("arrayInvalidTypes"),
new fjs.PropertyFormatter("arrayDouble"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("discordInvalidId"),
new fjs.PropertyFormatter("discordInvalidIdOptions"),
new fjs.PropertyFormatter("discordInvalidToken"),
new fjs.PropertyFormatter("colorInvalid"),
new fjs.PropertyFormatter("emojiTooShort"),
new fjs.PropertyFormatter("emojiTooLong"),
new fjs.PropertyFormatter("emojiCustom"),
new fjs.PropertyFormatter("emojiInvalid"),
new fjs.PropertyFormatter("urlInvalid"),
new fjs.PropertyFormatter("urlInvalidHttp"),
new fjs.PropertyFormatter("urlInvalidProtocol"),
new fjs.PropertyFormatter("urlInvalidHostname"),
new fjs.PropertyFormatter("urlInvalidExtension"),
new fjs.PropertyFormatter("urlInvalidPath"),
new fjs.PropertyFormatter("idNotUnique"),
new fjs.PropertyFormatter("idNonExistent"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("invalidType"),
new fjs.PropertyFormatter("propertyMissing"),
new fjs.PropertyFormatter("propertyOptional"),
new fjs.PropertyFormatter("objectDisabled"),
new fjs.PropertyFormatter("nullInvalid"),
new fjs.PropertyFormatter("switchInvalidType"),
new fjs.PropertyFormatter("objectSwitchInvalid"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("invalidLanguage"),
new fjs.PropertyFormatter("invalidButton"),
new fjs.PropertyFormatter("unusedOption"),
new fjs.PropertyFormatter("unusedQuestion"),
new fjs.PropertyFormatter("dropdownOption"),
new fjs.PropertyFormatter("customInvalidVersion"),
]),
]),
new fjs.ObjectFormatter("actions",true,[
new fjs.ObjectFormatter("buttons",true,[
new fjs.PropertyFormatter("create"),
new fjs.PropertyFormatter("close"),
new fjs.PropertyFormatter("delete"),
new fjs.PropertyFormatter("reopen"),
new fjs.PropertyFormatter("claim"),
new fjs.PropertyFormatter("unclaim"),
new fjs.PropertyFormatter("pin"),
new fjs.PropertyFormatter("unpin"),
new fjs.PropertyFormatter("clear"),
new fjs.PropertyFormatter("helpSwitchSlash"),
new fjs.PropertyFormatter("helpSwitchText"),
new fjs.PropertyFormatter("helpPage"),
new fjs.PropertyFormatter("withReason"),
new fjs.PropertyFormatter("withoutTranscript"),
]),
new fjs.ObjectFormatter("titles",true,[
new fjs.PropertyFormatter("created"),
new fjs.PropertyFormatter("close"),
new fjs.PropertyFormatter("delete"),
new fjs.PropertyFormatter("reopen"),
new fjs.PropertyFormatter("claim"),
new fjs.PropertyFormatter("unclaim"),
new fjs.PropertyFormatter("pin"),
new fjs.PropertyFormatter("unpin"),
new fjs.PropertyFormatter("rename"),
new fjs.PropertyFormatter("move"),
new fjs.PropertyFormatter("add"),
new fjs.PropertyFormatter("remove"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("help"),
new fjs.PropertyFormatter("statsReset"),
new fjs.PropertyFormatter("blacklistAdd"),
new fjs.PropertyFormatter("blacklistRemove"),
new fjs.PropertyFormatter("blacklistGet"),
new fjs.PropertyFormatter("blacklistView"),
new fjs.PropertyFormatter("blacklistAddDm"),
new fjs.PropertyFormatter("blacklistRemoveDm"),
new fjs.PropertyFormatter("clear"),
new fjs.PropertyFormatter("clearTickets"),
new fjs.PropertyFormatter("roles"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("autoclose"),
new fjs.PropertyFormatter("autocloseEnabled"),
new fjs.PropertyFormatter("autocloseDisabled"),
new fjs.PropertyFormatter("autodelete"),
new fjs.PropertyFormatter("autodeleteEnabled"),
new fjs.PropertyFormatter("autodeleteDisabled"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("topicSet"),
new fjs.PropertyFormatter("prioritySet"),
new fjs.PropertyFormatter("priorityGet"),
new fjs.PropertyFormatter("transfer"),
]),
new fjs.ObjectFormatter("descriptions",true,[
new fjs.PropertyFormatter("create"),
new fjs.PropertyFormatter("close"),
new fjs.PropertyFormatter("delete"),
new fjs.PropertyFormatter("reopen"),
new fjs.PropertyFormatter("claim"),
new fjs.PropertyFormatter("unclaim"),
new fjs.PropertyFormatter("pin"),
new fjs.PropertyFormatter("unpin"),
new fjs.PropertyFormatter("rename"),
new fjs.PropertyFormatter("move"),
new fjs.PropertyFormatter("add"),
new fjs.PropertyFormatter("remove"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("helpExplanation"),
new fjs.PropertyFormatter("statsReset"),
new fjs.PropertyFormatter("statsError"),
new fjs.PropertyFormatter("blacklistAdd"),
new fjs.PropertyFormatter("blacklistRemove"),
new fjs.PropertyFormatter("blacklistGetSuccess"),
new fjs.PropertyFormatter("blacklistGetEmpty"),
new fjs.PropertyFormatter("blacklistViewEmpty"),
new fjs.PropertyFormatter("blacklistViewTip"),
new fjs.PropertyFormatter("clearVerify"),
new fjs.PropertyFormatter("clearReady"),
new fjs.PropertyFormatter("rolesEmpty"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("autocloseLeave"),
new fjs.PropertyFormatter("autocloseTimeout"),
new fjs.PropertyFormatter("autodeleteLeave"),
new fjs.PropertyFormatter("autodeleteTimeout"),
new fjs.PropertyFormatter("autocloseEnabled"),
new fjs.PropertyFormatter("autocloseDisabled"),
new fjs.PropertyFormatter("autodeleteEnabled"),
new fjs.PropertyFormatter("autodeleteDisabled"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("ticketMessageLimit"),
new fjs.PropertyFormatter("ticketMessageAutoclose"),
new fjs.PropertyFormatter("ticketMessageAutodelete"),
new fjs.PropertyFormatter("panelReady"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("topicSet"),
new fjs.PropertyFormatter("prioritySet"),
new fjs.PropertyFormatter("priorityGet"),
new fjs.PropertyFormatter("transfer"),
]),
new fjs.ObjectFormatter("modal",true,[
new fjs.PropertyFormatter("closePlaceholder"),
new fjs.PropertyFormatter("deletePlaceholder"),
new fjs.PropertyFormatter("reopenPlaceholder"),
new fjs.PropertyFormatter("claimPlaceholder"),
new fjs.PropertyFormatter("unclaimPlaceholder"),
new fjs.PropertyFormatter("pinPlaceholder"),
new fjs.PropertyFormatter("unpinPlaceholder"),
]),
new fjs.ObjectFormatter("logs",true,[
new fjs.PropertyFormatter("createLog"),
new fjs.PropertyFormatter("closeLog"),
new fjs.PropertyFormatter("closeDm"),
new fjs.PropertyFormatter("deleteLog"),
new fjs.PropertyFormatter("deleteDm"),
new fjs.PropertyFormatter("reopenLog"),
new fjs.PropertyFormatter("reopenDm"),
new fjs.PropertyFormatter("claimLog"),
new fjs.PropertyFormatter("claimDm"),
new fjs.PropertyFormatter("unclaimLog"),
new fjs.PropertyFormatter("unclaimDm"),
new fjs.PropertyFormatter("pinLog"),
new fjs.PropertyFormatter("pinDm"),
new fjs.PropertyFormatter("unpinLog"),
new fjs.PropertyFormatter("unpinDm"),
new fjs.PropertyFormatter("renameLog"),
new fjs.PropertyFormatter("renameDm"),
new fjs.PropertyFormatter("moveLog"),
new fjs.PropertyFormatter("moveDm"),
new fjs.PropertyFormatter("addLog"),
new fjs.PropertyFormatter("addDm"),
new fjs.PropertyFormatter("removeLog"),
new fjs.PropertyFormatter("removeDm"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("blacklistAddLog"),
new fjs.PropertyFormatter("blacklistRemoveLog"),
new fjs.PropertyFormatter("blacklistAddDm"),
new fjs.PropertyFormatter("blacklistRemoveDm"),
new fjs.PropertyFormatter("clearLog"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("transferLog"),
new fjs.PropertyFormatter("transferDm"),
new fjs.PropertyFormatter("prioritySetLog"),
new fjs.PropertyFormatter("prioritySetDm"),
new fjs.PropertyFormatter("roleUpdateLog"),
new fjs.PropertyFormatter("roleUpdateDm"),
]),
]),
new fjs.ObjectFormatter("transcripts",true,[
new fjs.ObjectFormatter("success",true,[
new fjs.PropertyFormatter("visit"),
new fjs.PropertyFormatter("ready"),
new fjs.PropertyFormatter("textFileDescription"),
new fjs.PropertyFormatter("htmlProgress"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("createdChannel"),
new fjs.PropertyFormatter("createdCreator"),
new fjs.PropertyFormatter("createdParticipant"),
new fjs.PropertyFormatter("createdActiveAdmin"),
new fjs.PropertyFormatter("createdEveryAdmin"),
new fjs.PropertyFormatter("createdOther"),
]),
new fjs.ObjectFormatter("errors",true,[
new fjs.PropertyFormatter("retry"),
new fjs.PropertyFormatter("continue"),
new fjs.PropertyFormatter("backup"),
new fjs.PropertyFormatter("error"),
new fjs.PropertyFormatter("title"),
]),
new fjs.ObjectFormatter("text",true,[
new fjs.PropertyFormatter("messagesTitle"),
new fjs.PropertyFormatter("embedTitle"),
new fjs.PropertyFormatter("fileTitle"),
new fjs.PropertyFormatter("fieldsTitle"),
new fjs.PropertyFormatter("reactionsTitle"),
new fjs.PropertyFormatter("statsTitle"),
new fjs.PropertyFormatter("emptyContent"),
new fjs.PropertyFormatter("noTitle"),
new fjs.PropertyFormatter("noDesc"),
]),
]),
new fjs.ObjectFormatter("errors",true,[
new fjs.ObjectFormatter("titles",true,[
new fjs.PropertyFormatter("internalError"),
new fjs.PropertyFormatter("optionMissing"),
new fjs.PropertyFormatter("optionInvalid"),
new fjs.PropertyFormatter("unknownCommand"),
new fjs.PropertyFormatter("noPermissions"),
new fjs.PropertyFormatter("unknownTicket"),
new fjs.PropertyFormatter("deprecatedTicket"),
new fjs.PropertyFormatter("unknownOption"),
new fjs.PropertyFormatter("unknownPanel"),
new fjs.PropertyFormatter("notInGuild"),
new fjs.PropertyFormatter("channelRename"),
new fjs.PropertyFormatter("busy"),
new fjs.PropertyFormatter("permissionError"),
]),
new fjs.ObjectFormatter("descriptions",true,[
new fjs.PropertyFormatter("askForInfo"),
new fjs.PropertyFormatter("askForInfoResolve"),
new fjs.PropertyFormatter("internalError"),
new fjs.PropertyFormatter("optionMissing"),
new fjs.PropertyFormatter("optionInvalid"),
new fjs.PropertyFormatter("optionInvalidChoose"),
new fjs.PropertyFormatter("unknownCommand"),
new fjs.PropertyFormatter("noPermissions"),
new fjs.PropertyFormatter("noPermissionsList"),
new fjs.PropertyFormatter("noPermissionsCooldown"),
new fjs.PropertyFormatter("noPermissionsBlacklist"),
new fjs.PropertyFormatter("noPermissionsLimitGlobal"),
new fjs.PropertyFormatter("noPermissionsLimitGlobalUser"),
new fjs.PropertyFormatter("noPermissionsLimitOption"),
new fjs.PropertyFormatter("noPermissionsLimitOptionUser"),
new fjs.PropertyFormatter("unknownTicket"),
new fjs.PropertyFormatter("deprecatedTicket"),
new fjs.PropertyFormatter("notInGuild"),
new fjs.PropertyFormatter("channelRename"),
new fjs.PropertyFormatter("channelRenameSource"),
new fjs.PropertyFormatter("busy"),
new fjs.PropertyFormatter("closeBeforeMessage"),
new fjs.PropertyFormatter("closeBeforeAdminMessage"),
new fjs.PropertyFormatter("unableToCreateTicket"),
]),
new fjs.ObjectFormatter("optionInvalidReasons",true,[
new fjs.PropertyFormatter("stringRegex"),
new fjs.PropertyFormatter("stringMinLength"),
new fjs.PropertyFormatter("stringMaxLength"),
new fjs.PropertyFormatter("numberInvalid"),
new fjs.PropertyFormatter("numberMin"),
new fjs.PropertyFormatter("numberMax"),
new fjs.PropertyFormatter("numberDecimal"),
new fjs.PropertyFormatter("numberNegative"),
new fjs.PropertyFormatter("numberPositive"),
new fjs.PropertyFormatter("numberZero"),
new fjs.PropertyFormatter("channelNotFound"),
new fjs.PropertyFormatter("userNotFound"),
new fjs.PropertyFormatter("roleNotFound"),
new fjs.PropertyFormatter("memberNotFound"),
new fjs.PropertyFormatter("mentionableNotFound"),
new fjs.PropertyFormatter("channelType"),
new fjs.PropertyFormatter("notInGuild"),
]),
new fjs.ObjectFormatter("permissions",true,[
new fjs.PropertyFormatter("developer"),
new fjs.PropertyFormatter("owner"),
new fjs.PropertyFormatter("admin"),
new fjs.PropertyFormatter("moderator"),
new fjs.PropertyFormatter("support"),
new fjs.PropertyFormatter("member"),
new fjs.PropertyFormatter("discord-administrator"),
]),
new fjs.ObjectFormatter("actionInvalid",true,[
new fjs.PropertyFormatter("close"),
new fjs.PropertyFormatter("reopen"),
new fjs.PropertyFormatter("claim"),
new fjs.PropertyFormatter("unclaim"),
new fjs.PropertyFormatter("pin"),
new fjs.PropertyFormatter("unpin"),
new fjs.PropertyFormatter("add"),
new fjs.PropertyFormatter("remove"),
]),
]),
new fjs.ObjectFormatter("params",true,[
new fjs.ObjectFormatter("uppercase",true,[
new fjs.PropertyFormatter("ticket"),
new fjs.PropertyFormatter("tickets"),
new fjs.PropertyFormatter("reason"),
new fjs.PropertyFormatter("creator"),
new fjs.PropertyFormatter("remaining"),
new fjs.PropertyFormatter("added"),
new fjs.PropertyFormatter("removed"),
new fjs.PropertyFormatter("filter"),
new fjs.PropertyFormatter("method"),
new fjs.PropertyFormatter("type"),
new fjs.PropertyFormatter("blacklisted"),
new fjs.PropertyFormatter("panel"),
new fjs.PropertyFormatter("command"),
new fjs.PropertyFormatter("system"),
new fjs.PropertyFormatter("true"),
new fjs.PropertyFormatter("false"),
new fjs.PropertyFormatter("syntax"),
new fjs.PropertyFormatter("originalName"),
new fjs.PropertyFormatter("newName"),
new fjs.PropertyFormatter("until"),
new fjs.PropertyFormatter("validOptions"),
new fjs.PropertyFormatter("validPanels"),
new fjs.PropertyFormatter("autoclose"),
new fjs.PropertyFormatter("autodelete"),
new fjs.PropertyFormatter("startupDate"),
new fjs.PropertyFormatter("version"),
new fjs.PropertyFormatter("name"),
new fjs.PropertyFormatter("role"),
new fjs.PropertyFormatter("status"),
new fjs.PropertyFormatter("claimed"),
new fjs.PropertyFormatter("pinned"),
new fjs.PropertyFormatter("creationDate"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("noone"),
new fjs.PropertyFormatter("open"),
new fjs.PropertyFormatter("closed"),
new fjs.PropertyFormatter("priority"),
new fjs.PropertyFormatter("participants"),
new fjs.PropertyFormatter("yes"),
new fjs.PropertyFormatter("no"),
new fjs.PropertyFormatter("option"),
new fjs.PropertyFormatter("topic"),
new fjs.PropertyFormatter("uptime"),
new fjs.PropertyFormatter("messages"),
new fjs.PropertyFormatter("embeds"),
new fjs.PropertyFormatter("files"),
new fjs.PropertyFormatter("components"),
new fjs.PropertyFormatter("cooldown"),
new fjs.PropertyFormatter("maxTickets"),
new fjs.PropertyFormatter("admins"),
new fjs.PropertyFormatter("roles"),
new fjs.PropertyFormatter("size"),
]),
new fjs.ObjectFormatter("lowercase",true,[
new fjs.PropertyFormatter("text"),
new fjs.PropertyFormatter("html"),
new fjs.PropertyFormatter("command"),
new fjs.PropertyFormatter("modal"),
new fjs.PropertyFormatter("button"),
new fjs.PropertyFormatter("dropdown"),
new fjs.PropertyFormatter("method"),
]),
]),
new fjs.ObjectFormatter("commands",true,[
new fjs.PropertyFormatter("reason"),
new fjs.PropertyFormatter("help"),
new fjs.PropertyFormatter("panel"),
new fjs.PropertyFormatter("panelId"),
new fjs.PropertyFormatter("panelAutoUpdate"),
new fjs.PropertyFormatter("ticket"),
new fjs.PropertyFormatter("ticketId"),
new fjs.PropertyFormatter("close"),
new fjs.PropertyFormatter("delete"),
new fjs.PropertyFormatter("deleteNoTranscript"),
new fjs.PropertyFormatter("reopen"),
new fjs.PropertyFormatter("claim"),
new fjs.PropertyFormatter("claimUser"),
new fjs.PropertyFormatter("unclaim"),
new fjs.PropertyFormatter("pin"),
new fjs.PropertyFormatter("unpin"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("move"),
new fjs.PropertyFormatter("moveId"),
new fjs.PropertyFormatter("rename"),
new fjs.PropertyFormatter("renameName"),
new fjs.PropertyFormatter("add"),
new fjs.PropertyFormatter("addUser"),
new fjs.PropertyFormatter("remove"),
new fjs.PropertyFormatter("removeUser"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("blacklist"),
new fjs.PropertyFormatter("blacklistView"),
new fjs.PropertyFormatter("blacklistAdd"),
new fjs.PropertyFormatter("blacklistRemove"),
new fjs.PropertyFormatter("blacklistGet"),
new fjs.PropertyFormatter("blacklistGetUser"),
new fjs.PropertyFormatter("stats"),
new fjs.PropertyFormatter("statsReset"),
new fjs.PropertyFormatter("statsGlobal"),
new fjs.PropertyFormatter("statsUser"),
new fjs.PropertyFormatter("statsUserUser"),
new fjs.PropertyFormatter("statsTicket"),
new fjs.PropertyFormatter("statsTicketTicket"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("clear"),
new fjs.PropertyFormatter("clearFilter"),
new fjs.ObjectFormatter("clearFilters",true,[
new fjs.PropertyFormatter("all"),
new fjs.PropertyFormatter("open"),
new fjs.PropertyFormatter("close"),
new fjs.PropertyFormatter("claim"),
new fjs.PropertyFormatter("unclaim"),
new fjs.PropertyFormatter("pin"),
new fjs.PropertyFormatter("unpin"),
new fjs.PropertyFormatter("autoclose"),
]),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("autoclose"),
new fjs.PropertyFormatter("autocloseDisable"),
new fjs.PropertyFormatter("autocloseEnable"),
new fjs.PropertyFormatter("autocloseEnableTime"),
new fjs.PropertyFormatter("autodelete"),
new fjs.PropertyFormatter("autodeleteDisable"),
new fjs.PropertyFormatter("autodeleteEnable"),
new fjs.PropertyFormatter("autodeleteEnableTime"),
new fjs.TextFormatter(""),
new fjs.PropertyFormatter("topic"),
new fjs.PropertyFormatter("topicSet"),
new fjs.PropertyFormatter("topicValue"),
new fjs.PropertyFormatter("topicList"),
new fjs.PropertyFormatter("priority"),
new fjs.PropertyFormatter("prioritySet"),
new fjs.PropertyFormatter("priorityValue"),
new fjs.PropertyFormatter("priorityGet"),
new fjs.PropertyFormatter("priorityList"),
new fjs.PropertyFormatter("transfer"),
new fjs.PropertyFormatter("transferUser"),
]),
new fjs.ObjectFormatter("helpMenu",true,[
new fjs.PropertyFormatter("help"),
new fjs.PropertyFormatter("ticket"),
new fjs.PropertyFormatter("close"),
new fjs.PropertyFormatter("delete"),
new fjs.PropertyFormatter("reopen"),
new fjs.PropertyFormatter("pin"),
new fjs.PropertyFormatter("unpin"),
new fjs.PropertyFormatter("move"),
new fjs.PropertyFormatter("rename"),
new fjs.PropertyFormatter("claim"),
new fjs.PropertyFormatter("unclaim"),
new fjs.PropertyFormatter("add"),
new fjs.PropertyFormatter("remove"),
new fjs.PropertyFormatter("panel"),
new fjs.PropertyFormatter("blacklistView"),
new fjs.PropertyFormatter("blacklistAdd"),
new fjs.PropertyFormatter("blacklistRemove"),
new fjs.PropertyFormatter("blacklistGet"),
new fjs.PropertyFormatter("statsGlobal"),
new fjs.PropertyFormatter("statsTicket"),
new fjs.PropertyFormatter("statsUser"),
new fjs.PropertyFormatter("statsReset"),
new fjs.PropertyFormatter("autocloseDisable"),
new fjs.PropertyFormatter("autocloseEnable"),
new fjs.PropertyFormatter("autodeleteDisable"),
new fjs.PropertyFormatter("autodeleteEnable"),
new fjs.ObjectFormatter("categories",true,[
new fjs.PropertyFormatter("general"),
new fjs.PropertyFormatter("basicTicket"),
new fjs.PropertyFormatter("advancedTicket"),
new fjs.PropertyFormatter("userTicket"),
new fjs.PropertyFormatter("admin"),
new fjs.PropertyFormatter("advanced"),
new fjs.PropertyFormatter("extra"),
])
]),
new fjs.ObjectFormatter("stats",true,[
new fjs.ObjectFormatter("scopes",true,[
new fjs.PropertyFormatter("global"),
new fjs.PropertyFormatter("system"),
new fjs.PropertyFormatter("user"),
new fjs.PropertyFormatter("ticket"),
new fjs.PropertyFormatter("participants"),
new fjs.PropertyFormatter("messages"),
]),
new fjs.ObjectFormatter("properties",true,[
new fjs.PropertyFormatter("ticketsCreated"),
new fjs.PropertyFormatter("ticketsClosed"),
new fjs.PropertyFormatter("ticketsDeleted"),
new fjs.PropertyFormatter("ticketsReopened"),
new fjs.PropertyFormatter("ticketsAutoclosed"),
new fjs.PropertyFormatter("ticketsClaimed"),
new fjs.PropertyFormatter("ticketsPinned"),
new fjs.PropertyFormatter("ticketsMoved"),
new fjs.PropertyFormatter("usersBlacklisted"),
new fjs.PropertyFormatter("transcriptsCreated"),
new fjs.PropertyFormatter("ticketsAutodeleted"),
new fjs.PropertyFormatter("ticketsTransferred"),
new fjs.PropertyFormatter("ticketVolume"),
new fjs.PropertyFormatter("averageTickets"),
new fjs.PropertyFormatter("currentTickets"),
new fjs.PropertyFormatter("age"),
new fjs.PropertyFormatter("responseTime"),
new fjs.PropertyFormatter("resolutionTime"),
new fjs.PropertyFormatter("createdOn"),
new fjs.PropertyFormatter("createdBy"),
new fjs.PropertyFormatter("closedOn"),
new fjs.PropertyFormatter("closedBy"),
new fjs.PropertyFormatter("claimedOn"),
new fjs.PropertyFormatter("claimedBy"),
new fjs.PropertyFormatter("pinnedOn"),
new fjs.PropertyFormatter("pinnedBy"),
new fjs.PropertyFormatter("deletedOn"),
new fjs.PropertyFormatter("deletedBy"),
]),
new fjs.ObjectFormatter("roles",true,[
new fjs.PropertyFormatter("developer"),
new fjs.PropertyFormatter("serverOwner"),
new fjs.PropertyFormatter("serverAdmin"),
new fjs.PropertyFormatter("moderator"),
new fjs.PropertyFormatter("support"),
new fjs.PropertyFormatter("member"),
])
]),
new fjs.ObjectFormatter("panel",true,[
new fjs.PropertyFormatter("selectTicket"),
new fjs.PropertyFormatter("selectRole"),
new fjs.PropertyFormatter("selectOption"),
]),
new fjs.ObjectFormatter("priorities",true,[
new fjs.PropertyFormatter("urgent"),
new fjs.PropertyFormatter("veryHigh"),
new fjs.PropertyFormatter("high"),
new fjs.PropertyFormatter("normal"),
new fjs.PropertyFormatter("low"),
new fjs.PropertyFormatter("veryLow"),
new fjs.PropertyFormatter("none"),
]),
])
for (const language of fs.readdirSync(".docs/languages/")){
if (!fs.existsSync("./languages/"+language)){
console.log("language:",language,"does not exist yet in the primary ./languages/ folder. Unable to merge!")
continue
}
console.log("merging "+language+"...")
const original = JSON.parse(fs.readFileSync("./languages/"+language).toString())
const newSentences = JSON.parse(fs.readFileSync(".docs/languages/"+language).toString())
for (const key of Object.keys(newSentences)){
if (key.startsWith("_")) continue
try{
const splitted = key.split(".")
let currentObject = original
splitted.forEach((property,index) => {
let shouldBeObject = (splitted.length-1 !== index)
if (shouldBeObject && typeof currentObject[property] == "object"){
currentObject = currentObject[property]
}else if (shouldBeObject && typeof currentObject[property] == "undefined"){
currentObject[property] = {}
currentObject = currentObject[property]
}else if (typeof currentObject[property] == "string" || typeof currentObject[property] == "undefined"){
currentObject[property] = newSentences[key]
}else{
console.log("Failed to merge key:",key,"in file:",language,"--> Invalid type:",typeof currentObject[property])
}
})
}catch(err){
console.log("Failed to merge key:",key,"in file:",language)
}
}
original["_TRANSLATION"]["lastedited"] = new Date().toLocaleDateString("nl-BE",{day:"2-digit",month:"2-digit",year:"numeric"})
original["_TRANSLATION"]["otversion"] = "v4.1.3"
const finalText = formatter.stringify(original)
fs.writeFileSync("./languages/"+language,finalText)
}