Fixed: checker not working correctly using .env

Fixed the config checker not working correctly when parsing the token from the .env file.
This commit is contained in:
DJj123dj
2025-01-24 17:34:05 +01:00
parent 66b0377a2b
commit 19e5902320
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -169,6 +169,12 @@ const createPanelEmbedStructure = (id:api.ODValidId) => {
]})})
}
function loadFromEnv(){
const generalConfig = openticket.configs.get("openticket:general")
if (generalConfig.data && generalConfig.data.tokenFromENV && typeof generalConfig.data.tokenFromENV == "boolean") return generalConfig.data.tokenFromENV
else return false
}
//STRUCTURES
export const defaultGeneralStructure = new api.ODCheckerObjectStructure("openticket:general",{children:[
//STATUS
@@ -187,7 +193,7 @@ export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opentic
]})},
//BASIC
{key:"token",optional:false,priority:0,checker:new api.ODCheckerCustomStructure_DiscordToken("openticket:token")},
{key:"token",optional:false,priority:0,checker:(loadFromEnv()) ? new api.ODCheckerStringStructure("openticket:token-disabled",{}) : new api.ODCheckerCustomStructure_DiscordToken("openticket:token")},
{key:"tokenFromENV",optional:false,priority:0,checker:new api.ODCheckerBooleanStructure("openticket:token-env",{})},
{key:"mainColor",optional:false,priority:0,checker:new api.ODCheckerCustomStructure_HexColor("openticket:main-color",true,false)},
{key:"language",optional:false,priority:0,checker:new api.ODCheckerStringStructure("openticket:language",{